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

noreply at shibboleth.net noreply at shibboleth.net
Thu Jul 18 16:59:35 EDT 2013


Author: scantor
Date: Thu Jul 18 16:59:35 2013
New Revision: 4601

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4601&view=rev
Log:
Fix up the bootstrap action for authn.

Modified:
    trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/InitializeAuthenticationContext.java
    trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/package-info.java
    trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/InitializeAuthenticationContextTest.java

Modified: trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/InitializeAuthenticationContext.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/InitializeAuthenticationContext.java?rev=4601&r1=4600&r2=4601&view=diff
==============================================================================
--- trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/InitializeAuthenticationContext.java (original)
+++ trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/InitializeAuthenticationContext.java Thu Jul 18 16:59:35 2013
@@ -17,16 +17,23 @@
 
 package net.shibboleth.idp.authn.impl;
 
-import java.util.Collection;
+import java.util.List;
 
 import javax.annotation.Nonnull;
 
 import net.shibboleth.idp.authn.AuthenticationWorkflowDescriptor;
 import net.shibboleth.idp.authn.context.AuthenticationContext;
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
+import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
+import net.shibboleth.utilities.java.support.logic.Constraint;
 
 import org.opensaml.profile.ProfileException;
 import org.opensaml.profile.action.AbstractProfileAction;
 import org.opensaml.profile.context.ProfileRequestContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.ImmutableList;
 
 /**
  * An action that creates a {@link AuthenticationContext} and sets it as a child of the current
@@ -37,13 +44,44 @@
  */
 public class InitializeAuthenticationContext extends AbstractProfileAction {
 
+    /** Class logger. */
+    private final Logger log = LoggerFactory.getLogger(InitializeAuthenticationContext.class);
+    
+    /** The workflows to make available for possible use. */
+    @Nonnull @NonnullElements private ImmutableList<AuthenticationWorkflowDescriptor> availableWorkflows;
+
+    /** Constructor. */
+    InitializeAuthenticationContext() {
+        availableWorkflows = ImmutableList.of();
+    }
+    
+    /**
+     * Get the workflows available for possible use.
+     * 
+     * @return  workflows available for possible use
+     */
+    @Nonnull @NonnullElements @Unmodifiable public List<AuthenticationWorkflowDescriptor> getAvailableWorkflows() {
+        return availableWorkflows;
+    }
+    
+    /**
+     * Set the workflows available for possible use.
+     * 
+     * @param workflows the workflows available for possible use
+     */
+    public void setAvailableWorkflows(
+            @Nonnull @NonnullElements final List<AuthenticationWorkflowDescriptor> workflows) {
+        availableWorkflows = ImmutableList.copyOf(Constraint.isNotNull(workflows, "Workflow list cannot be null"));
+    }
+    
     /** {@inheritDoc} */
     protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) throws ProfileException {
 
-        // TODO(lajoie) get configured authentication mechanisms
-        Collection<AuthenticationWorkflowDescriptor> availableFlows = null;
-
-        AuthenticationContext authnCtx = new AuthenticationContext(availableFlows);
+        if (availableWorkflows.isEmpty()) {
+            log.warn("No authentication workflows are configured for use.");
+        }
+        
+        AuthenticationContext authnCtx = new AuthenticationContext(availableWorkflows);
         profileRequestContext.addSubcontext(authnCtx);
     }
 }

Modified: trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/package-info.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/package-info.java?rev=4601&r1=4600&r2=4601&view=diff
==============================================================================
--- trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/package-info.java (original)
+++ trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/package-info.java Thu Jul 18 16:59:35 2013
@@ -15,6 +15,5 @@
  * limitations under the License.
  */
 
-/** Implementation of various authentication workflow steps. */
-
+/** Implementation of various authentication actions. */
 package net.shibboleth.idp.authn.impl;

Modified: trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/InitializeAuthenticationContextTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/InitializeAuthenticationContextTest.java?rev=4601&r1=4600&r2=4601&view=diff

[... 49 lines stripped ...]


More information about the commits mailing list