[java-identity-provider] branch main updated: JSPROF-1 - Move RelyingParty "layer" into java-shib-profile
Scott Cantor
cantor.2 at osu.edu
Tue Feb 14 20:54:50 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=0bee4f201ac2c891a86eaad147c08445045a6bde
The following commit(s) were added to refs/heads/main by this push:
new 0bee4f201 JSPROF-1 - Move RelyingParty "layer" into java-shib-profile
0bee4f201 is described below
commit 0bee4f201ac2c891a86eaad147c08445045a6bde
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Feb 14 15:54:46 2023 -0500
JSPROF-1 - Move RelyingParty "layer" into java-shib-profile
https://shibboleth.atlassian.net/browse/JSPROF-1
Migrate out remaining generic lookup functions.
Replace some explicit class refs with parented beans.
---
.../net/shibboleth/idp/conf/functions.xml | 4 +-
.../net/shibboleth/idp/conf/soap-client.xml | 6 +-
.../idp/flows/admin/admin-abstract-beans.xml | 3 +-
.../net/shibboleth/idp/flows/admin/hello-beans.xml | 3 +-
.../shibboleth/idp/flows/admin/mdquery-beans.xml | 3 +-
.../idp/flows/admin/reload-metadata-beans.xml | 3 +-
.../idp/flows/admin/reload-service-beans.xml | 3 +-
.../idp/flows/admin/resolvertest-beans.xml | 3 +-
...pClientSecurityConfigurationLookupFunction.java | 99 ------
...ignatureSigningConfigurationLookupFunction.java | 101 ------
...atureValidationConfigurationLookupFunction.java | 101 ------
.../config/navigate/messaging/package-info.java | 22 --
.../navigate/ScriptedContextLookupFunction.java | 391 ---------------------
.../ServletRequestProfileRequestContextLookup.java | 39 --
.../SpringExpressionContextLookupFunction.java | 74 ----
.../AbstractRelyingPartyLookupFunction.java | 108 ------
.../context/navigate/messaging/package-info.java | 22 --
.../context/navigate/ScriptedFunctionTest.java | 85 -----
.../SpringExpressionContextLookupFunctionTest.java | 67 ----
.../SAMLMetadataContextLookupFunction.java | 2 +-
20 files changed, 12 insertions(+), 1127 deletions(-)
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/functions.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/functions.xml
index 2b785e90d..152bef735 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/functions.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/functions.xml
@@ -55,9 +55,9 @@
</bean>
<bean id="shibboleth.ContextFunctions.Scripted"
- class="net.shibboleth.idp.profile.context.navigate.ScriptedContextLookupFunction" abstract="true" />
+ class="net.shibboleth.profile.context.navigate.ScriptedContextLookupFunction" abstract="true" />
<bean id="shibboleth.ContextFunctions.Expression"
- class="net.shibboleth.idp.profile.context.navigate.SpringExpressionContextLookupFunction" abstract="true"
+ class="net.shibboleth.profile.context.navigate.SpringExpressionContextLookupFunction" abstract="true"
c:_0="#{ T(org.opensaml.profile.context.ProfileRequestContext) }" />
<bean id="shibboleth.MessageContextLookup.Inbound"
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/soap-client.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/soap-client.xml
index 02ec80050..8cf32aac0 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/soap-client.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/soap-client.xml
@@ -18,13 +18,13 @@
<!-- Security Configuration lookup -->
<bean id="shibboleth.MessageContext.SignatureValidationConfigurationLookup"
- class="net.shibboleth.idp.profile.config.navigate.messaging.SignatureValidationConfigurationLookupFunction"
+ class="net.shibboleth.profile.config.navigate.messaging.SignatureValidationConfigurationLookupFunction"
p:relyingPartyConfigurationResolver-ref="shibboleth.RelyingPartyResolverService" />
<bean id="shibboleth.MessageContext.SignatureSigningConfigurationLookup"
- class="net.shibboleth.idp.profile.config.navigate.messaging.SignatureSigningConfigurationLookupFunction"
+ class="net.shibboleth.profile.config.navigate.messaging.SignatureSigningConfigurationLookupFunction"
p:relyingPartyConfigurationResolver-ref="shibboleth.RelyingPartyResolverService" />
<bean id="shibboleth.MessageContext.HttpClientSecurityConfigurationLookup"
- class="net.shibboleth.idp.profile.config.navigate.messaging.HttpClientSecurityConfigurationLookupFunction"
+ class="net.shibboleth.profile.config.navigate.messaging.HttpClientSecurityConfigurationLookupFunction"
p:relyingPartyConfigurationResolver-ref="shibboleth.RelyingPartyResolverService" />
<!-- SOAP client and pipeline factory definitions. -->
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/admin-abstract-beans.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/admin-abstract-beans.xml
index 998c07f32..822236337 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/admin-abstract-beans.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/admin-abstract-beans.xml
@@ -81,8 +81,7 @@
p:operationLookupStrategy="#{getObject('shibboleth.AdminOperationLookupStrategy') ?: getObject('DefaultOperationLookupStrategy')}"
p:resourceLookupStrategy="#{getObject('shibboleth.AdminResourceLookupStrategy') ?: getObject('DefaultResourceLookupStrategy')}" />
- <bean id="DescriptorPolicyLookupStrategy"
- class="net.shibboleth.idp.profile.context.navigate.SpringExpressionContextLookupFunction"
+ <bean id="DescriptorPolicyLookupStrategy" parent="shibboleth.ContextFunctions.Expression"
c:inClass="#{T(org.opensaml.profile.context.ProfileRequestContext)}"
c:outputType="#{T(java.lang.String)}"
c:expression="#input.getSubcontext(T(net.shibboleth.profile.context.RelyingPartyContext)).getProfileConfig().getPolicyName(#input)" />
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/hello-beans.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/hello-beans.xml
index bddabeccd..d7477f543 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/hello-beans.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/hello-beans.xml
@@ -22,8 +22,7 @@
<bean id="shibboleth.AdminOperationLookupStrategy" parent="shibboleth.Functions.Constant" c:target="hello" />
- <bean id="shibboleth.AdminResourceLookupStrategy"
- class="net.shibboleth.idp.profile.context.navigate.SpringExpressionContextLookupFunction"
+ <bean id="shibboleth.AdminResourceLookupStrategy" parent="shibboleth.ContextFunctions.Expression"
c:inClass="#{T(org.opensaml.profile.context.ProfileRequestContext)}"
c:outputType="#{T(java.lang.String)}"
c:expression="'subject/' + #custom.apply(#input)">
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/mdquery-beans.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/mdquery-beans.xml
index aedfe0226..3dd0bf805 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/mdquery-beans.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/mdquery-beans.xml
@@ -23,8 +23,7 @@
<bean id="shibboleth.AdminOperationLookupStrategy" parent="shibboleth.Functions.Constant" c:target="read" />
- <bean id="shibboleth.AdminResourceLookupStrategy"
- class="net.shibboleth.idp.profile.context.navigate.SpringExpressionContextLookupFunction"
+ <bean id="shibboleth.AdminResourceLookupStrategy" parent="shibboleth.ContextFunctions.Expression"
c:inClass="#{T(org.opensaml.profile.context.ProfileRequestContext)}"
c:outputType="#{T(java.lang.String)}"
c:expression="#input.getInboundMessageContext().getMessage().getEntityID()" />
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/reload-metadata-beans.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/reload-metadata-beans.xml
index 45ab595e8..c4928a445 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/reload-metadata-beans.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/reload-metadata-beans.xml
@@ -23,8 +23,7 @@
<bean id="shibboleth.AdminOperationLookupStrategy" parent="shibboleth.Functions.Constant" c:target="reload" />
- <bean id="shibboleth.AdminResourceLookupStrategy"
- class="net.shibboleth.idp.profile.context.navigate.SpringExpressionContextLookupFunction"
+ <bean id="shibboleth.AdminResourceLookupStrategy" parent="shibboleth.ContextFunctions.Expression"
c:inClass="#{T(org.opensaml.profile.context.ProfileRequestContext)}"
c:outputType="#{T(java.lang.String)}"
c:expression="#input.getSubcontext(T(net.shibboleth.idp.profile.context.SpringRequestContext)).getRequestContext().getFlowScope().get('resolverId')" />
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/reload-service-beans.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/reload-service-beans.xml
index eb503bb7b..350c67b8e 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/reload-service-beans.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/reload-service-beans.xml
@@ -23,8 +23,7 @@
<bean id="shibboleth.AdminOperationLookupStrategy" parent="shibboleth.Functions.Constant" c:target="reload" />
- <bean id="shibboleth.AdminResourceLookupStrategy"
- class="net.shibboleth.idp.profile.context.navigate.SpringExpressionContextLookupFunction"
+ <bean id="shibboleth.AdminResourceLookupStrategy" parent="shibboleth.ContextFunctions.Expression"
c:inClass="#{T(org.opensaml.profile.context.ProfileRequestContext)}"
c:outputType="#{T(java.lang.String)}"
c:expression="#input.getSubcontext(T(net.shibboleth.idp.profile.context.SpringRequestContext)).getRequestContext().getFlowScope().get('serviceId')" />
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/resolvertest-beans.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/resolvertest-beans.xml
index a04903011..3e371cada 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/resolvertest-beans.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/flows/admin/resolvertest-beans.xml
@@ -23,8 +23,7 @@
<bean id="shibboleth.AdminOperationLookupStrategy" parent="shibboleth.Functions.Constant" c:target="read" />
- <bean id="shibboleth.AdminResourceLookupStrategy"
- class="net.shibboleth.idp.profile.context.navigate.SpringExpressionContextLookupFunction"
+ <bean id="shibboleth.AdminResourceLookupStrategy" parent="shibboleth.ContextFunctions.Expression"
c:inClass="#{T(org.opensaml.profile.context.ProfileRequestContext)}"
c:outputType="#{T(java.lang.String)}"
c:expression="'subject/' + #input.getInboundMessageContext().getMessage().getPrincipal() + '/attributes'" />
diff --git a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/config/navigate/messaging/HttpClientSecurityConfigurationLookupFunction.java b/idp-profile-api/src/main/java/net/shibboleth/idp/profile/config/navigate/messaging/HttpClientSecurityConfigurationLookupFunction.java
deleted file mode 100644
index f85b569f8..000000000
--- a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/config/navigate/messaging/HttpClientSecurityConfigurationLookupFunction.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements. See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.idp.profile.config.navigate.messaging;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.annotation.Nullable;
-
-import org.opensaml.messaging.context.MessageContext;
-import org.opensaml.security.config.SecurityConfiguration;
-import org.opensaml.security.httpclient.HttpClientSecurityConfiguration;
-import org.opensaml.security.httpclient.HttpClientSecuritySupport;
-
-import net.shibboleth.profile.config.ProfileConfiguration;
-import net.shibboleth.profile.context.RelyingPartyContext;
-import net.shibboleth.profile.relyingparty.RelyingPartyConfigurationResolver;
-import net.shibboleth.shared.service.ReloadableService;
-import net.shibboleth.shared.service.ServiceException;
-import net.shibboleth.idp.profile.context.navigate.messaging.AbstractRelyingPartyLookupFunction;
-
-/**
- * A {@link MessageContext} function that returns a {@link HttpClientSecurityConfiguration} list
- * by way of various lookup strategies.
- *
- * <p>If a specific setting is unavailable, a null value is returned.</p>
- */
-public class HttpClientSecurityConfigurationLookupFunction
- extends AbstractRelyingPartyLookupFunction<List<HttpClientSecurityConfiguration>> {
-
- /** A resolver for default security configurations. */
- @Nullable private ReloadableService<RelyingPartyConfigurationResolver> rpResolver;
-
- /**
- * Set the resolver for default security configurations.
- *
- * @param resolver the resolver to use
- */
- public void setRelyingPartyConfigurationResolver(
- @Nullable final ReloadableService<RelyingPartyConfigurationResolver> resolver) {
- rpResolver = resolver;
- }
-
-// Checkstyle: CyclomaticComplexity OFF
- /** {@inheritDoc} */
- @Nullable public List<HttpClientSecurityConfiguration> apply(@Nullable final MessageContext input) {
-
- final List<HttpClientSecurityConfiguration> configs = new ArrayList<>();
-
- final RelyingPartyContext rpc = getRelyingPartyContextLookupStrategy().apply(input);
- if (rpc != null) {
- final ProfileConfiguration pc = rpc.getProfileConfig();
- if (pc != null) {
- final SecurityConfiguration sc =
- pc.getSecurityConfiguration(getProfileRequestContextLookupStrategy().apply(input));
- if (sc != null && sc.getHttpClientSecurityConfiguration() != null) {
- configs.add(sc.getHttpClientSecurityConfiguration());
- }
- }
-
- // Check for a per-profile default (relying party independent) config.
- if (pc != null) {
- final String id = pc.getId();
- if (id != null && rpResolver != null) {
- try {
- final SecurityConfiguration defaultConfig =
- rpResolver.getServiceableComponent().getComponent().getDefaultSecurityConfiguration(id);
- if (defaultConfig != null && defaultConfig.getHttpClientSecurityConfiguration() != null) {
- configs.add(defaultConfig.getHttpClientSecurityConfiguration());
- }
- } catch (final ServiceException e) {
-
- }
- }
- }
- }
-
- configs.add(HttpClientSecuritySupport.getGlobalHttpClientSecurityConfiguration());
-
- return configs;
- }
-// Checkstyle: CyclomaticComplexity ON
-
-}
\ No newline at end of file
diff --git a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/config/navigate/messaging/SignatureSigningConfigurationLookupFunction.java b/idp-profile-api/src/main/java/net/shibboleth/idp/profile/config/navigate/messaging/SignatureSigningConfigurationLookupFunction.java
deleted file mode 100644
index b9508b48c..000000000
--- a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/config/navigate/messaging/SignatureSigningConfigurationLookupFunction.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements. See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.idp.profile.config.navigate.messaging;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.annotation.Nullable;
-
-import org.opensaml.messaging.context.MessageContext;
-import org.opensaml.security.config.SecurityConfiguration;
-import org.opensaml.xmlsec.SecurityConfigurationSupport;
-import org.opensaml.xmlsec.SignatureSigningConfiguration;
-import org.opensaml.xmlsec.config.XMLSecurityConfiguration;
-
-import net.shibboleth.profile.config.ProfileConfiguration;
-import net.shibboleth.profile.context.RelyingPartyContext;
-import net.shibboleth.profile.relyingparty.RelyingPartyConfigurationResolver;
-import net.shibboleth.shared.service.ReloadableService;
-import net.shibboleth.shared.service.ServiceException;
-import net.shibboleth.idp.profile.context.navigate.messaging.AbstractRelyingPartyLookupFunction;
-
-/**
- * A {@link MessageContext} function that returns a {@link SignatureSigningConfiguration} list
- * by way of various lookup strategies.
- *
- * <p>If a specific setting is unavailable, a null value is returned.</p>
- */
-public class SignatureSigningConfigurationLookupFunction
- extends AbstractRelyingPartyLookupFunction<List<SignatureSigningConfiguration>> {
-
- /** A resolver for default security configurations. */
- @Nullable private ReloadableService<RelyingPartyConfigurationResolver> rpResolver;
-
- /**
- * Set the resolver for default security configurations.
- *
- * @param resolver the resolver to use
- */
- public void setRelyingPartyConfigurationResolver(
- @Nullable final ReloadableService<RelyingPartyConfigurationResolver> resolver) {
- rpResolver = resolver;
- }
-
-// Checkstyle: CyclomaticComplexity OFF
- /** {@inheritDoc} */
- @Nullable public List<SignatureSigningConfiguration> apply(@Nullable final MessageContext input) {
-
- final List<SignatureSigningConfiguration> configs = new ArrayList<>();
-
- final RelyingPartyContext rpc = getRelyingPartyContextLookupStrategy().apply(input);
- if (rpc != null) {
- final ProfileConfiguration pc = rpc.getProfileConfig();
- if (pc != null) {
- final SecurityConfiguration sc =
- pc.getSecurityConfiguration(this.getProfileRequestContextLookupStrategy().apply(input));
- if (sc instanceof XMLSecurityConfiguration xsc && xsc.getSignatureSigningConfiguration() != null) {
- configs.add(xsc.getSignatureSigningConfiguration());
- }
- }
-
- // Check for a per-profile default (relying party independent) config.
- if (pc != null) {
- final String id = pc.getId();
- if (id != null && rpResolver != null) {
- try {
- final SecurityConfiguration defaultConfig =
- rpResolver.getServiceableComponent().getComponent().getDefaultSecurityConfiguration(id);
- if (defaultConfig instanceof XMLSecurityConfiguration xsc &&
- xsc.getSignatureSigningConfiguration() != null) {
- configs.add(xsc.getSignatureSigningConfiguration());
- }
- } catch (final ServiceException e) {
-
- }
- }
- }
- }
-
- configs.add(SecurityConfigurationSupport.getGlobalSignatureSigningConfiguration());
-
- return configs;
- }
-// Checkstyle: CyclomaticComplexity ON
-
-}
\ No newline at end of file
diff --git a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/config/navigate/messaging/SignatureValidationConfigurationLookupFunction.java b/idp-profile-api/src/main/java/net/shibboleth/idp/profile/config/navigate/messaging/SignatureValidationConfigurationLookupFunction.java
deleted file mode 100644
index bd2b486fc..000000000
--- a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/config/navigate/messaging/SignatureValidationConfigurationLookupFunction.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements. See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.idp.profile.config.navigate.messaging;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.annotation.Nullable;
-
-import org.opensaml.messaging.context.MessageContext;
-import org.opensaml.security.config.SecurityConfiguration;
-import org.opensaml.xmlsec.SecurityConfigurationSupport;
-import org.opensaml.xmlsec.SignatureValidationConfiguration;
-import org.opensaml.xmlsec.config.XMLSecurityConfiguration;
-
-import net.shibboleth.profile.config.ProfileConfiguration;
-import net.shibboleth.profile.context.RelyingPartyContext;
-import net.shibboleth.profile.relyingparty.RelyingPartyConfigurationResolver;
-import net.shibboleth.shared.service.ReloadableService;
-import net.shibboleth.shared.service.ServiceException;
-import net.shibboleth.idp.profile.context.navigate.messaging.AbstractRelyingPartyLookupFunction;
-
-/**
- * A {@link MessageContext} function that returns a {@link SignatureValidationConfiguration} list
- * by way of various lookup strategies.
- *
- * <p>If a specific setting is unavailable, a null value is returned.</p>
- */
-public class SignatureValidationConfigurationLookupFunction
- extends AbstractRelyingPartyLookupFunction<List<SignatureValidationConfiguration>> {
-
- /** A resolver for default security configurations. */
- @Nullable private ReloadableService<RelyingPartyConfigurationResolver> rpResolver;
-
- /**
- * Set the resolver for default security configurations.
- *
- * @param resolver the resolver to use
- */
- public void setRelyingPartyConfigurationResolver(
- @Nullable final ReloadableService<RelyingPartyConfigurationResolver> resolver) {
- rpResolver = resolver;
- }
-
-// Checkstyle: CyclomaticComplexity OFF
- /** {@inheritDoc} */
- @Nullable public List<SignatureValidationConfiguration> apply(@Nullable final MessageContext input) {
-
- final List<SignatureValidationConfiguration> configs = new ArrayList<>();
-
- final RelyingPartyContext rpc = getRelyingPartyContextLookupStrategy().apply(input);
- if (rpc != null) {
- final ProfileConfiguration pc = rpc.getProfileConfig();
- if (pc != null) {
- final SecurityConfiguration sc =
- pc.getSecurityConfiguration(this.getProfileRequestContextLookupStrategy().apply(input));
- if (sc instanceof XMLSecurityConfiguration xsc && xsc.getSignatureValidationConfiguration() != null) {
- configs.add(xsc.getSignatureValidationConfiguration());
- }
- }
-
- // Check for a per-profile default (relying party independent) config.
- if (pc != null) {
- final String id = pc.getId();
- if (id != null && rpResolver != null) {
- try {
- final SecurityConfiguration defaultConfig =
- rpResolver.getServiceableComponent().getComponent().getDefaultSecurityConfiguration(id);
- if (defaultConfig instanceof XMLSecurityConfiguration xsc &&
- xsc.getSignatureValidationConfiguration() != null) {
- configs.add(xsc.getSignatureValidationConfiguration());
- }
- } catch (final ServiceException e) {
-
- }
- }
- }
- }
-
- configs.add(SecurityConfigurationSupport.getGlobalSignatureValidationConfiguration());
-
- return configs;
- }
-// Checkstyle: CyclomaticComplexity ON
-
-}
\ No newline at end of file
diff --git a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/config/navigate/messaging/package-info.java b/idp-profile-api/src/main/java/net/shibboleth/idp/profile/config/navigate/messaging/package-info.java
deleted file mode 100644
index 239f117be..000000000
--- a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/config/navigate/messaging/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements. See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Configuration navigation for IdP-specific messaging configuration.
- */
-
-package net.shibboleth.idp.profile.config.navigate.messaging;
\ No newline at end of file
diff --git a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/ScriptedContextLookupFunction.java b/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/ScriptedContextLookupFunction.java
deleted file mode 100644
index 8de75eaca..000000000
--- a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/ScriptedContextLookupFunction.java
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements. See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.idp.profile.context.navigate;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import javax.script.ScriptContext;
-import javax.script.ScriptException;
-
-import net.shibboleth.shared.annotation.constraint.NotEmpty;
-import net.shibboleth.shared.logic.Constraint;
-import net.shibboleth.shared.scripting.AbstractScriptEvaluator;
-import net.shibboleth.shared.scripting.EvaluableScript;
-
-import org.opensaml.messaging.context.BaseContext;
-import org.opensaml.messaging.context.MessageContext;
-import org.opensaml.messaging.context.navigate.ContextDataLookupFunction;
-import org.opensaml.profile.context.ProfileRequestContext;
-import org.springframework.core.io.Resource;
-
-/**
- * A {@link java.util.function.Function} over a {@link BaseContext}
- * which calls out to a supplied script.
- *
- * @param <T> the specific type of context
- */
- at SuppressWarnings("removal")
-public class ScriptedContextLookupFunction<T extends BaseContext> extends AbstractScriptEvaluator
- implements ContextDataLookupFunction<T,Object> {
-
- /** What class we want the input to test against. */
- @Nonnull private final Class<T> inputClass;
-
- /**
- * Constructor.
- *
- * @param inClass the class we accept as input.
- * @param theScript the script we will evaluate.
- * @param extraInfo debugging information.
- */
- protected ScriptedContextLookupFunction(@Nonnull final Class<T> inClass, @Nonnull final EvaluableScript theScript,
- @Nullable final String extraInfo) {
- super(theScript);
- inputClass = Constraint.isNotNull(inClass, "Supplied inputClass cannot be null");
- setLogPrefix("Scripted Function from " + extraInfo + ":");
- }
-
- /**
- * Constructor.
- *
- * @param inClass the class we accept as input.
- * @param theScript the script we will evaluate.
- */
- protected ScriptedContextLookupFunction(@Nonnull final Class<T> inClass, @Nonnull final EvaluableScript theScript) {
- super(theScript);
- inputClass = Constraint.isNotNull(inClass, "Supplied inputClass cannot be null");
- setLogPrefix("Anonymous Scripted Function:");
- }
-
- /**
- * Constructor.
- *
- * @param inClass the class we accept as input.
- * @param theScript the script we will evaluate.
- * @param extraInfo debugging information.
- * @param outputType the type to test against.
- */
- protected ScriptedContextLookupFunction(@Nonnull final Class<T> inClass, @Nonnull final EvaluableScript theScript,
- @Nullable final String extraInfo, @Nullable final Class<?> outputType) {
- this(inClass, theScript, extraInfo);
- setOutputType(outputType);
- }
-
- /** {@inheritDoc} */
- @Override
- @Nullable public Object getCustomObject() {
- return super.getCustomObject();
- }
-
- /** {@inheritDoc} */
- public Object apply(@Nullable final T context) {
-
- if (null != context && !inputClass.isInstance(context)) {
- throw new ClassCastException(getLogPrefix() + " Input was type " + context.getClass()
- + " which is not an instance of " + inputClass);
- }
-
- return evaluate(context);
- }
-
- /** {@inheritDoc} */
- @Override
- protected void prepareContext(@Nonnull final ScriptContext scriptContext, @Nullable final Object... input) {
- // We don't actually know that the context is a PRC, but we'll keep this for compatibility.
- // We can't use the variable name "context" because Rhino appears to reserve that name.
- scriptContext.setAttribute("profileContext", input != null ? input[0] : null, ScriptContext.ENGINE_SCOPE);
- scriptContext.setAttribute("input", input != null ? input[0] : null, ScriptContext.ENGINE_SCOPE);
- }
-
- /**
- * Factory to create {@link ScriptedContextLookupFunction} for {@link ProfileRequestContext}s from a
- * {@link Resource}.
- *
- * @param resource the resource to look at
- * @param engineName the language
- * @return the function
- * @throws ScriptException if the compile fails
- * @throws IOException if the file doesn't exist.
- */
- @Nonnull
- public static ScriptedContextLookupFunction<ProfileRequestContext> resourceScript(
- @Nonnull @NotEmpty final String engineName, @Nonnull final Resource resource) throws ScriptException,
- IOException {
- return resourceScript(engineName, resource, null);
- }
-
- /**
- * Factory to create {@link ScriptedContextLookupFunction} for {@link ProfileRequestContext}s from a
- * {@link Resource}.
- *
- * @param resource the resource to look at
- * @param engineName the language
- * @param outputType the type to test against.
- * @return the function
- * @throws ScriptException if the compile fails
- * @throws IOException if the file doesn't exist.
- */
- @Nonnull
- public static ScriptedContextLookupFunction<ProfileRequestContext> resourceScript(
- @Nonnull @NotEmpty final String engineName, @Nonnull final Resource resource,
- @Nullable final Class<?> outputType) throws ScriptException, IOException {
- try (InputStream is = resource.getInputStream()) {
- final EvaluableScript script = new EvaluableScript();
- script.setEngineName(engineName);
- script.setScript(is);
- script.initializeWithScriptException();
- return new ScriptedContextLookupFunction<>(ProfileRequestContext.class, script, resource.getDescription(),
- outputType);
- }
- }
-
- /**
- * Factory to create {@link ScriptedContextLookupFunction} from a {@link Resource}.
- *
- * @param resource the resource to look at
- * @return the function
- * @throws ScriptException if the compile fails
- * @throws IOException if the file doesn't exist.
- */
- @Nonnull
- public static ScriptedContextLookupFunction<ProfileRequestContext> resourceScript(@Nonnull final Resource resource)
- throws ScriptException, IOException {
- return resourceScript(DEFAULT_ENGINE, resource, null);
- }
-
- /**
- * Factory to create {@link ScriptedContextLookupFunction} for {@link ProfileRequestContext}s from a
- * {@link Resource}.
- *
- * @param resource the resource to look at
- * @param outputType the type to test against.
- * @return the function
- * @throws ScriptException if the compile fails
- * @throws IOException if the file doesn't exist.
- */
- @Nonnull
- public static ScriptedContextLookupFunction<ProfileRequestContext> resourceScript(@Nonnull final Resource resource,
- @Nullable final Class<?> outputType) throws ScriptException, IOException {
- return resourceScript(DEFAULT_ENGINE, resource, outputType);
- }
-
- /**
- * Factory to create {@link ScriptedContextLookupFunction} for {@link ProfileRequestContext}s from inline data.
- *
- * @param scriptSource the script, as a string
- * @param engineName the language
- * @return the function
- * @throws ScriptException if the compile fails
- */
- @Nonnull
- public static ScriptedContextLookupFunction<ProfileRequestContext> inlineScript(
- @Nonnull @NotEmpty final String engineName, @Nonnull @NotEmpty final String scriptSource)
- throws ScriptException {
- final EvaluableScript script = new EvaluableScript();
- script.setEngineName(engineName);
- script.setScript(scriptSource);
- script.initializeWithScriptException();
- return new ScriptedContextLookupFunction<>(ProfileRequestContext.class, script, "Inline");
- }
-
- /**
- * Factory to create {@link ScriptedContextLookupFunction} for {@link ProfileRequestContext}s from inline data.
- *
- * @param scriptSource the script, as a string
- * @param engineName the language
- * @param outputType the type to test against.
- * @return the function
- * @throws ScriptException if the compile fails
- */
- @Nonnull
- public static ScriptedContextLookupFunction<ProfileRequestContext> inlineScript(
- @Nonnull @NotEmpty final String engineName, @Nonnull @NotEmpty final String scriptSource,
- @Nullable final Class<?> outputType) throws ScriptException {
- final EvaluableScript script = new EvaluableScript();
- script.setEngineName(engineName);
- script.setScript(scriptSource);
- script.initializeWithScriptException();
- return new ScriptedContextLookupFunction<>(ProfileRequestContext.class, script, "Inline", outputType);
- }
-
- /**
- * Factory to create {@link ScriptedContextLookupFunction} for {@link ProfileRequestContext}s from inline data.
- *
- * @param scriptSource the script, as a string
- * @return the function
- * @throws ScriptException if the compile fails
- */
- @Nonnull
- public static ScriptedContextLookupFunction<ProfileRequestContext> inlineScript(
- @Nonnull @NotEmpty final String scriptSource) throws ScriptException {
- return inlineScript(DEFAULT_ENGINE, scriptSource);
- }
-
- /**
- * Factory to create {@link ScriptedContextLookupFunction} for {@link ProfileRequestContext}s from inline data.
- *
- * @param scriptSource the script, as a string
- * @param outputType the type to test against.
- * @return the function
- * @throws ScriptException if the compile fails
- */
- @Nonnull
- public static ScriptedContextLookupFunction<ProfileRequestContext> inlineScript(
- @Nonnull @NotEmpty final String scriptSource, @Nullable final Class<?> outputType) throws ScriptException {
- return inlineScript(DEFAULT_ENGINE, scriptSource, outputType);
- }
-
- /**
- * Factory to create {@link ScriptedContextLookupFunction} for {@link MessageContext}s from a {@link Resource}.
- *
- * @param resource the resource to look at
- * @param engineName the language
- * @return the function
- * @throws ScriptException if the compile fails
- * @throws IOException if the file doesn't exist.
- */
- @Nonnull
- public static ScriptedContextLookupFunction<MessageContext> resourceMessageContextScript(
- @Nonnull @NotEmpty final String engineName, @Nonnull final Resource resource) throws ScriptException,
- IOException {
- return resourceMessageContextScript(engineName, resource, null);
- }
-
- /**
- * Factory to create {@link ScriptedContextLookupFunction} for {@link MessageContext}s from a {@link Resource}.
- *
- * @param resource the resource to look at
- * @param engineName the language
- * @param outputType the type to test against.
- * @return the function
- * @throws ScriptException if the compile fails
- * @throws IOException if the file doesn't exist.
- */
- @Nonnull
- public static ScriptedContextLookupFunction<MessageContext> resourceMessageContextScript(
- @Nonnull @NotEmpty final String engineName, @Nonnull final Resource resource,
- @Nullable final Class<?> outputType) throws ScriptException, IOException {
- try (InputStream is = resource.getInputStream()) {
- final EvaluableScript script = new EvaluableScript();
- script.setEngineName(engineName);
- script.setScript(is);
- script.initializeWithScriptException();
- return new ScriptedContextLookupFunction<>(MessageContext.class, script, resource.getDescription(),
- outputType);
- }
- }
-
- /**
- * Factory to create {@link ScriptedContextLookupFunction} for {@link MessageContext}s from a {@link Resource}.
- *
- * @param resource the resource to look at
- * @return the function
- * @throws ScriptException if the compile fails
- * @throws IOException if the file doesn't exist.
- */
- @Nonnull
- public static ScriptedContextLookupFunction<MessageContext> resourceMessageContextScript(
- @Nonnull final Resource resource) throws ScriptException, IOException {
- return resourceMessageContextScript(DEFAULT_ENGINE, resource, null);
- }
-
- /**
- * Factory to create {@link ScriptedContextLookupFunction} for {@link MessageContext}s from a {@link Resource}.
- *
- * @param resource the resource to look at
- * @param outputType the type to test against.
- * @return the function
- * @throws ScriptException if the compile fails
- * @throws IOException if the file doesn't exist.
- */
- @Nonnull
- public static ScriptedContextLookupFunction<MessageContext> resourceMessageContextScript(
- @Nonnull final Resource resource, @Nullable final Class<?> outputType) throws ScriptException, IOException {
- return resourceMessageContextScript(DEFAULT_ENGINE, resource, outputType);
- }
-
- /**
- * Factory to create {@link ScriptedContextLookupFunction} for {@link MessageContext}s from inline data.
- *
- * @param scriptSource the script, as a string
- * @param engineName the language
- * @return the function
- * @throws ScriptException if the compile fails
- */
- @Nonnull
- public static ScriptedContextLookupFunction<MessageContext> inlineMessageContextScript(
- @Nonnull @NotEmpty final String engineName, @Nonnull @NotEmpty final String scriptSource)
- throws ScriptException {
- final EvaluableScript script = new EvaluableScript();
- script.setEngineName(engineName);
- script.setScript(scriptSource);
- script.initializeWithScriptException();
- return new ScriptedContextLookupFunction<>(MessageContext.class, script, "Inline");
- }
-
- /**
- * Factory to create {@link ScriptedContextLookupFunction} for {@link MessageContext}s from inline data.
- *
- * @param scriptSource the script, as a string
- * @param engineName the language
- * @param outputType the type to test against.
- * @return the function
- * @throws ScriptException if the compile fails
- */
- @Nonnull
- public static ScriptedContextLookupFunction<MessageContext> inlineMessageContextScript(
- @Nonnull @NotEmpty final String engineName, @Nonnull @NotEmpty final String scriptSource,
- @Nullable final Class<?> outputType) throws ScriptException {
- final EvaluableScript script = new EvaluableScript();
- script.setEngineName(engineName);
- script.setScript(scriptSource);
- script.initializeWithScriptException();
- return new ScriptedContextLookupFunction<>(MessageContext.class, script, "Inline", outputType);
- }
-
- /**
- * Factory to create {@link ScriptedContextLookupFunction} for {@link MessageContext}s from inline data.
- *
- * @param scriptSource the script, aMessageContexts a string
- * @return the function
- * @throws ScriptException if the compile fails
- */
- @Nonnull
- public static ScriptedContextLookupFunction<MessageContext> inlineMessageContextScript(
- @Nonnull @NotEmpty final String scriptSource) throws ScriptException {
- return inlineMessageContextScript(DEFAULT_ENGINE, scriptSource);
- }
-
- /**
- * Factory to create {@link ScriptedContextLookupFunction} for {@link MessageContext}s from inline data.
- *
- * @param scriptSource the script, as a string
- * @param outputType the type to test against.
- * @return the function
- * @throws ScriptException if the compile fails
- */
- @Nonnull
- public static ScriptedContextLookupFunction<MessageContext> inlineMessageContextScript(
- @Nonnull @NotEmpty final String scriptSource, @Nullable final Class<?> outputType) throws ScriptException {
- return inlineMessageContextScript(DEFAULT_ENGINE, scriptSource, outputType);
- }
-
-}
\ No newline at end of file
diff --git a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/ServletRequestProfileRequestContextLookup.java b/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/ServletRequestProfileRequestContextLookup.java
deleted file mode 100644
index e3d5e195c..000000000
--- a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/ServletRequestProfileRequestContextLookup.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements. See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.idp.profile.context.navigate;
-
-import org.opensaml.profile.context.ProfileRequestContext;
-
-import java.util.function.Function;
-
-import javax.annotation.Nullable;
-import jakarta.servlet.ServletRequest;
-
-/**
- * Looks up the profile request context from a servlet request attribute.
- *
- * @author Marvin S. Addison
- */
-public class ServletRequestProfileRequestContextLookup implements Function<ServletRequest,ProfileRequestContext> {
-
- /** {@inheritDoc} */
- @Nullable
- public ProfileRequestContext apply(final ServletRequest input) {
- return (ProfileRequestContext) input.getAttribute(ProfileRequestContext.BINDING_KEY);
- }
-}
diff --git a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/SpringExpressionContextLookupFunction.java b/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/SpringExpressionContextLookupFunction.java
deleted file mode 100644
index e40ab19ba..000000000
--- a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/SpringExpressionContextLookupFunction.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements. See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.idp.profile.context.navigate;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.opensaml.messaging.context.BaseContext;
-import org.opensaml.messaging.context.navigate.ContextDataLookupFunction;
-
-import net.shibboleth.shared.annotation.ParameterName;
-import net.shibboleth.shared.annotation.constraint.NotEmpty;
-import net.shibboleth.shared.logic.Constraint;
-import net.shibboleth.shared.primitive.LoggerFactory;
-import net.shibboleth.shared.spring.expression.SpringExpressionFunction;
-
-/**
- * A {@link java.util.function.Function} over a {@link BaseContext}
- * which calls out to a Spring Expression.
- *
- * @param <T> the specific type of context
- * @param <U> output type
- * @since 3.3.0
- */
-public class SpringExpressionContextLookupFunction<T extends BaseContext,U> extends SpringExpressionFunction<T,U>
- implements ContextDataLookupFunction<T,U> {
-
- /**
- * Constructor.
- *
- * @param inClass the class we accept as input.
- * @param expression the expression to evaluate.
- */
- public SpringExpressionContextLookupFunction(@Nonnull @ParameterName(name="inClass") final Class<T> inClass,
- @Nonnull @NotEmpty @ParameterName(name="expression") final String expression) {
- super(expression);
- setInputType(Constraint.isNotNull(inClass, "Supplied inputClass cannot be null"));
-
- if(!BaseContext.class.isAssignableFrom(inClass)) {
- LoggerFactory.getLogger(SpringExpressionContextLookupFunction.class).
- warn("inClass {} is not derived from {}", inClass, BaseContext.class);
- }
- }
-
- /**
- * Constructor.
- *
- * @param inClass the class we accept as input.
- * @param expression the expression to evaluate.
- * @param outputType the type to test against.
- */
- public SpringExpressionContextLookupFunction(@Nonnull @ParameterName(name="inClass") final Class<T> inClass,
- @Nonnull @NotEmpty @ParameterName(name="expression") final String expression,
- @ParameterName(name="outputType") @Nullable final Class<U> outputType) {
- this(inClass, expression);
- setOutputType(outputType);
- }
-
-}
\ No newline at end of file
diff --git a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/messaging/AbstractRelyingPartyLookupFunction.java b/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/messaging/AbstractRelyingPartyLookupFunction.java
deleted file mode 100644
index cb925e577..000000000
--- a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/messaging/AbstractRelyingPartyLookupFunction.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements. See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.idp.profile.context.navigate.messaging;
-
-import java.util.function.Function;
-
-import javax.annotation.Nonnull;
-
-import org.opensaml.messaging.context.InOutOperationContext;
-import org.opensaml.messaging.context.MessageContext;
-import org.opensaml.messaging.context.navigate.ChildContextLookup;
-import org.opensaml.messaging.context.navigate.ContextDataLookupFunction;
-import org.opensaml.messaging.context.navigate.RecursiveTypedParentContextLookup;
-import org.opensaml.profile.context.ProfileRequestContext;
-
-import net.shibboleth.profile.context.RelyingPartyContext;
-import net.shibboleth.shared.logic.Constraint;
-
-/**
- * Abstract base class for a function that requires a {@link ProfileRequestContext} obtained
- * via a lookup function, by default the parent of the specified {@link MessageContext}, and
- * a {@link RelyingPartyContext} obtained via a lookup function, by default a child of the
- * aforementioned parent.
- *
- * @param <ResultType> return type of function
- */
-public abstract class AbstractRelyingPartyLookupFunction<ResultType>
- implements ContextDataLookupFunction<MessageContext,ResultType> {
-
- /**
- * Strategy used to locate the {@link RelyingPartyContext} associated with a given {@link MessageContext}.
- */
- @Nonnull private Function<MessageContext,RelyingPartyContext> relyingPartyContextLookupStrategy;
-
- /**
- * Strategy used to locate the {@link ProfileRequestContext} associated with a given {@link MessageContext}.
- */
- @Nonnull private Function<MessageContext,ProfileRequestContext> profileRequestContextLookupStrategy;
-
- /** Constructor. */
- public AbstractRelyingPartyLookupFunction() {
- profileRequestContextLookupStrategy =
- new RecursiveTypedParentContextLookup<>(ProfileRequestContext.class);
-
- relyingPartyContextLookupStrategy =
- new ChildContextLookup<>(RelyingPartyContext.class).compose(
- new RecursiveTypedParentContextLookup<>(InOutOperationContext.class));
- }
-
- /**
- * Get the strategy used to locate the {@link RelyingPartyContext} associated with a given
- * {@link MessageContext}.
- *
- * @return lookup strategy
- */
- @Nonnull public Function<MessageContext,RelyingPartyContext> getRelyingPartyContextLookupStrategy() {
- return relyingPartyContextLookupStrategy;
- }
-
- /**
- * Set the strategy used to locate the {@link RelyingPartyContext} associated with a given
- * {@link MessageContext}.
- *
- * @param strategy lookup strategy
- */
- public void setRelyingPartyContextLookupStrategy(
- @Nonnull final Function<MessageContext,RelyingPartyContext> strategy) {
- relyingPartyContextLookupStrategy =
- Constraint.isNotNull(strategy, "RelyingPartyContext lookup strategy cannot be null");
- }
-
- /**
- * Get the strategy used to locate the {@link ProfileRequestContext} associated with a given
- * {@link MessageContext}.
- *
- * @return lookup strategy
- */
- @Nonnull public Function<MessageContext,ProfileRequestContext> getProfileRequestContextLookupStrategy() {
- return profileRequestContextLookupStrategy;
- }
-
- /**
- * Set the strategy used to locate the {@link ProfileRequestContext} associated with a given
- * {@link MessageContext}.
- *
- * @param strategy lookup strategy
- */
- public void setProfileRequestContextLookupStrategy(
- @Nonnull final Function<MessageContext,ProfileRequestContext> strategy) {
- profileRequestContextLookupStrategy =
- Constraint.isNotNull(strategy, "ProfileRequestContext lookup strategy cannot be null");
- }
-}
\ No newline at end of file
diff --git a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/messaging/package-info.java b/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/messaging/package-info.java
deleted file mode 100644
index 8b9b97f27..000000000
--- a/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/navigate/messaging/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements. See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Context navigation for IdP-specific messaging contexts.
- */
-
-package net.shibboleth.idp.profile.context.navigate.messaging;
\ No newline at end of file
diff --git a/idp-profile-api/src/test/java/net/shibboleth/idp/profile/context/navigate/ScriptedFunctionTest.java b/idp-profile-api/src/test/java/net/shibboleth/idp/profile/context/navigate/ScriptedFunctionTest.java
deleted file mode 100644
index 9fd623e2d..000000000
--- a/idp-profile-api/src/test/java/net/shibboleth/idp/profile/context/navigate/ScriptedFunctionTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements. See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.idp.profile.context.navigate;
-
-import java.lang.reflect.InvocationTargetException;
-
-import javax.script.ScriptException;
-
-import org.opensaml.messaging.context.MessageContext;
-import org.opensaml.profile.context.ProfileRequestContext;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-/**
- *
- */
- at SuppressWarnings("javadoc")
-public class ScriptedFunctionTest {
-
- static final String STRING_RETURN = "JavaString=Java.type(\"java.lang.String\"); new JavaString(\"String\");";
- static final String INTEGER_RETURN = "JavaInteger=Java.type(\"java.lang.Integer\"); new JavaInteger(37);";
-
- @Test public void simpleScript() throws ScriptException {
- final ProfileRequestContext prc = new ProfileRequestContext();
-
- final Object string = ScriptedContextLookupFunction.inlineScript(STRING_RETURN).apply(prc);
-
- String s = (String) string;
- Assert.assertEquals(s, "String");
-
- final Integer integer = (Integer) ScriptedContextLookupFunction.inlineScript(INTEGER_RETURN).apply(prc);
- Assert.assertEquals(integer.intValue(), 37);
- }
-
- @Test public void custom() throws ScriptException {
- final ProfileRequestContext prc = new ProfileRequestContext();
-
- final ScriptedContextLookupFunction<ProfileRequestContext> script = ScriptedContextLookupFunction.inlineScript("custom;");
- script.setCustomObject("String");
- Assert.assertEquals(script.apply(prc), "String");
-
- script.setCustomObject(Integer.valueOf(37));
- Assert.assertEquals(script.apply(prc), Integer.valueOf(37));
- }
-
-
- @Test public void withType() throws ScriptException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
- final ProfileRequestContext prc = new ProfileRequestContext();
-
- final ScriptedContextLookupFunction<ProfileRequestContext> script1 = ScriptedContextLookupFunction.inlineScript(STRING_RETURN, Object.class);
-
- final String string = (String) script1.apply(prc);
- Assert.assertEquals(string, "String");
-
- Assert.assertEquals(ScriptedContextLookupFunction.inlineScript(STRING_RETURN, String.class).apply(prc), "String");
-
- Assert.assertNull(ScriptedContextLookupFunction.inlineScript(STRING_RETURN, Integer.class).apply(prc));
-
- final Integer integer = (Integer) ScriptedContextLookupFunction.inlineScript(INTEGER_RETURN).apply(prc);
- Assert.assertEquals(integer.intValue(), 37);
-
- }
-
- @Test public void messageContext() throws ScriptException {
- final ScriptedContextLookupFunction<MessageContext> script1 = ScriptedContextLookupFunction.inlineMessageContextScript(STRING_RETURN, Object.class);
-
- Assert.assertEquals(script1.apply(new MessageContext()), "String");
- Assert.assertEquals(script1.apply(null), "String");
- }
-}
diff --git a/idp-profile-api/src/test/java/net/shibboleth/idp/profile/context/navigate/SpringExpressionContextLookupFunctionTest.java b/idp-profile-api/src/test/java/net/shibboleth/idp/profile/context/navigate/SpringExpressionContextLookupFunctionTest.java
deleted file mode 100644
index f0abddf0e..000000000
--- a/idp-profile-api/src/test/java/net/shibboleth/idp/profile/context/navigate/SpringExpressionContextLookupFunctionTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements. See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.idp.profile.context.navigate;
-
-import org.opensaml.profile.context.ProfileRequestContext;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-/**
- * Test for {@link SpringExpressionContextLookupFunction}.
- */
- at SuppressWarnings("javadoc")
-public class SpringExpressionContextLookupFunctionTest {
-
-
- @Test public void simpleTest() {
- SpringExpressionContextLookupFunction<ProfileRequestContext,Integer> func =
- new SpringExpressionContextLookupFunction<>(ProfileRequestContext.class, "99", Integer.class);
- Assert.assertEquals(func.apply(null), Integer.valueOf(99));
- }
-
- @Test public void customTest() {
- SpringExpressionContextLookupFunction<ProfileRequestContext,Integer> func =
- new SpringExpressionContextLookupFunction<>(ProfileRequestContext.class, "#custom + 1", Integer.class);
- func.setCustomObject(Integer.valueOf(99));
- Assert.assertEquals(func.apply(null), Integer.valueOf(100));
- }
-
- @Test public void invalidOutputTest() {
- SpringExpressionContextLookupFunction<ProfileRequestContext,Integer> func =
- new SpringExpressionContextLookupFunction<>(ProfileRequestContext.class, "'foo'", Integer.class);
- func.setReturnOnError(-1);
- Assert.assertEquals(func.apply(null), Integer.valueOf(-1));
- }
-
- @Test public void exceptionTest() {
- SpringExpressionContextLookupFunction<ProfileRequestContext,Integer> func =
- new SpringExpressionContextLookupFunction<>(ProfileRequestContext.class, "1/0", Integer.class);
- func.setReturnOnError(-1);
-
- try {
- func.apply(null);
- Assert.fail("Expression should have raised exception");
- } catch (final Exception e) {
-
- }
-
- func.setHideExceptions(true);
- Assert.assertEquals(func.apply(null), Integer.valueOf(-1));
- }
-
-}
\ No newline at end of file
diff --git a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/context/navigate/messaging/SAMLMetadataContextLookupFunction.java b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/context/navigate/messaging/SAMLMetadataContextLookupFunction.java
index 9ac1964d0..812534716 100644
--- a/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/context/navigate/messaging/SAMLMetadataContextLookupFunction.java
+++ b/idp-saml-api/src/main/java/net/shibboleth/idp/saml/profile/context/navigate/messaging/SAMLMetadataContextLookupFunction.java
@@ -19,8 +19,8 @@ package net.shibboleth.idp.saml.profile.context.navigate.messaging;
import javax.annotation.Nullable;
-import net.shibboleth.idp.profile.context.navigate.messaging.AbstractRelyingPartyLookupFunction;
import net.shibboleth.profile.context.RelyingPartyContext;
+import net.shibboleth.profile.context.navigate.messaging.AbstractRelyingPartyLookupFunction;
import org.opensaml.messaging.context.BaseContext;
import org.opensaml.messaging.context.MessageContext;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list