[java-identity-provider COMMIT] /trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction....
noreply at shibboleth.net
noreply at shibboleth.net
Mon Oct 21 16:03:15 EDT 2013
Author: scantor
Date: Mon Oct 21 16:03:15 2013
New Revision: 4893
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4893&view=rev
Log: (empty)
Modified:
trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction.java
Modified: trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction.java?rev=4893&r1=4892&r2=4893&view=diff
==============================================================================
--- trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction.java (original)
+++ trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractValidationAction.java Mon Oct 21 16:03:15 2013
@@ -23,6 +23,7 @@
import java.util.Set;
import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import javax.security.auth.Subject;
import net.shibboleth.idp.authn.context.AuthenticationContext;
@@ -80,6 +81,9 @@
/** Error messages indicating a disabled account. */
@Nonnull @NonnullElements private Collection<String> accountDisabledErrors;
+ /** Predicate to apply when setting AuthenticationResult cacheability. */
+ @Nullable private Predicate<ProfileRequestContext> resultCachingPredicate;
+
/** Constructor. */
public AbstractValidationAction() {
super();
@@ -107,6 +111,8 @@
* @param messages the "unknown username" error messages to set
*/
public void setUnknownUsernameErrors(@Nonnull @NonnullElements final Collection<String> messages) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
unknownUsernameErrors = Lists.newArrayList(Collections2.filter(messages, Predicates.notNull()));
}
@@ -125,6 +131,8 @@
* @param messages the "invalid password" error messages to set
*/
public void setInvalidPasswordErrors(@Nonnull @NonnullElements final Collection<String> messages) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
invalidPasswordErrors = Lists.newArrayList(Collections2.filter(messages, Predicates.notNull()));
}
@@ -143,6 +151,8 @@
* @param messages the "expired password" error messages to set
*/
public void setExpiredPasswordErrors(@Nonnull @NonnullElements final Collection<String> messages) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
expiredPasswordErrors = Lists.newArrayList(Collections2.filter(messages, Predicates.notNull()));
}
@@ -161,6 +171,8 @@
* @param messages the "account locked" error messages to set
*/
public void setAccountLockedErrors(@Nonnull @NonnullElements final Collection<String> messages) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
accountLockedErrors = Lists.newArrayList(Collections2.filter(messages, Predicates.notNull()));
}
@@ -179,7 +191,29 @@
* @param messages the "account disabled" error messages to set
*/
public void setAccountDisabledErrors(@Nonnull @NonnullElements final Collection<String> messages) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
accountDisabledErrors = Lists.newArrayList(Collections2.filter(messages, Predicates.notNull()));
+ }
+
+ /**
+ * Get predicate to apply to determine cacheability of {@link AuthenticationResult}.
+ *
+ * @return predicate to apply, or null
+ */
+ @Nullable public Predicate<ProfileRequestContext> getResultCachingPredicate() {
+ return resultCachingPredicate;
+ }
+
+ /**
+ * Set predicate to apply to determine cacheability of {@link AuthenticationResult}.
+ *
+ * @param predicate predicate to apply, or null
+ */
+ public void setResultCachingPredicate(@Nullable final Predicate<ProfileRequestContext> predicate) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
+ resultCachingPredicate = predicate;
}
/** {@inheritDoc} */
@@ -272,8 +306,24 @@
AuthenticationResult result = new AuthenticationResult(authenticationContext.getAttemptedFlow().getId(),
populateSubject(authenticatedSubject));
+ result.setCacheable(isResultCacheable(profileRequestContext, authenticationContext));
authenticationContext.setAuthenticationResult(result);
profileRequestContext.getSubcontext(SubjectCanonicalizationContext.class, true).setSubject(result.getSubject());
+ }
+
+ /**
+ * Override to determine whether the {@link AuthenticationResult} built by this action should be cacheable.
+ *
+ * <p>The default implementation applies a predicate if one is set.</p>
+ *
+ * @param profileRequestContext the current profile request context
[... 11 lines stripped ...]
More information about the commits
mailing list