Migrate SAML 2.0 Samples to PCFOne

Closes gh-9362
This commit is contained in:
Josh Cummings 2021-01-21 09:13:30 -07:00
parent 32acb04efe
commit 6df5dc4ecf
No known key found for this signature in database
GPG Key ID: 49EF60DD7FF83443
3 changed files with 10 additions and 10 deletions

View File

@ -124,7 +124,7 @@ public class Saml2LoginIntegrationTests {
public void authenticateRequestWhenUnauthenticatedThenRespondsWithRedirectAuthNRequestXML() throws Exception {
mockMvc.perform(get("http://localhost:8080/saml2/authenticate/simplesamlphp"))
.andExpect(status().is3xxRedirection())
.andExpect(header().string("Location", startsWith("https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/SSOService.php?SAMLRequest=")));
.andExpect(header().string("Location", startsWith("https://simplesaml-for-spring-saml.apps.pcfone.io/saml2/idp/SSOService.php?SAMLRequest=")));
}
@Test
@ -134,7 +134,7 @@ public class Saml2LoginIntegrationTests {
.param("RelayState", "relay state value with spaces")
)
.andExpect(status().is3xxRedirection())
.andExpect(header().string("Location", startsWith("https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/SSOService.php?SAMLRequest=")))
.andExpect(header().string("Location", startsWith("https://simplesaml-for-spring-saml.apps.pcfone.io/saml2/idp/SSOService.php?SAMLRequest=")))
.andExpect(header().string("Location", containsString("RelayState=relay%20state%20value%20with%20spaces")));
}
@ -155,7 +155,7 @@ public class Saml2LoginIntegrationTests {
String destination = authnRequest.getDestination();
assertEquals(
"Destination must match",
"https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/SSOService.php",
"https://simplesaml-for-spring-saml.apps.pcfone.io/saml2/idp/SSOService.php",
destination
);
String acsURL = authnRequest.getAssertionConsumerServiceURL();
@ -317,14 +317,14 @@ public class Saml2LoginIntegrationTests {
Response response = OpenSamlActionTestingSupport.buildResponse();
response.setID("_" + UUID.randomUUID().toString());
response.setDestination("http://localhost:8080/login/saml2/sso/simplesamlphp");
response.setIssuer(buildIssuer("https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/metadata.php"));
response.setIssuer(buildIssuer("https://simplesaml-for-spring-saml.apps.pcfone.io/saml2/idp/metadata.php"));
return response;
}
private Assertion buildAssertion(String username) {
Assertion assertion = OpenSamlActionTestingSupport.buildAssertion();
assertion.setIssueInstant(DateTime.now());
assertion.setIssuer(buildIssuer("https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/metadata.php"));
assertion.setIssuer(buildIssuer("https://simplesaml-for-spring-saml.apps.pcfone.io/saml2/idp/metadata.php"));
assertion.setSubject(buildSubject(username));
assertion.setConditions(buildConditions());
@ -346,7 +346,7 @@ public class Saml2LoginIntegrationTests {
final PrivateKey privateKey = KeySupport.decodePrivateKey(key.getBytes(UTF_8), new char[0]);
BasicCredential cred = CredentialSupport.getSimpleCredential(publicKey, privateKey);
cred.setUsageType(usageType);
cred.setEntityId("https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/metadata.php");
cred.setEntityId("https://simplesaml-for-spring-saml.apps.pcfone.io/saml2/idp/metadata.php");
return cred;
}

View File

@ -12,5 +12,5 @@ spring:
verification:
credentials:
- certificate-location: "classpath:credentials/idp-certificate.crt"
entity-id: https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/metadata.php
sso-url: https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/SSOService.php
entity-id: https://simplesaml-for-spring-saml.apps.pcfone.io/saml2/idp/metadata.php
sso-url: https://simplesaml-for-spring-saml.apps.pcfone.io/saml2/idp/SSOService.php

View File

@ -45,9 +45,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Bean
RelyingPartyRegistrationRepository getSaml2AuthenticationConfiguration() throws Exception {
//remote IDP entity ID
String idpEntityId = "https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/metadata.php";
String idpEntityId = "https://simplesaml-for-spring-saml.apps.pcfone.io/saml2/idp/metadata.php";
//remote WebSSO Endpoint - Where to Send AuthNRequests to
String webSsoEndpoint = "https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/SSOService.php";
String webSsoEndpoint = "https://simplesaml-for-spring-saml.apps.pcfone.io/saml2/idp/SSOService.php";
//local registration ID
String registrationId = "simplesamlphp";
//local entity ID - autogenerated based on URL