I can access @IdToken when running this Quarkus guide: https://quarkus.io/guides/security-openid-connect-web-authentication. It uses "quarkus.oidc.application-type=web-app".
However when I try to access @IdToken in this other Quarkus guide (https://quarkus.io/guides/security-openid-connect), I get the following exception:
io.quarkus.oidc.OIDCException: Current identity is not associated with an ID token
The only difference that I see is that the second guide uses "quarkus.oidc.application-type=service" which is the default.
I've tried to pass in both an access token and an id token, which I retrieve from Keycloak earlier, in the Authorization header, but without luck.
How can I get @IdToken to work to protect service applications as in the second guide?
To reproduce copy this snippet in https://github.com/quarkusio/quarkus-quickstarts/blob/master/security-openid-connect-quickstart/src/main/java/org/acme/security/openid/connect/UsersResource.java:
@Inject
@IdToken
JsonWebToken idToken;
@GET
@RolesAllowed("user")
@Path("/myname")
public String getUserName() {
return idToken.getName();
}
Thanks!