[java-identity-provider] branch main updated: Wire in new requestDecorator property.
Scott Cantor
cantor.2 at osu.edu
Wed Feb 22 15:56:30 UTC 2023
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=3de72c7c81672ded831a4ef6fd42ec2a655ef955
The following commit(s) were added to refs/heads/main by this push:
new 3de72c7c8 Wire in new requestDecorator property.
3de72c7c8 is described below
commit 3de72c7c81672ded831a4ef6fd42ec2a655ef955
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Feb 22 10:56:26 2023 -0500
Wire in new requestDecorator property.
---
.../shibboleth/idp/conf/relying-party-mddriven.xml | 4 +++
.../impl/AbstractSAML2ProfileConfiguration.java | 40 ++++++++++++++++++----
2 files changed, 37 insertions(+), 7 deletions(-)
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/relying-party-mddriven.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/relying-party-mddriven.xml
index 8192ddef1..9635dbfba 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/relying-party-mddriven.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/relying-party-mddriven.xml
@@ -206,6 +206,10 @@
<constructor-arg value="false" />
</bean>
</property>
+ <property name="requestDecorator">
+ <bean parent="shibboleth.MDDrivenBeanProperty" p:propertyName="requestDecorator"
+ p:propertyType="#{T(java.util.function.BiConsumer)}" />
+ </property>
</bean>
<bean id="AbstractMDDrivenSAML2AssertionProducingProfile" parent="AbstractMDDrivenSAML2Profile" abstract="true">
diff --git a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/impl/AbstractSAML2ProfileConfiguration.java b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/impl/AbstractSAML2ProfileConfiguration.java
index ce5c40cf7..61ab4b3f6 100644
--- a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/impl/AbstractSAML2ProfileConfiguration.java
+++ b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/config/impl/AbstractSAML2ProfileConfiguration.java
@@ -18,6 +18,7 @@
package net.shibboleth.idp.saml.saml2.profile.config.impl;
import java.util.function.BiConsumer;
+import java.util.function.Function;
import java.util.function.Predicate;
import javax.annotation.Nonnull;
@@ -27,6 +28,7 @@ import net.shibboleth.idp.saml.profile.config.impl.AbstractSAMLProfileConfigurat
import net.shibboleth.saml.saml2.profile.config.SAML2ProfileConfiguration;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.logic.FunctionSupport;
import net.shibboleth.shared.logic.PredicateSupport;
import org.opensaml.profile.context.ProfileRequestContext;
@@ -44,6 +46,10 @@ public abstract class AbstractSAML2ProfileConfiguration extends AbstractSAMLProf
/** Predicate used to determine if name identifiers should be encrypted. */
@Nonnull private Predicate<ProfileRequestContext> encryptNameIDsPredicate;
+
+ /** Lookup strategy for request decorator. */
+ @Nonnull Function<ProfileRequestContext,BiConsumer<ProfileRequestContext,? extends RequestAbstractType>>
+ requestDecoratorLookupStrategy;
/**
* Constructor.
@@ -56,6 +62,8 @@ public abstract class AbstractSAML2ProfileConfiguration extends AbstractSAMLProf
ignoreRequestSignaturesPredicate = PredicateSupport.alwaysFalse();
encryptionOptionalPredicate = PredicateSupport.alwaysFalse();
encryptNameIDsPredicate = PredicateSupport.alwaysFalse();
+
+ requestDecoratorLookupStrategy = FunctionSupport.constant(null);
}
/** {@inheritDoc} */
@@ -135,17 +143,35 @@ public abstract class AbstractSAML2ProfileConfiguration extends AbstractSAMLProf
encryptNameIDsPredicate = Constraint.isNotNull(predicate, "Condition cannot be null");
}
+ /** {@inheritDoc} */
+ @Nullable public BiConsumer<ProfileRequestContext,? extends RequestAbstractType> getRequestDecorator(
+ @Nullable final ProfileRequestContext profileRequestContext) {
+ return requestDecoratorLookupStrategy.apply(profileRequestContext);
+ }
+
/**
- * Get a decorator for the SAML request.
+ * Set a decorator for the SAML request.
*
- * @param profileRequestContext current profile request context
+ * @param decorator request decorator
*
- * @return request decorator
+ * @since 5.0.0
*/
- @Nullable public BiConsumer<ProfileRequestContext,? extends RequestAbstractType> getRequestDecorator(
- @Nullable final ProfileRequestContext profileRequestContext) {
- // TODO: implement this feature....
- return null;
+ public void setRequestDecorator(
+ @Nullable BiConsumer<ProfileRequestContext,? extends RequestAbstractType> decorator) {
+ requestDecoratorLookupStrategy = FunctionSupport.constant(decorator);
+ }
+
+ /**
+ * Set a lookup strategy decorator for the SAML request.
+ *
+ * @param strategy lookup strategy
+ *
+ * @since 5.0.0
+ */
+ public void setRequestDecoratorLookupStrategy(
+ @Nonnull Function<ProfileRequestContext,BiConsumer<ProfileRequestContext,? extends RequestAbstractType>>
+ strategy) {
+ requestDecoratorLookupStrategy = Constraint.isNotNull(strategy, "Lookup strategy cannot be null");
}
}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list