[java-identity-provider COMMIT] /trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/PopulateMultiFactor...
noreply at shibboleth.net
noreply at shibboleth.net
Tue Aug 2 14:49:44 EDT 2016
Author: scantor
Date: Tue Aug 2 14:49:43 2016
New Revision: 8310
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=8310&view=rev
Log:
Bit of refactoring.
Modified:
trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/PopulateMultiFactorAuthenticationContext.java
Modified: trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/PopulateMultiFactorAuthenticationContext.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/PopulateMultiFactorAuthenticationContext.java?rev=8310&r1=8309&r2=8310&view=diff
==============================================================================
--- trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/PopulateMultiFactorAuthenticationContext.java (original)
+++ trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/PopulateMultiFactorAuthenticationContext.java Tue Aug 2 14:49:43 2016
@@ -177,25 +177,10 @@
final Set<AuthenticationResultPrincipal> resultPrincipals =
mfaResult.getSubject().getPrincipals(AuthenticationResultPrincipal.class);
if (!resultPrincipals.isEmpty()) {
- final long now = System.currentTimeMillis();
final Collection<AuthenticationResult> results = new ArrayList<>(resultPrincipals.size());
for (final AuthenticationResultPrincipal resultPrincipal : resultPrincipals) {
- final AuthenticationFlowDescriptor descriptor = ac.getAvailableFlows().get(
- resultPrincipal.getAuthenticationResult().getAuthenticationFlowId());
- if (descriptor != null) {
- if (resultPrincipal.getAuthenticationResult().getAuthenticationInstant()
- + descriptor.getLifetime() > now) {
- results.add(resultPrincipal.getAuthenticationResult());
- } else {
- log.debug("{} Result from login flow {} has expired", getLogPrefix(),
- descriptor.getId());
- }
- } else {
- log.warn("{} Ignoring active result from unconfigured login flow {}",
- getLogPrefix(),
- resultPrincipal.getAuthenticationResult().getAuthenticationFlowId());
- }
+ processActiveResult(ac, results, resultPrincipal.getAuthenticationResult());
}
return results;
@@ -205,7 +190,34 @@
}
return null;
- }
+ }
+
+ /**
+ * Check an active result for possible inclusion in the returned collection.
+ *
+ * @param authenticationContext current authentication context
+ * @param results the collection to add to
+ * @param candidate the result to evaluate
+ */
+ void processActiveResult(@Nonnull final AuthenticationContext authenticationContext,
+ @Nonnull final Collection<AuthenticationResult> results,
+ @Nonnull final AuthenticationResult candidate) {
+
+ final AuthenticationFlowDescriptor descriptor = authenticationContext.getAvailableFlows().get(
+ candidate.getAuthenticationFlowId());
+ if (descriptor != null) {
+ if (candidate.getAuthenticationInstant() + descriptor.getLifetime() > System.currentTimeMillis()) {
+ results.add(candidate);
+ } else {
+ log.debug("{} Result from login flow {} has expired", getLogPrefix(),
+ descriptor.getId());
+ }
+ } else {
+ log.warn("{} Ignoring active result from undefined login flow {}", getLogPrefix(),
+ candidate.getAuthenticationFlowId());
+ }
+
+ }
}
}
More information about the commits
mailing list