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

noreply at shibboleth.net noreply at shibboleth.net
Fri Aug 16 16:49:26 EDT 2013


Author: scantor
Date: Fri Aug 16 16:49:26 2013
New Revision: 4704

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4704&view=rev
Log:
Move responsibility for adding AuthenticationContext out of authn flow.

Modified:
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/AuthenticationContext.java
    trunk/idp-authn-api/src/test/java/net/shibboleth/idp/authn/context/AuthenticationContextTest.java
    trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/InitializeAuthenticationContext.java
    trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/InitializeAuthenticationContextTest.java
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAuthenticationStatementToAssertionTest.java

Modified: trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/AuthenticationContext.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/AuthenticationContext.java?rev=4704&r1=4703&r2=4704&view=diff
==============================================================================
--- trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/AuthenticationContext.java (original)
+++ trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/AuthenticationContext.java Fri Aug 16 16:49:26 2013
@@ -70,7 +70,7 @@
     @Nonnull @NonnullElements private final Map<String, AuthenticationFlowDescriptor> potentialFlows;
 
     /** The registry of predicate factories for custom principal evaluation. */
-    @Nonnull private final PrincipalEvalPredicateFactoryRegistry evalRegistry;
+    @Nonnull private PrincipalEvalPredicateFactoryRegistry evalRegistry;
     
     /** Flows, in order of preference, that satisfy an explicit requirement from the relying party. */
     @Nonnull @NonnullElements private ImmutableList<AuthenticationFlowDescriptor> requestedFlows;
@@ -87,25 +87,15 @@
     /** Time, in milliseconds since the epoch, when authentication process completed. */
     @NonNegative private long completionInstant;
 
-    /**
-     * Constructor.
-     *
-     * @param availableFlows authentication flows currently available
-     * @param registry predicate factory registry for principal evaluation
-     */
-    public AuthenticationContext(
-            @Nonnull @NonnullElements final Collection<AuthenticationFlowDescriptor> availableFlows,
-            @Nonnull final PrincipalEvalPredicateFactoryRegistry registry) {
+    /** Constructor. */
+    public AuthenticationContext() {
         super();
 
         initiationInstant = System.currentTimeMillis();
         
         potentialFlows = new HashMap();
-        for (AuthenticationFlowDescriptor descriptor : availableFlows) {
-            potentialFlows.put(descriptor.getId(), descriptor);
-        }
         
-        evalRegistry = Constraint.isNotNull(registry, "PrincipalEvalPredicateFactoryRegistry cannot be null");
+        evalRegistry = new PrincipalEvalPredicateFactoryRegistry();
 
         activeResults = new HashMap();
         requestedFlows = ImmutableList.of();
@@ -164,6 +154,16 @@
      */
     @Nonnull public PrincipalEvalPredicateFactoryRegistry getPrincipalEvalPredicateFactoryRegistry() {
         return evalRegistry;
+    }
+
+    /**
+     * Set the registry of predicate factories for custom principal evaluation.
+     * 
+     * @param registry predicate factory registry
+     */
+    public void setPrincipalEvalPredicateFactoryRegistry(
+            @Nonnull final PrincipalEvalPredicateFactoryRegistry registry) {
+        evalRegistry = Constraint.isNotNull(registry, "PrincipalEvalPredicateFactoryRegistry cannot be null");
     }
     
     /**

Modified: trunk/idp-authn-api/src/test/java/net/shibboleth/idp/authn/context/AuthenticationContextTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-api/src/test/java/net/shibboleth/idp/authn/context/AuthenticationContextTest.java?rev=4704&r1=4703&r2=4704&view=diff
==============================================================================
--- trunk/idp-authn-api/src/test/java/net/shibboleth/idp/authn/context/AuthenticationContextTest.java (original)
+++ trunk/idp-authn-api/src/test/java/net/shibboleth/idp/authn/context/AuthenticationContextTest.java Fri Aug 16 16:49:26 2013
@@ -25,7 +25,6 @@
 
 import net.shibboleth.idp.authn.AuthenticationFlowDescriptor;
 import net.shibboleth.idp.authn.AuthenticationResult;
-import net.shibboleth.idp.authn.PrincipalEvalPredicateFactoryRegistry;
 
 import org.testng.Assert;
 import org.testng.annotations.Test;
@@ -39,15 +38,13 @@
         // this is here to allow the event's creation time to deviate from the 'start' time
         Thread.sleep(50);
 
-        AuthenticationContext ctx = new AuthenticationContext(
-                Collections.<AuthenticationFlowDescriptor>emptyList(), new PrincipalEvalPredicateFactoryRegistry());
+        AuthenticationContext ctx = new AuthenticationContext();
         Assert.assertTrue(ctx.getInitiationInstant() > start);
     }
 

[... 209 lines stripped ...]


More information about the commits mailing list