[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
Tue Sep 29 16:01:10 EDT 2015
Author: scantor
Date: Tue Sep 29 16:01:10 2015
New Revision: 7790
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7790&view=rev
Log:
IDP-821 - Add general state communication between password form and extended flows
Added:
trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/PreserveAuthenticationFlowState.java (with props)
trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/PreserveAuthenticationFlowStateTest.java (with props)
Modified:
trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/AuthenticationContext.java
trunk/idp-conf/src/main/resources/conf/authn/password-authn-config.xml
trunk/idp-conf/src/main/resources/system/flows/authn/password-authn-beans.xml
trunk/idp-conf/src/main/resources/system/flows/authn/password-authn-flow.xml
trunk/idp-conf/src/main/resources/views/login.vm
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=7790&r1=7789&r2=7790&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 Tue Sep 29 16:01:10 2015
@@ -18,7 +18,8 @@
package net.shibboleth.idp.authn.context;
import java.security.Principal;
-import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
@@ -83,6 +84,9 @@
/** Signals authentication flow to run next, to influence selection logic. */
@Nullable private String signaledFlowId;
+ /** Storage map for interflow communication. */
+ @Nonnull private final Map<String,Object> stateMap;
+
/** A successful "initial" authentication result from the current request's initial-authn phase. */
@Nullable private AuthenticationResult initialAuthenticationResult;
@@ -103,6 +107,8 @@
activeResults = new HashMap<>();
intermediateFlows = new HashMap<>();
+ stateMap = new HashMap<>();
+
evalRegistry = new PrincipalEvalPredicateFactoryRegistry();
resultCacheable = true;
}
@@ -292,6 +298,15 @@
}
/**
+ * Get the map of intermediate state that flows can use to pass information amongst themselves.
+ *
+ * @return the state map
+ */
+ @Nonnull @Live public Map<String,Object> getAuthenticationStateMap() {
+ return stateMap;
+ }
+
+ /**
* Get the "initial" authentication result produced during this request's initial-authn phase.
*
* <p>This is used to make a previous result available for SSO even if the "forced authentication"
@@ -380,13 +395,12 @@
* {@link RequestedPrincipalContext} child of this context, if present, to determine
* if the input is compatible with it.
*
- * @param <T> type of principal
* @param component component to evaluate
*
* @return true iff the input is compatible with the requested authentication requirements or if
* no such requirements have been imposed
*/
- public <T extends Principal> boolean isAcceptable(@Nonnull final PrincipalSupportingComponent component) {
+ public boolean isAcceptable(@Nonnull final PrincipalSupportingComponent component) {
final RequestedPrincipalContext rpCtx = getSubcontext(RequestedPrincipalContext.class);
if (rpCtx != null) {
for (final Principal requestedPrincipal : rpCtx.getRequestedPrincipals()) {
@@ -407,24 +421,56 @@
return true;
}
}
-
-
+
/**
* Helper method that evaluates {@link Principal} objects against a {@link RequestedPrincipalContext} child
* of this context, if present, to determine if the input is compatible with them.
*
- * @param <T> type of principal
* @param principals principal(s) to evaluate
*
* @return true iff the input is compatible with the requested authentication requirements or if
* no such requirements have been imposed
*/
- public <T extends Principal> boolean isAcceptable(@Nonnull final T... principals) {
+ public boolean isAcceptable(@Nonnull @NonnullElements final Collection<Principal> principals) {
+ final RequestedPrincipalContext rpCtx = getSubcontext(RequestedPrincipalContext.class);
+ if (rpCtx != null) {
+ return isAcceptable(new PrincipalSupportingComponent() {
+ public <T extends Principal> Set<T> getSupportedPrincipals(Class<T> c) {
+ final HashSet set = new HashSet<>();
+ for (final Principal p : principals) {
+ if (c.isAssignableFrom(p.getClass())) {
+ set.add(p);
[... 231 lines stripped ...]
More information about the commits
mailing list