[java-identity-provider COMMIT] in /trunk: idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateExterna...

noreply at shibboleth.net noreply at shibboleth.net
Thu Sep 18 12:47:32 EDT 2014


Author: scantor
Date: Thu Sep 18 12:47:32 2014
New Revision: 6544

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=6544&view=rev
Log:
Clean up error handling and fall-through support in exernal login flows.

Modified:
    trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateExternalAuthentication.java
    trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/X509AuthServlet.java
    trunk/idp-conf/src/main/resources/conf/authn/remoteuser-authn-config.xml
    trunk/idp-conf/src/main/resources/conf/authn/x509-authn-config.xml

Modified: trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateExternalAuthentication.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateExternalAuthentication.java?rev=6544&r1=6543&r2=6544&view=diff
==============================================================================
--- trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateExternalAuthentication.java (original)
+++ trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateExternalAuthentication.java Thu Sep 18 12:47:32 2014
@@ -22,7 +22,6 @@
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import javax.security.auth.Subject;
-import javax.security.auth.login.LoginException;
 
 import net.shibboleth.idp.authn.AbstractValidationAction;
 import net.shibboleth.idp.authn.AuthnEventIds;
@@ -99,7 +98,7 @@
         } else if (extContext.getAuthnError() != null) {
             log.warn("{} External authentication produced error message: {}", getLogPrefix(),
                     extContext.getAuthnError());
-            handleError(profileRequestContext, authenticationContext, new LoginException(extContext.getAuthnError()),
+            handleError(profileRequestContext, authenticationContext, extContext.getAuthnError(),
                     AuthnEventIds.AUTHN_EXCEPTION);
             return;
         }
@@ -121,8 +120,7 @@
         } else {
             log.info("{} External authentication failed, no user identity or error information returned",
                     getLogPrefix());
-            handleError(profileRequestContext, authenticationContext,
-                    new LoginException("No information returned by external authentication"),
+            handleError(profileRequestContext, authenticationContext, AuthnEventIds.NO_CREDENTIALS,
                     AuthnEventIds.NO_CREDENTIALS);
             return;
         }

Modified: trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/X509AuthServlet.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/X509AuthServlet.java?rev=6544&r1=6543&r2=6544&view=diff
==============================================================================
--- trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/X509AuthServlet.java (original)
+++ trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/X509AuthServlet.java Thu Sep 18 12:47:32 2014
@@ -24,7 +24,6 @@
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import javax.security.auth.Subject;
-import javax.security.auth.login.LoginException;
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletException;
 import javax.servlet.http.Cookie;
@@ -32,6 +31,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import net.shibboleth.idp.authn.AuthnEventIds;
 import net.shibboleth.idp.authn.ExternalAuthentication;
 import net.shibboleth.idp.authn.ExternalAuthenticationException;
 import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
@@ -110,8 +110,7 @@
 
             if (certs == null || certs.length < 1) {
                 log.error("No X.509 Certificates found in request");
-                httpRequest.setAttribute(ExternalAuthentication.AUTHENTICATION_EXCEPTION_KEY,
-                        new LoginException("No X509Certificates found in request"));
+                httpRequest.setAttribute(ExternalAuthentication.AUTHENTICATION_ERROR_KEY, AuthnEventIds.NO_CREDENTIALS);
                 ExternalAuthentication.finishExternalAuthentication(key, httpRequest, httpResponse);
                 return;
             }
@@ -128,8 +127,8 @@
                         log.debug("Trust engine validated X.509 certificate");
                     } else {
                         log.warn("Trust engine failed to validate X.509 certificate");
-                        httpRequest.setAttribute(ExternalAuthentication.AUTHENTICATION_EXCEPTION_KEY,
-                                new LoginException("Trust engine failed to validate X.509 certificate"));
+                        httpRequest.setAttribute(ExternalAuthentication.AUTHENTICATION_ERROR_KEY,
+                                AuthnEventIds.INVALID_CREDENTIALS);
                         ExternalAuthentication.finishExternalAuthentication(key, httpRequest, httpResponse);
                         return;

[... 55 lines stripped ...]


More information about the commits mailing list