[java-plugin-shibd] branch main updated: Added metadata and fixed bugs to get SAML 2 initiator flow working.
Scott Cantor
cantor.2 at osu.edu
Wed Jul 24 19:43:17 UTC 2024
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-plugin-shibd.
View the commit online:
http://git.shibboleth.net/view/?p=java-plugin-shibd.git;a=commit;h=adcf3753d96384f3424660d655dc01d3286dc9e8
The following commit(s) were added to refs/heads/main by this push:
new adcf375 Added metadata and fixed bugs to get SAML 2 initiator flow working.
adcf375 is described below
commit adcf3753d96384f3424660d655dc01d3286dc9e8
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Jul 24 15:43:14 2024 -0400
Added metadata and fixed bugs to get SAML 2 initiator flow working.
---
sp-conf-impl/pom.xml | 6 ++
.../META-INF/net.shibboleth.idp/postconfig.xml | 2 +-
.../idp/flows/sp/application/application-beans.xml | 8 ---
.../idp/flows/sp/initiator/saml2/saml2-beans.xml | 21 +++----
.../shibboleth/sp/flows/AbstractSPFlowTest.java | 7 +++
...SPEnvironmentApplicationContextInitializer.java | 2 +-
.../flows/saml2/SAML2SessionInitiatorFlowTest.java | 59 +++++++++++++++++++
.../shibboleth/sp/flows/saml2/package-info.java | 18 ++++++
.../idp/module/conf/sp/metadata-providers.xml | 67 ++++++++++++++++++++++
.../resources/net/shibboleth/sp/test-beans.xml | 4 ++
.../saml/saml2/profile/impl/AddAuthnRequest.java | 2 -
.../sp/messaging/RemotedHttpServletResponse.java | 4 +-
.../ApplicationMetadataResolverLookupFunction.java | 23 +++++++-
.../impl/RemotedHttpServletRequestSupplier.java | 2 -
.../impl/RemotedlHttpServletResponseSupplier.java | 2 -
15 files changed, 198 insertions(+), 29 deletions(-)
diff --git a/sp-conf-impl/pom.xml b/sp-conf-impl/pom.xml
index f98d0db..9cc03db 100644
--- a/sp-conf-impl/pom.xml
+++ b/sp-conf-impl/pom.xml
@@ -32,6 +32,12 @@
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>sp-saml-api</artifactId>
+ <version>${project.version}</version>
+ <scope>runtime</scope>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>sp-saml-impl</artifactId>
diff --git a/sp-conf-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml b/sp-conf-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
index 2622eab..4f8975c 100644
--- a/sp-conf-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
+++ b/sp-conf-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
@@ -39,6 +39,6 @@
</bean>
<bean id="shibboleth.RemotedHttpServletRequestSupplier" class="net.shibboleth.sp.messaging.impl.RemotedHttpServletRequestSupplier" />
- <bean id="shibboleth.RemotedHttpServletResponseSupplier" class="net.shibboleth.sp.messaging.impl.RemotedHttpServletResponseSupplier" />
+ <bean id="shibboleth.RemotedHttpServletResponseSupplier" class="net.shibboleth.sp.messaging.impl.RemotedlHttpServletResponseSupplier" />
</beans>
\ No newline at end of file
diff --git a/sp-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/application/application-beans.xml b/sp-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/application/application-beans.xml
index e51c356..d201acc 100644
--- a/sp-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/application/application-beans.xml
+++ b/sp-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/application/application-beans.xml
@@ -9,12 +9,4 @@
<bean id="ResolveApplication" class="net.shibboleth.sp.profile.impl.ResolveApplication" scope="prototype" />
- <!-- Used by most child flows to get at tunneled/wrapped servlet interfaces. -->
-
- <bean id="shibboleth.RemotedHttpServletRequestSupplier"
- class="net.shibboleth.sp.messaging.impl.RemotedHttpServletRequestSupplier" scope="prototype" />
-
- <bean id="shibboleth.RemotedHttpServletResponseSupplier"
- class="net.shibboleth.sp.messaging.impl.RemotedHttpServletResponseSupplier" scope="prototype" />
-
</beans>
diff --git a/sp-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/initiator/saml2/saml2-beans.xml b/sp-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/initiator/saml2/saml2-beans.xml
index d2022fa..91acb0e 100644
--- a/sp-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/initiator/saml2/saml2-beans.xml
+++ b/sp-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/initiator/saml2/saml2-beans.xml
@@ -10,6 +10,10 @@
<bean id="InitializeRelyingPartyContext"
class="net.shibboleth.sp.profile.impl.InitializeRelyingPartyContext" scope="prototype" />
+ <bean id="PrepareInboundMessageContext"
+ class="net.shibboleth.idp.saml.session.impl.PrepareInboundMessageContext" scope="prototype"
+ p:relyingPartyLookupStrategy-ref="shibboleth.RelyingPartyIdLookup.Simple" />
+
<bean id="WebFlowMessageHandlerAdaptor" abstract="true"
class="net.shibboleth.idp.profile.impl.WebFlowMessageHandlerAdaptor" scope="prototype"
c:executionDirection="INBOUND" />
@@ -46,20 +50,18 @@
<bean id="SelectProfileConfiguration"
class="net.shibboleth.idp.profile.impl.SelectProfileConfiguration" scope="prototype"
- p:profileId="T(net.shibboleth.saml.saml2.profile.config.BrowserSSOProfileConfiguration).PROFILE_ID" />
+ p:profileId="#{T(net.shibboleth.saml.saml2.profile.config.BrowserSSOProfileConfiguration).PROFILE_ID}" />
<bean id="AppAwareIssuerLookupFunction" class="net.shibboleth.sp.profile.context.navigate.IssuerLookupFunction" />
<bean id="InitializeOutboundMessageContext"
class="net.shibboleth.idp.saml.profile.impl.InitializeOutboundMessageContext" scope="prototype"
- p:issuerLookupStrategy="AppAwareIssuerLookupFunction" />
+ p:selfIdentityLookupStrategy-ref="AppAwareIssuerLookupFunction" />
- <bean id="InitializeMessageChannelSecurityContext" parent="WebFlowProfileActionAdaptor" scope="prototype">
- <constructor-arg>
- <bean class="org.opensaml.profile.action.impl.StaticMessageChannelSecurity"
- p:confidentialityActive="false" p:integrityActive="false" />
- </constructor-arg>
- </bean>
+ <bean id="InitializeMessageChannelSecurityContext"
+ class="org.opensaml.profile.action.impl.StaticMessageChannelSecurity" scope="prototype"
+ p:confidentialityActive="false"
+ p:integrityActive="false" />
<util:constant id="shibboleth.EndpointType"
static-field="org.opensaml.saml.saml2.metadata.SingleSignOnService.DEFAULT_ELEMENT_NAME" />
@@ -101,7 +103,6 @@
<bean id="AddAuthnRequest"
class="net.shibboleth.sp.saml.saml2.profile.impl.AddAuthnRequest" scope="prototype"
p:overwriteExisting="true"
- p:convertUnknownRequestedPrincipals="%{sp.authn.SAML.convertUnknownRequestedPrincipals:false}"
p:issuerLookupStrategy-ref="AppAwareIssuerLookupFunction"
p:nameIDLookupStrategy="#{getObject('%{sp.authn.SAML.NameIDLookupStrategy:}'.trim())}">
<property name="identifierGeneratorLookupStrategy">
@@ -127,7 +128,7 @@
</bean>
<bean id="HandleOutboundMessage" parent="WebFlowMessageHandlerAdaptor"
- c:messageHandler-ref="shibboleth.PreEncodeMessageHandler"
+ c:messageHandler-ref="PreEncodeMessageHandler"
c:executionDirection="OUTBOUND">
<property name="errorEvent">
<util:constant static-field="org.opensaml.profile.action.EventIds.MESSAGE_PROC_ERROR" />
diff --git a/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/AbstractSPFlowTest.java b/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/AbstractSPFlowTest.java
index 1ab60e2..038b889 100644
--- a/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/AbstractSPFlowTest.java
+++ b/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/AbstractSPFlowTest.java
@@ -38,6 +38,7 @@ import net.shibboleth.idp.test.flows.AbstractFlowTest;
import net.shibboleth.shared.servlet.impl.HttpServletRequestResponseContext;
import net.shibboleth.sp.context.AgentRequestContext;
import net.shibboleth.sp.ddf.DDF;
+import net.shibboleth.sp.profile.impl.ResolveApplication;
/**
* Abstract unit test class for SP flows.
@@ -136,6 +137,12 @@ public abstract class AbstractSPFlowTest extends AbstractFlowTest {
request.setContentType(contentType);
request.setContent(body.getBytes());
}
+
+ protected void setApplicationRequest(@Nullable final String applicationId) throws IOException {
+ final DDF input = new DDF(null).structure();
+ input.addmember(ResolveApplication.APPLICATION_ID).string(applicationId != null ? applicationId : "default");
+ setRequest("POST", input);
+ }
/**
* Checks that an output {@link DDF} was prepared, packaged in the response, and contains an event
diff --git a/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/TestSPEnvironmentApplicationContextInitializer.java b/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/TestSPEnvironmentApplicationContextInitializer.java
index 8c88e67..51cc3cf 100644
--- a/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/TestSPEnvironmentApplicationContextInitializer.java
+++ b/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/TestSPEnvironmentApplicationContextInitializer.java
@@ -43,7 +43,7 @@ public class TestSPEnvironmentApplicationContextInitializer
final MockPropertySource mock = new MockPropertySource();
mock.setProperty("idp.home", "classpath:/net/shibboleth/idp/module");
mock.setProperty("idp.webflows", "classpath*:/flows");
- mock.setProperty("idp.service.metadata.resources", "testbed.MetadataResolverResources");
+ mock.setProperty("idp.service.metadata.resources", "test.sp.MetadataResolverResources");
mock.setProperty("sp.service.agents.resources", "test.sp.AgentResolverResources");
mock.setProperty("idp.additionalProperties",
"/conf/ldap.properties, /conf/saml-nameid.properties, /conf/services.properties, /conf/admin/admin.properties, /conf/authn/authn.properties, /conf/c14n/subject-c14n.properties, /credentials/secrets.properties, /conf/sp/sp.properties");
diff --git a/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/saml2/SAML2SessionInitiatorFlowTest.java b/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/saml2/SAML2SessionInitiatorFlowTest.java
new file mode 100644
index 0000000..69e0e47
--- /dev/null
+++ b/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/saml2/SAML2SessionInitiatorFlowTest.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed 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.sp.flows.saml2;
+
+import java.io.IOException;
+
+import javax.annotation.Nonnull;
+
+import org.springframework.webflow.executor.FlowExecutionResult;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import net.shibboleth.sp.ddf.DDF;
+import net.shibboleth.sp.flows.AbstractSPFlowTest;
+
+/**
+ * Unit test for the SP session-initiator flow (basics only).
+ */
+public class SAML2SessionInitiatorFlowTest extends AbstractSPFlowTest {
+
+ /** Flow ID. */
+ @Nonnull public static final String FLOW_ID = "sp/session-initiator";
+
+ protected SAML2SessionInitiatorFlowTest() {
+ super(FLOW_ID);
+ }
+
+ /**
+ * Test basic use of flow.
+ *
+ * @throws IOException
+ */
+ @Test
+ public void testSimple() throws IOException {
+ setDefaultAuth();
+ setApplicationRequest(null);
+
+ final FlowExecutionResult result = flowExecutor.launchExecution(FLOW_ID, null, externalContext);
+ assertFlowExecutionResult(result, FLOW_ID);
+ assertFlowExecutionOutcome(result.getOutcome());
+
+ final DDF output = assertOutputMessageEvent(result, null);
+ assert output != null;
+ Assert.assertTrue(output.isstruct());
+ }
+
+}
\ No newline at end of file
diff --git a/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/saml2/package-info.java b/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/saml2/package-info.java
new file mode 100644
index 0000000..dcd7e59
--- /dev/null
+++ b/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/saml2/package-info.java
@@ -0,0 +1,18 @@
+/*
+ * Licensed 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.
+ */
+
+/**
+ * Unit tests for SAML 2 flows.
+ */
+package net.shibboleth.sp.flows.saml2;
\ No newline at end of file
diff --git a/sp-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/sp/metadata-providers.xml b/sp-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/sp/metadata-providers.xml
new file mode 100644
index 0000000..c0b438e
--- /dev/null
+++ b/sp-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/sp/metadata-providers.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<MetadataProvider id="ShibbolethMetadata" xsi:type="ChainingMetadataProvider"
+ xmlns="urn:mace:shibboleth:2.0:metadata"
+ xmlns:security="urn:mace:shibboleth:2.0:security"
+ xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
+ xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
+ xmlns:alg="urn:oasis:names:tc:SAML:metadata:algsupport"
+ xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
+ xmlns:ds11="http://www.w3.org/2009/xmldsig11#"
+ xmlns:enc="http://www.w3.org/2001/04/xmlenc#"
+ xmlns:enc11="http://www.w3.org/2009/xmlenc11#"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:mace:shibboleth:2.0:metadata http://shibboleth.net/schema/idp/shibboleth-metadata.xsd
+ urn:mace:shibboleth:2.0:security http://shibboleth.net/schema/idp/shibboleth-security.xsd
+ urn:oasis:names:tc:SAML:2.0:assertion http://docs.oasis-open.org/security/saml/v2.0/saml-schema-assertion-2.0.xsd
+ urn:oasis:names:tc:SAML:2.0:metadata http://docs.oasis-open.org/security/saml/v2.0/saml-schema-metadata-2.0.xsd
+ urn:oasis:names:tc:SAML:metadata:algsupport http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-metadata-algsupport-v1.0.xsd
+ http://www.w3.org/2000/09/xmldsig# http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd
+ http://www.w3.org/2009/xmldsig11# http://www.w3.org/TR/2013/REC-xmldsig-core1-20130411/xmldsig11-schema.xsd
+ http://www.w3.org/2001/04/xmlenc# http://www.w3.org/TR/xmlenc-core/xenc-schema.xsd
+ http://www.w3.org/2009/xmlenc11# http://www.w3.org/TR/2013/REC-xmlenc-core1-20130411/xenc-schema-11.xsd">
+
+ <!-- ========================================== -->
+ <!-- Metadata Configuration -->
+ <!-- ========================================== -->
+
+ <!-- Example metadata provider. -->
+
+ <MetadataProvider id="InlineExample" xsi:type="InlineMetadataProvider" indexesRef="testbed.MetadataIndexes">
+ <md:EntityDescriptor ID="entity" entityID="https://idp.example.org">
+ <md:IDPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
+ <md:KeyDescriptor>
+ <ds:KeyInfo>
+ <ds:X509Data>
+ <ds:X509Certificate>
+MIIDtTCCAp2gAwIBAgIJAPmsD+VGldyPMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV
+BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX
+aWRnaXRzIFB0eSBMdGQwHhcNMTQwNDExMTMzOTE4WhcNMjQwNDA4MTMzOTE4WjBF
+MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50
+ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
+CgKCAQEAxg0TyQAP/tIvOH89EtaXuRRn8SYzTj7W1TbNY4VvBmobjkRmSkki4hH9
+x4sQpi635wn6WtXTN/FNNmkTK3N/LspmBWxfZS+n+cc7I82E5yvCAPX67QsZgqgg
+lp2W5dvK/FsMMCS6X6SVqzBLMP88NenXKxY+HMxMs0sT0UKYh1cAEqadrHRBO65a
+DBcm5a0sBVYt9K6pgaOHrp/zSIbhnR5tFFLjBbtFktDpHL3AdGBH3OYidNGKBO3t
+J3Ms7LeKXsM0+0Y4P+9fHZINL2X3E2N6GVnKs5PZTg9sP0FtIpAbYm/+zCx7Yj1E
+T/Er8mDd6tNVGSQsn9s5xUBwGqn14wIDAQABo4GnMIGkMB0GA1UdDgQWBBSiQhSu
+p9BYjD2ZuMkEiQK7w/Zq0TB1BgNVHSMEbjBsgBSiQhSup9BYjD2ZuMkEiQK7w/Zq
+0aFJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNV
+BAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAPmsD+VGldyPMAwGA1UdEwQF
+MAMBAf8wDQYJKoZIhvcNAQELBQADggEBAHZmIo9GBTSsD5DJfKkCVUvBafwR089H
+BkgVPOuVuEe803BRlKd4BVIsuxAUAy3oqdJYqf9ptPEx8Ef+ALbcDhRbWINhMgO7
+0/S4x3pS9gOn7/Y9yZplOe4Jd2q3R8QBef+hKLcD/Uv0Sqy2nilM8BnMga5tqsL+
+8oFt0blzXtQ2vcOVyNyG326uZBZv2Cf6FXFsYQX1L/tLeTBJegefgGkg2dqCTKIU
+1Qy/Kd2P3/S01kQxjDeG7UfXc9qtelJ68kvzK2d3WOJ2qmsdMxjMNfTItP7FO54M
+i8V7gp9HK+EimdSbgu7xktKlrqA2Rsn+dBoPSgOUs/LOGtCS9/biF0w=
+ </ds:X509Certificate>
+ </ds:X509Data>
+ </ds:KeyInfo>
+ </md:KeyDescriptor>
+ <md:SingleSignOnService
+ Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
+ Location="https://idp.example.org/idp/profile/SAML2/SSO/Redirect" />
+ </md:IDPSSODescriptor>
+ </md:EntityDescriptor>
+ </MetadataProvider>
+
+</MetadataProvider>
diff --git a/sp-conf-impl/src/test/resources/net/shibboleth/sp/test-beans.xml b/sp-conf-impl/src/test/resources/net/shibboleth/sp/test-beans.xml
index 552dc1d..4f388d6 100644
--- a/sp-conf-impl/src/test/resources/net/shibboleth/sp/test-beans.xml
+++ b/sp-conf-impl/src/test/resources/net/shibboleth/sp/test-beans.xml
@@ -20,4 +20,8 @@
<value>%{idp.home}/conf/sp/test-agents.xml</value>
</util:list>
+ <util:list id="test.sp.MetadataResolverResources">
+ <value>%{idp.home}/conf/sp/metadata-providers.xml</value>
+ </util:list>
+
</beans>
diff --git a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/AddAuthnRequest.java b/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/AddAuthnRequest.java
index dffdda0..5c5555f 100644
--- a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/AddAuthnRequest.java
+++ b/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/AddAuthnRequest.java
@@ -360,8 +360,6 @@ public class AddAuthnRequest extends AbstractApplicationAction {
* Build a {@link Scoping} element, decrementing the proxy count if set.
*
* @param profileRequestContext current profile request context
- * @param count proxy count
- * @param idplist list of IdP entityIDs
*
* @return populated {@link Scoping}
*/
diff --git a/sp-server-api/src/main/java/net/shibboleth/sp/messaging/RemotedHttpServletResponse.java b/sp-server-api/src/main/java/net/shibboleth/sp/messaging/RemotedHttpServletResponse.java
index 9ad537f..a383f21 100644
--- a/sp-server-api/src/main/java/net/shibboleth/sp/messaging/RemotedHttpServletResponse.java
+++ b/sp-server-api/src/main/java/net/shibboleth/sp/messaging/RemotedHttpServletResponse.java
@@ -107,7 +107,9 @@ public class RemotedHttpServletResponse implements HttpServletResponse {
/** {@inheritDoc} */
public void setCharacterEncoding(final String charset) {
- throw new UnsupportedOperationException();
+ if (!"UTF-8".equals(charset)) {
+ throw new IllegalArgumentException("Character set must be UTF-8.");
+ }
}
/** {@inheritDoc} */
diff --git a/sp-server-api/src/main/java/net/shibboleth/sp/profile/context/navigate/messaging/ApplicationMetadataResolverLookupFunction.java b/sp-server-api/src/main/java/net/shibboleth/sp/profile/context/navigate/messaging/ApplicationMetadataResolverLookupFunction.java
index 5b482c8..ed32fe3 100644
--- a/sp-server-api/src/main/java/net/shibboleth/sp/profile/context/navigate/messaging/ApplicationMetadataResolverLookupFunction.java
+++ b/sp-server-api/src/main/java/net/shibboleth/sp/profile/context/navigate/messaging/ApplicationMetadataResolverLookupFunction.java
@@ -14,14 +14,18 @@
package net.shibboleth.sp.profile.context.navigate.messaging;
+import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opensaml.messaging.context.MessageContext;
import org.opensaml.saml.metadata.resolver.MetadataResolver;
import org.opensaml.saml.metadata.resolver.RoleDescriptorResolver;
import org.opensaml.saml.metadata.resolver.impl.PredicateRoleDescriptorResolver;
+import org.slf4j.Logger;
import net.shibboleth.idp.saml.metadata.impl.ReloadableMetadataResolver;
+import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.sp.Application;
import net.shibboleth.sp.context.AgentRequestContext;
@@ -32,14 +36,29 @@ import net.shibboleth.sp.context.AgentRequestContext;
public class ApplicationMetadataResolverLookupFunction
extends AbstractAgentRequestLookupFunction<RoleDescriptorResolver> {
+ /** Class logger. */
+ @Nonnull private final Logger log = LoggerFactory.getLogger(ApplicationMetadataResolverLookupFunction.class);
+
/** {@inheritDoc} */
@Nullable public RoleDescriptorResolver apply(@Nullable final MessageContext input) {
final AgentRequestContext arc = getAgentRequestContext(input);
if (arc != null) {
final Application application = arc.getApplication();
if (application != null) {
- return new PredicateRoleDescriptorResolver(
- new ReloadableMetadataResolver(application.getMetadataResolver()));
+ try {
+ final ReloadableMetadataResolver metadataResolver =
+ new ReloadableMetadataResolver(application.getMetadataResolver());
+ metadataResolver.setId(application.getId() + " MetadataResolver");
+ metadataResolver.initialize();
+
+ final PredicateRoleDescriptorResolver roleResolver =
+ new PredicateRoleDescriptorResolver(metadataResolver);
+ roleResolver.initialize();
+
+ return roleResolver;
+ } catch (final ComponentInitializationException e) {
+ log.error("Exception wrapping Application-supplied MetadataResolver for use", e);
+ }
}
}
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/messaging/impl/RemotedHttpServletRequestSupplier.java b/sp-server-impl/src/main/java/net/shibboleth/sp/messaging/impl/RemotedHttpServletRequestSupplier.java
index b57940d..58e2612 100644
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/messaging/impl/RemotedHttpServletRequestSupplier.java
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/messaging/impl/RemotedHttpServletRequestSupplier.java
@@ -18,7 +18,6 @@ import javax.annotation.Nonnull;
import javax.annotation.concurrent.NotThreadSafe;
import jakarta.servlet.http.HttpServletRequest;
-import net.shibboleth.shared.annotation.Prototype;
import net.shibboleth.shared.primitive.NonnullSupplier;
import net.shibboleth.sp.messaging.RemotedHttpServletRequest;
@@ -27,7 +26,6 @@ import net.shibboleth.sp.messaging.RemotedHttpServletRequest;
* servlet request obtained from {@link RemotedHttpServletRequestResponseContext}, raising an
* {@link IllegalStateException} if null.
*/
- at Prototype
@NotThreadSafe
public class RemotedHttpServletRequestSupplier implements NonnullSupplier<HttpServletRequest> {
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/messaging/impl/RemotedlHttpServletResponseSupplier.java b/sp-server-impl/src/main/java/net/shibboleth/sp/messaging/impl/RemotedlHttpServletResponseSupplier.java
index 7db271d..23874d1 100644
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/messaging/impl/RemotedlHttpServletResponseSupplier.java
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/messaging/impl/RemotedlHttpServletResponseSupplier.java
@@ -18,7 +18,6 @@ import javax.annotation.Nonnull;
import javax.annotation.concurrent.NotThreadSafe;
import jakarta.servlet.http.HttpServletResponse;
-import net.shibboleth.shared.annotation.Prototype;
import net.shibboleth.shared.primitive.NonnullSupplier;
import net.shibboleth.sp.messaging.RemotedHttpServletResponse;
@@ -27,7 +26,6 @@ import net.shibboleth.sp.messaging.RemotedHttpServletResponse;
* servlet response obtained from {@link RemotedHttpServletRequestResponseContext}, raising an
* {@link IllegalStateException} if null.
*/
- at Prototype
@NotThreadSafe
public class RemotedlHttpServletResponseSupplier implements NonnullSupplier<HttpServletResponse> {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list