From f7a082d4b85b6a7f0c29b3509db417097fe74f24 Mon Sep 17 00:00:00 2001 From: Justin Richer Date: Tue, 23 Jun 2015 20:57:24 -0400 Subject: [PATCH] wrapped timestamp injection in a null-safe block, with warning; closes #849 --- .../service/impl/DefaultOIDCTokenService.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/openid-connect-server/src/main/java/org/mitre/openid/connect/service/impl/DefaultOIDCTokenService.java b/openid-connect-server/src/main/java/org/mitre/openid/connect/service/impl/DefaultOIDCTokenService.java index fc6b8679a..8583827d5 100644 --- a/openid-connect-server/src/main/java/org/mitre/openid/connect/service/impl/DefaultOIDCTokenService.java +++ b/openid-connect-server/src/main/java/org/mitre/openid/connect/service/impl/DefaultOIDCTokenService.java @@ -109,9 +109,15 @@ public class DefaultOIDCTokenService implements OIDCTokenService { || (request.getExtensions().containsKey("idtoken")) // TODO: parse the ID Token claims (#473) -- for now assume it could be in there || (client.getRequireAuthTime() != null && client.getRequireAuthTime())) { - Long authTimestamp = Long.parseLong((String) request.getExtensions().get(AuthenticationTimeStamper.AUTH_TIMESTAMP)); - if (authTimestamp != null) { - idClaims.setClaim("auth_time", authTimestamp / 1000L); + if (request.getExtensions().get(AuthenticationTimeStamper.AUTH_TIMESTAMP) != null) { + + Long authTimestamp = Long.parseLong((String) request.getExtensions().get(AuthenticationTimeStamper.AUTH_TIMESTAMP)); + if (authTimestamp != null) { + idClaims.setClaim("auth_time", authTimestamp / 1000L); + } + } else { + // we couldn't find the timestamp! + logger.warn("Unable to find authentication timestamp! There is likely something wrong witht he configuration."); } }