diff --git a/src/main/java/fr/titionfire/ExampleResource.java b/src/main/java/fr/titionfire/ExampleResource.java index 04b56c7..c7aee61 100644 --- a/src/main/java/fr/titionfire/ExampleResource.java +++ b/src/main/java/fr/titionfire/ExampleResource.java @@ -1,16 +1,90 @@ package fr.titionfire; +import io.quarkus.oidc.IdToken; +import io.quarkus.oidc.RefreshToken; +import io.quarkus.security.identity.SecurityIdentity; +import jakarta.inject.Inject; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.MediaType; +import org.eclipse.microprofile.jwt.JsonWebToken; +import org.jboss.resteasy.reactive.NoCache; @Path("/hello") public class ExampleResource { + /*@Inject + @IdToken + JsonWebToken idToken; + @GET @Produces(MediaType.TEXT_PLAIN) public String hello() { - return "Hello from RESTEasy Reactive"; + return "Hello, " + idToken.getClaim("name"); + }*/ + + /** + * Injection point for the ID Token issued by the OpenID Connect Provider + */ + @Inject + @IdToken + JsonWebToken idToken; + + /** + * Injection point for the Access Token issued by the OpenID Connect Provider + */ + @Inject + JsonWebToken accessToken; + + /** + * Injection point for the Refresh Token issued by the OpenID Connect Provider + */ + @Inject + RefreshToken refreshToken; + + @Inject + SecurityIdentity securityIdentity; + + /** + * Returns the tokens available to the application. This endpoint exists only for demonstration purposes, you should not + * expose these tokens in a real application. + * + * @return a HTML page containing the tokens available to the application + */ + @GET + @Produces("text/html") + @NoCache + public String getTokens() { + StringBuilder response = new StringBuilder().append("") + .append("
") + .append("