[java-identity-provider COMMIT] in /trunk/idp-authn-api: pom.xml src/main/java/net/shibboleth/idp/authn/AbstractValid...

noreply at shibboleth.net noreply at shibboleth.net
Thu Dec 5 22:49:31 EST 2013


Author: dfisher
Date: Thu Dec  5 22:49:31 2013
New Revision: 4994

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4994&view=rev
Log:
Add LDAPResponseContext for shipping LDAP response data around in the AuthenticationContext.
Add AuthenticationWarningContext to mirror AuthenticationErrorContext for successful authentication events. 
Update AbstractValidationAction handleError for both Strings and Exceptions.
Change the MessageChecker predicate to operate on Strings rather than Exceptions.
See IDP-113.

Added:
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/AuthenticationWarningContext.java
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/LDAPResponseContext.java
Modified:
    trunk/idp-authn-api/pom.xml
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction.java
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AuthnEventIds.java

Modified: trunk/idp-authn-api/pom.xml
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-api/pom.xml?rev=4994&r1=4993&r2=4994&view=diff
==============================================================================
--- trunk/idp-authn-api/pom.xml (original)
+++ trunk/idp-authn-api/pom.xml Thu Dec  5 22:49:31 2013
@@ -27,6 +27,10 @@
             <artifactId>opensaml-profile-api</artifactId>
             <version>${opensaml.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.ldaptive</groupId>
+            <artifactId>ldaptive</artifactId>
+        </dependency>
 
         <dependency>
             <groupId>javax.json</groupId>

Modified: trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction.java?rev=4994&r1=4993&r2=4994&view=diff
==============================================================================
--- trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction.java (original)
+++ trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction.java Thu Dec  5 22:49:31 2013
@@ -29,6 +29,7 @@
 
 import net.shibboleth.idp.authn.context.AuthenticationContext;
 import net.shibboleth.idp.authn.context.AuthenticationErrorContext;
+import net.shibboleth.idp.authn.context.AuthenticationWarningContext;
 import net.shibboleth.idp.authn.context.RequestedPrincipalContext;
 import net.shibboleth.idp.authn.context.SubjectCanonicalizationContext;
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
@@ -272,14 +273,36 @@
     protected void handleError(@Nonnull final ProfileRequestContext profileRequestContext,
             @Nonnull final AuthenticationContext authenticationContext, @Nonnull final Exception e,
             @Nonnull @NotEmpty final String eventId) {
-        
+
         AuthenticationErrorContext errorCtx =
                 authenticationContext.getSubcontext(AuthenticationErrorContext.class, true);
         errorCtx.addException(e);
+
+        handleError(profileRequestContext, authenticationContext, e.getMessage(), eventId);
+    }
+    
+    /**
+     * Adds a message encountered during the action to an {@link AuthenticationErrorContext}, creating one if
+     * necessary, beneath the {@link AuthenticationContext}, and uses the supplied event as the result of the action.
+     * 
+     * <p>The message is matched against the various error message collections to determine whether to also set
+     * one of the {@link AuthenticationErrorContext} flags to indicate a more specific error type.</p>
+     * 
+     * @param profileRequestContext the current profile request context
+     * @param authenticationContext the current authentication context
+     * @param message to process
+     * @param eventId the event to "return" via an {@link org.opensaml.profile.context.EventContext}
+     */
+    protected void handleError(@Nonnull final ProfileRequestContext profileRequestContext,
+            @Nonnull final AuthenticationContext authenticationContext, @Nonnull final String message,
+            @Nonnull @NotEmpty final String eventId) {
+        
+        AuthenticationErrorContext errorCtx =
+                authenticationContext.getSubcontext(AuthenticationErrorContext.class, true);
         
         ActionSupport.buildEvent(profileRequestContext, eventId);
 
-        MessageChecker checker = new MessageChecker(e);
+        MessageChecker checker = new MessageChecker(message);
         
         for (Map.Entry<String, Collection<String>> entry : classifiedMessages.entrySet()) {
             if (Iterables.any(entry.getValue(), checker)) {
@@ -289,26 +312,55 @@
     }
     
     /**
-     * A predicate that examines an Exception to see if its error message contains
-     * a particular String.
+     * Adds a message encountered during the action to an {@link AuthenticationWarningContext}, creating one if

[... 74 lines stripped ...]


More information about the commits mailing list