|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2002-2019 the original author or authors. |
|
|
|
|
* Copyright 2002-2020 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
|
@ -14,21 +14,20 @@
@@ -14,21 +14,20 @@
|
|
|
|
|
* limitations under the License. |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
package org.springframework.security.config.annotation.web.configurers.saml2; |
|
|
|
|
package org.springframework.security.saml2.provider.service.registration; |
|
|
|
|
|
|
|
|
|
import org.springframework.security.saml2.credentials.Saml2X509Credential; |
|
|
|
|
import org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration; |
|
|
|
|
import org.springframework.security.saml2.provider.service.servlet.filter.Saml2WebSsoAuthenticationFilter; |
|
|
|
|
|
|
|
|
|
import static org.springframework.security.config.annotation.web.configurers.saml2.TestSaml2Credentials.signingCredential; |
|
|
|
|
import static org.springframework.security.config.annotation.web.configurers.saml2.TestSaml2Credentials.verificationCertificate; |
|
|
|
|
import static org.springframework.security.saml2.credentials.TestSaml2X509Credentials.relyingPartySigningCredential; |
|
|
|
|
import static org.springframework.security.saml2.credentials.TestSaml2X509Credentials.relyingPartyVerifyingCredential; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Preconfigured test data for {@link RelyingPartyRegistration} objects |
|
|
|
|
*/ |
|
|
|
|
public class TestRelyingPartyRegistrations { |
|
|
|
|
|
|
|
|
|
static RelyingPartyRegistration saml2AuthenticationConfiguration() { |
|
|
|
|
public static RelyingPartyRegistration.Builder relyingPartyRegistration() { |
|
|
|
|
//remote IDP entity ID
|
|
|
|
|
String idpEntityId = "https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/metadata.php"; |
|
|
|
|
//remote WebSSO Endpoint - Where to Send AuthNRequests to
|
|
|
|
|
@ -38,9 +37,9 @@ public class TestRelyingPartyRegistrations {
@@ -38,9 +37,9 @@ public class TestRelyingPartyRegistrations {
|
|
|
|
|
//local entity ID - autogenerated based on URL
|
|
|
|
|
String localEntityIdTemplate = "{baseUrl}/saml2/service-provider-metadata/{registrationId}"; |
|
|
|
|
//local signing (and decryption key)
|
|
|
|
|
Saml2X509Credential signingCredential = signingCredential(); |
|
|
|
|
Saml2X509Credential signingCredential = relyingPartySigningCredential(); |
|
|
|
|
//IDP certificate for verification of incoming messages
|
|
|
|
|
Saml2X509Credential idpVerificationCertificate = verificationCertificate(); |
|
|
|
|
Saml2X509Credential idpVerificationCertificate = relyingPartyVerifyingCredential(); |
|
|
|
|
String acsUrlTemplate = "{baseUrl}" + Saml2WebSsoAuthenticationFilter.DEFAULT_FILTER_PROCESSES_URI; |
|
|
|
|
return RelyingPartyRegistration.withRegistrationId(registrationId) |
|
|
|
|
.providerDetails(c -> c.entityId(idpEntityId)) |
|
|
|
|
@ -48,8 +47,7 @@ public class TestRelyingPartyRegistrations {
@@ -48,8 +47,7 @@ public class TestRelyingPartyRegistrations {
|
|
|
|
|
.credentials(c -> c.add(signingCredential)) |
|
|
|
|
.credentials(c -> c.add(idpVerificationCertificate)) |
|
|
|
|
.localEntityIdTemplate(localEntityIdTemplate) |
|
|
|
|
.assertionConsumerServiceUrlTemplate(acsUrlTemplate) |
|
|
|
|
.build(); |
|
|
|
|
.assertionConsumerServiceUrlTemplate(acsUrlTemplate); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|