[java-opensaml COMMIT] in /trunk/opensaml-saml-impl/src: main/java/org/opensaml/saml/saml2/profile/impl/AbstractEncry...
noreply at shibboleth.net
noreply at shibboleth.net
Fri Oct 23 16:55:07 EDT 2015
Author: putmanb
Date: Fri Oct 23 16:55:06 2015
New Revision: 4357
URL: http://svn.shibboleth.net/view/java-opensaml?rev=4357&view=rev
Log:
IDP-671: Create Action(s) and supporting code to issue SAML 2 Assertions decorated for delegation
Add support to AbstractEncryptAction to allow self-encryption.
Add basic inline strategy function for resolving self-encryption parameters.
Added:
trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/security/impl/InlineSelfEncryptionParametersStrategy.java (with props)
trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/profile/impl/TestSelfEncryption.java (with props)
trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/security/impl/InlineSelfEncryptionParametersStrategyTest.java (with props)
Modified:
trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/AbstractEncryptAction.java
trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/profile/impl/EncryptNameIDsTest.java
Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/AbstractEncryptAction.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/AbstractEncryptAction.java?rev=4357&r1=4356&r2=4357&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/AbstractEncryptAction.java (original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/AbstractEncryptAction.java Fri Oct 23 16:55:06 2015
@@ -17,15 +17,21 @@
package org.opensaml.saml.saml2.profile.impl;
+import java.util.ArrayList;
+import java.util.List;
+
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import net.shibboleth.utilities.java.support.collection.Pair;
import net.shibboleth.utilities.java.support.component.ComponentSupport;
import net.shibboleth.utilities.java.support.logic.Constraint;
import net.shibboleth.utilities.java.support.logic.FunctionSupport;
import org.opensaml.messaging.context.navigate.ChildContextLookup;
import org.opensaml.profile.action.AbstractConditionalProfileAction;
+import org.opensaml.profile.action.ActionSupport;
+import org.opensaml.profile.action.EventIds;
import org.opensaml.profile.context.ProfileRequestContext;
import org.opensaml.profile.context.navigate.OutboundMessageContextLookup;
import org.opensaml.saml.saml2.encryption.Encrypter;
@@ -39,6 +45,8 @@
import com.google.common.base.Function;
import com.google.common.base.Functions;
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
/**
* Abstract base class for actions that perform simple unicast SAML encryption to a single
@@ -63,6 +71,16 @@
/** Strategy used to determine encrypted key placement. */
@Nonnull private Function<ProfileRequestContext,Encrypter.KeyPlacement> keyPlacementLookupStrategy;
+ /** Predicate used to determine whether to perform encrypt-to-self. */
+ @Nonnull private Predicate<ProfileRequestContext> encryptToSelf;
+
+ /** Strategy used to resolve the encrypt-to-self parameters. */
+ @Nullable private Function<Pair<ProfileRequestContext, EncryptionParameters>,
+ List<EncryptionParameters>> encryptToSelfParametersStrategy;
+
+ /** Strategy used to obtain the self recipient value. */
+ @Nullable private Function<ProfileRequestContext, String> selfRecipientLookupStrategy;
+
/** The encryption object. */
@Nullable private Encrypter encrypter;
@@ -71,6 +89,7 @@
encryptionCtxLookupStrategy = Functions.compose(new ChildContextLookup<>(EncryptionContext.class),
new OutboundMessageContextLookup());
keyPlacementLookupStrategy = FunctionSupport.<ProfileRequestContext,KeyPlacement>constant(KeyPlacement.INLINE);
+ encryptToSelf = Predicates.alwaysFalse();
}
/**
@@ -107,6 +126,38 @@
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
keyPlacementLookupStrategy = Constraint.isNotNull(strategy, "Key placement lookup strategy cannot be null");
+ }
+
+ /**
+ * Set the predicate used to determine whether to perform encrypt-to-self.
+ *
+ * @param predicate the encrypt-to-self predicate
+ */
+ public void setEncryptToSelf(@Nonnull final Predicate<ProfileRequestContext> predicate) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ encryptToSelf = Constraint.isNotNull(predicate, "Encrypt-to-self predicate cannot be null");
+ }
+
+ /**
+ * Set the strategy used to resolve the encrypt-to-self parameters.
+ *
+ * @param strategy the encrypt-to-self predicate
+ */
+ public void setEncryptToSelfParametersStrategy(
+ @Nullable Function<Pair<ProfileRequestContext, EncryptionParameters>,
+ List<EncryptionParameters>> strategy) {
[... 87 lines stripped ...]
More information about the commits
mailing list