From 60525a52af69cc5a64e28724cb7c751ce0f94a8a Mon Sep 17 00:00:00 2001 From: Justin Richer Date: Fri, 19 Apr 2013 11:40:44 -0400 Subject: [PATCH] added null checks in client filter --- .../connect/client/OIDCAuthenticationFilter.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/openid-connect-client/src/main/java/org/mitre/openid/connect/client/OIDCAuthenticationFilter.java b/openid-connect-client/src/main/java/org/mitre/openid/connect/client/OIDCAuthenticationFilter.java index 87afddd3b..e6353b744 100644 --- a/openid-connect-client/src/main/java/org/mitre/openid/connect/client/OIDCAuthenticationFilter.java +++ b/openid-connect-client/src/main/java/org/mitre/openid/connect/client/OIDCAuthenticationFilter.java @@ -157,10 +157,25 @@ public class OIDCAuthenticationFilter extends AbstractAuthenticationProcessingFi } else { String issuer = issResp.getIssuer(); + if (Strings.isNullOrEmpty(issuer)) { + logger.error("No issuer found: " + issuer); + throw new AuthenticationServiceException("No issuer found: " + issuer); + } + session.setAttribute(ISSUER_SESSION_VARIABLE, issuer); ServerConfiguration serverConfig = servers.getServerConfiguration(issuer); + if (serverConfig == null) { + logger.error("No server configuration found for issuer: " + issuer); + throw new AuthenticationServiceException("No server configuration found for issuer: " + issuer); + } + + ClientDetails clientConfig = clients.getClientConfiguration(issuer); + if (clientConfig == null) { + logger.error("No client configuration found for issuer: " + issuer); + throw new AuthenticationServiceException("No client configuration found for issuer: " + issuer); + } // our redirect URI is this current URL, with no query parameters String redirectUri = request.getRequestURL().toString();