[java-identity-provider COMMIT] in /trunk: idp-authn-api/src/main/java/net/shibboleth/idp/authn/principal/Authenticat...

noreply at shibboleth.net noreply at shibboleth.net
Mon Apr 25 22:45:57 EDT 2016


Author: scantor
Date: Mon Apr 25 22:45:57 2016
New Revision: 8216

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=8216&view=rev
Log:
IDP-962 - Login flow or framework for combining authentication factors

Support for storage of nested AuthenticationResult objects within a parent result.

Added:
    trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/principal/impl/AuthenticationResultPrincipalSerializer.java   (with props)
    trunk/idp-authn-impl/src/test/resources/net/shibboleth/idp/authn/impl/NestedAuthenticationResult.json
Modified:
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/principal/AuthenticationResultPrincipal.java
    trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/DefaultAuthenticationResultSerializer.java
    trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/DefaultAuthenticationResultSerializerTest.java

Modified: trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/principal/AuthenticationResultPrincipal.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/principal/AuthenticationResultPrincipal.java?rev=8216&r1=8215&r2=8216&view=diff
==============================================================================
--- trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/principal/AuthenticationResultPrincipal.java	(original)
+++ trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/principal/AuthenticationResultPrincipal.java	Mon Apr 25 22:45:57 2016
@@ -52,7 +52,7 @@
      * 
      * @return the authentication result
      */
-    @Nonnull public AuthenticationResult getAuthenticatonResult() {
+    @Nonnull public AuthenticationResult getAuthenticationResult() {
         return authnResult;
     }
 
@@ -72,7 +72,7 @@
         }
 
         if (other instanceof AuthenticationResultPrincipal) {
-            return authnResult.equals(((AuthenticationResultPrincipal) other).getAuthenticatonResult());
+            return authnResult.equals(((AuthenticationResultPrincipal) other).getAuthenticationResult());
         }
 
         return false;

Modified: trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/DefaultAuthenticationResultSerializer.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/DefaultAuthenticationResultSerializer.java?rev=8216&r1=8215&r2=8216&view=diff
==============================================================================
--- trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/DefaultAuthenticationResultSerializer.java	(original)
+++ trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/DefaultAuthenticationResultSerializer.java	Mon Apr 25 22:45:57 2016
@@ -22,6 +22,7 @@
 import java.io.StringWriter;
 import java.security.Principal;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Set;
@@ -42,6 +43,7 @@
 
 import net.shibboleth.idp.authn.AuthenticationResult;
 import net.shibboleth.idp.authn.principal.PrincipalSerializer;
+import net.shibboleth.idp.authn.principal.impl.AuthenticationResultPrincipalSerializer;
 import net.shibboleth.idp.authn.principal.impl.GenericPrincipalSerializer;
 import net.shibboleth.idp.authn.principal.impl.UsernamePrincipalSerializer;
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
@@ -91,6 +93,9 @@
     /** Principal serializers. */
     @Nonnull @NonnullElements private Collection<PrincipalSerializer<String>> principalSerializers;
 
+    /** Specialized serializer for {@link AuthenticatonResultPrincipal} that requires a circular ref. */
+    @Nonnull private final AuthenticationResultPrincipalSerializer authnResultPrincipalSerializer;
+    
     /** Generic principal serializer for any unsupported principals. */
     @Nonnull private final GenericPrincipalSerializer genericSerializer;
 
@@ -100,6 +105,7 @@
         readerFactory = Json.createReaderFactory(null);
         
         principalSerializers = Collections.emptyList();
+        authnResultPrincipalSerializer = new AuthenticationResultPrincipalSerializer(this);
         genericSerializer = new GenericPrincipalSerializer();
     }
 
@@ -132,12 +138,16 @@
         ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
         
         genericSerializer.initialize();
+        authnResultPrincipalSerializer.initialize();
         
         if (principalSerializers.isEmpty()) {
-            PrincipalSerializer<String> ups = new UsernamePrincipalSerializer();
+            final PrincipalSerializer<String> ups = new UsernamePrincipalSerializer();
             ups.initialize();
-            principalSerializers = Collections.singletonList(ups);
-        }
+            principalSerializers = Arrays.asList(ups, authnResultPrincipalSerializer);
+        } else {
+            principalSerializers.add(authnResultPrincipalSerializer);
+        }
+
     }
 
     /** {@inheritDoc} */


[... 50 lines stripped ...]


More information about the commits mailing list