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

noreply at shibboleth.net noreply at shibboleth.net
Wed Oct 21 23:53:25 EDT 2015


Author: dfisher
Date: Wed Oct 21 23:53:25 2015
New Revision: 7856

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7856&view=rev
Log:
IDP-710 - revert part of previous commit

Remove AuthnEventsIds.AUTHN_ERROR.

Modified:
    trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstLDAP.java
    trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstLDAPTest.java

Modified: trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstLDAP.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstLDAP.java?rev=7856&r1=7855&r2=7856&view=diff
==============================================================================
--- trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstLDAP.java	(original)
+++ trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstLDAP.java	Wed Oct 21 23:53:25 2015
@@ -128,11 +128,11 @@
     @Override protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext,
             @Nonnull final AuthenticationContext authenticationContext) {
         try {
-            log.debug("{} Attempting to authenticate user {}", getLogPrefix(),
-                    getUsernamePasswordContext().getUsername());
+            log.debug("{} Attempting to authenticate user {}", getLogPrefix(), getUsernamePasswordContext()
+                    .getUsername());
             final AuthenticationRequest request =
-                    new AuthenticationRequest(getUsernamePasswordContext().getUsername(),
-                            new Credential(getUsernamePasswordContext().getPassword()), returnAttributes);
+                    new AuthenticationRequest(getUsernamePasswordContext().getUsername(), new Credential(
+                            getUsernamePasswordContext().getPassword()), returnAttributes);
             response = authenticator.authenticate(request);
             log.trace("{} Authentication response {}", getLogPrefix(), response);
             if (response.getResult()) {
@@ -167,22 +167,20 @@
                             String.format("%s:%s", response.getResultCode(), response.getMessage()),
                             AuthnEventIds.INVALID_CREDENTIALS);
                 } else {
-                    handleError(profileRequestContext, authenticationContext,
-                            String.format("%s:%s", response.getResultCode(), response.getMessage()),
-                            AuthnEventIds.AUTHN_ERROR);
+                    throw new LdapException(response.getMessage(), response.getResultCode(), response.getMatchedDn(),
+                            response.getControls(), response.getReferralURLs(), response.getMessageId());
                 }
             }
         } catch (final LdapException e) {
-            log.warn("{} Login by {} produced exception", getLogPrefix(),
-                    getUsernamePasswordContext().getUsername(), e);
+            log.warn("{} Login by {} produced exception", getLogPrefix(), getUsernamePasswordContext().getUsername(), e);
             handleError(profileRequestContext, authenticationContext, e, AuthnEventIds.AUTHN_EXCEPTION);
         }
     }
 
     /** {@inheritDoc} */
     @Override @Nonnull protected Subject populateSubject(@Nonnull final Subject subject) {
-        subject.getPrincipals().add(new LdapPrincipal(getUsernamePasswordContext().getUsername(),
-                response.getLdapEntry()));
+        subject.getPrincipals().add(
+                new LdapPrincipal(getUsernamePasswordContext().getUsername(), response.getLdapEntry()));
         return super.populateSubject(subject);
     }
 

Modified: trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstLDAPTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstLDAPTest.java?rev=7856&r1=7855&r2=7856&view=diff
==============================================================================
--- trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstLDAPTest.java	(original)
+++ trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstLDAPTest.java	Wed Oct 21 23:53:25 2015
@@ -198,9 +198,12 @@
         Assert.assertNotNull(lrc.getAuthenticationResponse());
         Assert.assertEquals(lrc.getAuthenticationResponse().getAuthenticationResultCode(), AuthenticationResultCode.AUTHENTICATION_HANDLER_FAILURE);
 
-        // no mapping defined for AUTHN_ERROR
-        Assert.assertNull(ac.getSubcontext(AuthenticationErrorContext.class, false));
-        ActionTestingSupport.assertEvent(event, AuthnEventIds.AUTHN_ERROR);
+        AuthenticationErrorContext aec = ac.getSubcontext(AuthenticationErrorContext.class, false);
+        Assert.assertNotNull(aec);

[... 8 lines stripped ...]


More information about the commits mailing list