[java-identity-provider COMMIT] /trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/AuthenticationCon...
noreply at shibboleth.net
noreply at shibboleth.net
Thu Aug 15 18:14:29 EDT 2013
Author: scantor
Date: Thu Aug 15 18:14:28 2013
New Revision: 4691
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4691&view=rev
Log:
Change collection handling.
Modified:
trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/context/AuthenticationContext.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=4691&r1=4690&r2=4691&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 Thu Aug 15 18:14:28 2013
@@ -41,7 +41,6 @@
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMap.Builder;
/**
* A context representing the state of an authentication attempt, this is the primary
@@ -67,13 +66,13 @@
@Nullable private String canonicalPrincipalName;
/** Flows that could potentially be used to authenticate the user. */
- @Nonnull @NonnullElements private Map<String, AuthenticationFlowDescriptor> potentialFlows;
+ @Nonnull @NonnullElements private final Map<String, AuthenticationFlowDescriptor> potentialFlows;
/** Flows, in order of preference, that satisfy an explicit requirement from the relying party. */
@Nonnull @NonnullElements private ImmutableList<AuthenticationFlowDescriptor> requestedFlows;
/** Authentication results associated with an active session and available for (re)use. */
- @Nonnull @NonnullElements private ImmutableMap<String, AuthenticationResult> activeResults;
+ @Nonnull @NonnullElements private final Map<String, AuthenticationResult> activeResults;
/** Authentication flow being attempted to authenticate the user. */
@Nullable private AuthenticationFlowDescriptor attemptedFlow;
@@ -95,7 +94,7 @@
initiationInstant = System.currentTimeMillis();
- potentialFlows = new HashMap<>();
+ potentialFlows = new HashMap();
if (availableFlows != null) {
for (AuthenticationFlowDescriptor descriptor : availableFlows) {
@@ -103,7 +102,7 @@
}
}
- activeResults = ImmutableMap.of();
+ activeResults = new HashMap();
requestedFlows = ImmutableList.of();
}
@@ -122,7 +121,7 @@
* @return authentication results currently active for the subject
*/
@Nonnull @NonnullElements @Unmodifiable public Map<String, AuthenticationResult> getActiveResults() {
- return activeResults;
+ return ImmutableMap.copyOf(activeResults);
}
/**
@@ -134,17 +133,12 @@
*/
@Nonnull public AuthenticationContext setActiveResults(
@Nonnull @NonnullElements final Collection<AuthenticationResult> results) {
- if (Constraint.isNotNull(results, "Flow collection cannot be null").isEmpty()) {
- activeResults = ImmutableMap.of();
- return this;
+ Constraint.isNotNull(results, "AuthenticationResult collection cannot be null");
+
+ activeResults.clear();
+ for (AuthenticationResult result : results) {
+ activeResults.put(result.getAuthenticationFlowId(), result);
}
-
- Builder<String, AuthenticationResult> resultsBuilder = new ImmutableMap.Builder<>();
- for (AuthenticationResult result : results) {
- resultsBuilder.put(result.getAuthenticationFlowId(), result);
- }
-
- activeResults = resultsBuilder.build();
return this;
}
More information about the commits
mailing list