From 1f3614708d6e59e626fb4aa17bdd37deeb788111 Mon Sep 17 00:00:00 2001 From: Sergey Beryozkin Date: Sat, 16 Sep 2023 11:17:16 +0100 Subject: [PATCH] Warn when wrong token proxy is accessed --- .../io/quarkus/oidc/runtime/OidcJsonWebTokenProducer.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcJsonWebTokenProducer.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcJsonWebTokenProducer.java index 7c4c540ebeb6f..c9a66cf76f5d9 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcJsonWebTokenProducer.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcJsonWebTokenProducer.java @@ -79,7 +79,9 @@ private JsonWebToken getTokenCredential(Class type) { return new OidcJwtCallerPrincipal(jwtClaims, credential); } String tokenType = type == AccessTokenCredential.class ? "access" : "ID"; - LOG.tracef("Current identity is not associated with an %s token", tokenType); + LOG.warnf( + "Identity is not associated with an %s token. Access 'JsonWebToken' with '@IdToken' qualifier if ID token is required and 'JsonWebToken' without this qualifier when JWT access token is required. Inject either 'io.quarkus.security.identity.SecurityIdentity' or 'io.quarkus.oidc.UserInfo' if you need to have the same endpoint code working for both authorization code and bearer token authentication flows.", + tokenType); return new NullJsonWebToken(); } }