KEYCLOAK-18440 Improve logging for token introspection

This commit is contained in:
Yoshiyuki Tabata 2021-06-11 15:42:43 +09:00 committed by Hynek Mlnařík
parent dd69bb5d33
commit 9be4c289d8
2 changed files with 5 additions and 0 deletions

View file

@ -18,6 +18,7 @@
package org.keycloak.protocol.oidc;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.jboss.logging.Logger;
import org.keycloak.TokenVerifier;
import org.keycloak.common.VerificationException;
import org.keycloak.crypto.SignatureProvider;
@ -40,6 +41,7 @@ public class AccessTokenIntrospectionProvider implements TokenIntrospectionProvi
private final KeycloakSession session;
private final TokenManager tokenManager;
private final RealmModel realm;
private static final Logger logger = Logger.getLogger(AccessTokenIntrospectionProvider.class);
public AccessTokenIntrospectionProvider(KeycloakSession session) {
this.session = session;
@ -90,6 +92,7 @@ public class AccessTokenIntrospectionProvider implements TokenIntrospectionProvi
accessToken = verifier.verify().getToken();
} catch (VerificationException e) {
logger.debugf("JWT check failed: %s", e.getMessage());
return null;
}

View file

@ -237,6 +237,7 @@ public class TokenManager {
.withChecks(NotBeforeCheck.forModel(client), TokenVerifier.IS_ACTIVE)
.verify();
} catch (VerificationException e) {
logger.debugf("JWT check failed: %s", e.getMessage());
return false;
}
@ -326,6 +327,7 @@ public class TokenManager {
.withChecks(NotBeforeCheck.forModel(session ,realm, user))
.verify();
} catch (VerificationException e) {
logger.debugf("JWT check failed: %s", e.getMessage());
return false;
}
return true;