parent
32acb04efe
commit
6df5dc4ecf
|
@ -124,7 +124,7 @@ public class Saml2LoginIntegrationTests {
|
||||||
public void authenticateRequestWhenUnauthenticatedThenRespondsWithRedirectAuthNRequestXML() throws Exception {
|
public void authenticateRequestWhenUnauthenticatedThenRespondsWithRedirectAuthNRequestXML() throws Exception {
|
||||||
mockMvc.perform(get("http://localhost:8080/saml2/authenticate/simplesamlphp"))
|
mockMvc.perform(get("http://localhost:8080/saml2/authenticate/simplesamlphp"))
|
||||||
.andExpect(status().is3xxRedirection())
|
.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
|
@Test
|
||||||
|
@ -134,7 +134,7 @@ public class Saml2LoginIntegrationTests {
|
||||||
.param("RelayState", "relay state value with spaces")
|
.param("RelayState", "relay state value with spaces")
|
||||||
)
|
)
|
||||||
.andExpect(status().is3xxRedirection())
|
.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")));
|
.andExpect(header().string("Location", containsString("RelayState=relay%20state%20value%20with%20spaces")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ public class Saml2LoginIntegrationTests {
|
||||||
String destination = authnRequest.getDestination();
|
String destination = authnRequest.getDestination();
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"Destination must match",
|
"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
|
destination
|
||||||
);
|
);
|
||||||
String acsURL = authnRequest.getAssertionConsumerServiceURL();
|
String acsURL = authnRequest.getAssertionConsumerServiceURL();
|
||||||
|
@ -317,14 +317,14 @@ public class Saml2LoginIntegrationTests {
|
||||||
Response response = OpenSamlActionTestingSupport.buildResponse();
|
Response response = OpenSamlActionTestingSupport.buildResponse();
|
||||||
response.setID("_" + UUID.randomUUID().toString());
|
response.setID("_" + UUID.randomUUID().toString());
|
||||||
response.setDestination("http://localhost:8080/login/saml2/sso/simplesamlphp");
|
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;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Assertion buildAssertion(String username) {
|
private Assertion buildAssertion(String username) {
|
||||||
Assertion assertion = OpenSamlActionTestingSupport.buildAssertion();
|
Assertion assertion = OpenSamlActionTestingSupport.buildAssertion();
|
||||||
assertion.setIssueInstant(DateTime.now());
|
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.setSubject(buildSubject(username));
|
||||||
assertion.setConditions(buildConditions());
|
assertion.setConditions(buildConditions());
|
||||||
|
|
||||||
|
@ -346,7 +346,7 @@ public class Saml2LoginIntegrationTests {
|
||||||
final PrivateKey privateKey = KeySupport.decodePrivateKey(key.getBytes(UTF_8), new char[0]);
|
final PrivateKey privateKey = KeySupport.decodePrivateKey(key.getBytes(UTF_8), new char[0]);
|
||||||
BasicCredential cred = CredentialSupport.getSimpleCredential(publicKey, privateKey);
|
BasicCredential cred = CredentialSupport.getSimpleCredential(publicKey, privateKey);
|
||||||
cred.setUsageType(usageType);
|
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;
|
return cred;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,5 +12,5 @@ spring:
|
||||||
verification:
|
verification:
|
||||||
credentials:
|
credentials:
|
||||||
- certificate-location: "classpath:credentials/idp-certificate.crt"
|
- certificate-location: "classpath:credentials/idp-certificate.crt"
|
||||||
entity-id: https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/metadata.php
|
entity-id: https://simplesaml-for-spring-saml.apps.pcfone.io/saml2/idp/metadata.php
|
||||||
sso-url: https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/SSOService.php
|
sso-url: https://simplesaml-for-spring-saml.apps.pcfone.io/saml2/idp/SSOService.php
|
||||||
|
|
|
@ -45,9 +45,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||||
@Bean
|
@Bean
|
||||||
RelyingPartyRegistrationRepository getSaml2AuthenticationConfiguration() throws Exception {
|
RelyingPartyRegistrationRepository getSaml2AuthenticationConfiguration() throws Exception {
|
||||||
//remote IDP entity ID
|
//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
|
//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
|
//local registration ID
|
||||||
String registrationId = "simplesamlphp";
|
String registrationId = "simplesamlphp";
|
||||||
//local entity ID - autogenerated based on URL
|
//local entity ID - autogenerated based on URL
|
||||||
|
|
Loading…
Reference in New Issue