X-Git-Url: https://repo.niif.hu/gitweb/gitweb.cgi?p=java-idp.git;a=blobdiff_plain;f=src%2Fedu%2Finternet2%2Fmiddleware%2Fshibboleth%2Fidp%2Fauthn%2FAuthenticationEngine.java;h=c96aca9c1bd7672314bcba3196347421129a084d;hp=b28918903da973d4c916ee4ea3c00aef9fc33685;hb=c45916022b9bdc2ec91bb7468dc2a5da57ec1094;hpb=1360bf5372b5593541feee405a66651bf8dce456 diff --git a/src/edu/internet2/middleware/shibboleth/idp/authn/AuthenticationEngine.java b/src/edu/internet2/middleware/shibboleth/idp/authn/AuthenticationEngine.java index b289189..c96aca9 100644 --- a/src/edu/internet2/middleware/shibboleth/idp/authn/AuthenticationEngine.java +++ b/src/edu/internet2/middleware/shibboleth/idp/authn/AuthenticationEngine.java @@ -387,15 +387,17 @@ public class AuthenticationEngine extends HttpServlet { */ protected void completeAuthentication(LoginContext loginContext, HttpServletRequest httpRequest, HttpServletResponse httpResponse) { + LOG.debug("Completing user authentication process"); // We check if the principal name was already set in the login context // if not attempt to pull it from where login handlers are supposed to provide it - String principalName = loginContext.getPrincipalName(); + String principalName = DatatypeHelper.safeTrimOrNullString(loginContext.getPrincipalName()); if (principalName == null) { - DatatypeHelper.safeTrimOrNullString((String) httpRequest.getAttribute(LoginHandler.PRINCIPAL_NAME_KEY)); + principalName = DatatypeHelper.safeTrimOrNullString((String) httpRequest + .getAttribute(LoginHandler.PRINCIPAL_NAME_KEY)); if (principalName != null) { loginContext.setPrincipalName(principalName); - }else{ + } else { loginContext.setPrincipalAuthenticated(false); loginContext.setAuthenticationFailure(new AuthenticationException( "No principal name returned from authentication handler.")); @@ -406,7 +408,7 @@ public class AuthenticationEngine extends HttpServlet { } } loginContext.setPrincipalAuthenticated(true); - + // We allow a login handler to override the authentication method in the event that it supports multiple methods String actualAuthnMethod = DatatypeHelper.safeTrimOrNullString((String) httpRequest .getAttribute(LoginHandler.AUTHENTICATION_METHOD_KEY));