use of ddf.security.samlp.impl.SamlProtocol.REDIRECT_BINDING in project ddf by codice.
the class SamlProtocolTest method testCreateIdpMetadata.
@Test
public void testCreateIdpMetadata() {
EntityDescriptor entityDescriptor = SamlProtocol.createIdpMetadata("myid", "mysigningcert", "myencryptioncert", Arrays.asList("mynameid"), "redirectlocation", "postlocation", "soaplocation", "logoutlocation");
assertEquals("myid", entityDescriptor.getEntityID());
assertEquals("mysigningcert", entityDescriptor.getIDPSSODescriptor(SamlProtocol.SUPPORTED_PROTOCOL).getKeyDescriptors().get(0).getKeyInfo().getX509Datas().get(0).getX509Certificates().get(0).getValue());
assertEquals("myencryptioncert", entityDescriptor.getIDPSSODescriptor(SamlProtocol.SUPPORTED_PROTOCOL).getKeyDescriptors().get(1).getKeyInfo().getX509Datas().get(0).getX509Certificates().get(0).getValue());
assertEquals("mynameid", entityDescriptor.getIDPSSODescriptor(SamlProtocol.SUPPORTED_PROTOCOL).getNameIDFormats().get(0).getFormat());
assertEquals("logoutlocation", entityDescriptor.getIDPSSODescriptor(SamlProtocol.SUPPORTED_PROTOCOL).getSingleLogoutServices().get(0).getLocation());
List<SingleSignOnService> ssoServices = entityDescriptor.getIDPSSODescriptor(SamlProtocol.SUPPORTED_PROTOCOL).getSingleSignOnServices();
assertTrue(ssoServices.stream().filter(service -> service.getBinding().equals(REDIRECT_BINDING) && service.getLocation().equals("redirectlocation")).findFirst().isPresent());
assertTrue(ssoServices.stream().filter(service -> service.getBinding().equals(POST_BINDING) && service.getLocation().equals("postlocation")).findFirst().isPresent());
assertTrue(ssoServices.stream().filter(service -> service.getBinding().equals(SOAP_BINDING) && service.getLocation().equals("soaplocation")).findFirst().isPresent());
assertNotNull(entityDescriptor.getCacheDuration());
}
use of ddf.security.samlp.impl.SamlProtocol.REDIRECT_BINDING in project ddf by codice.
the class SamlProtocolTest method testCreateSpMetadata.
@Test
public void testCreateSpMetadata() {
EntityDescriptor entityDescriptor = SamlProtocol.createSpMetadata("myid", "mysigningcert", "myencryptioncert", Arrays.asList("mynameid"), "logoutlocation", "redirectlocation", "postlocation", "paoslocation");
assertEquals("myid", entityDescriptor.getEntityID());
assertEquals("mysigningcert", entityDescriptor.getSPSSODescriptor(SamlProtocol.SUPPORTED_PROTOCOL).getKeyDescriptors().get(0).getKeyInfo().getX509Datas().get(0).getX509Certificates().get(0).getValue());
assertEquals("myencryptioncert", entityDescriptor.getSPSSODescriptor(SamlProtocol.SUPPORTED_PROTOCOL).getKeyDescriptors().get(1).getKeyInfo().getX509Datas().get(0).getX509Certificates().get(0).getValue());
assertEquals("mynameid", entityDescriptor.getSPSSODescriptor(SamlProtocol.SUPPORTED_PROTOCOL).getNameIDFormats().get(0).getFormat());
assertEquals("logoutlocation", entityDescriptor.getSPSSODescriptor(SamlProtocol.SUPPORTED_PROTOCOL).getSingleLogoutServices().get(0).getLocation());
List<AssertionConsumerService> acServices = entityDescriptor.getSPSSODescriptor(SamlProtocol.SUPPORTED_PROTOCOL).getAssertionConsumerServices();
assertTrue(acServices.stream().filter(service -> service.getBinding().equals(REDIRECT_BINDING) && service.getLocation().equals("redirectlocation")).findFirst().isPresent());
assertTrue(acServices.stream().filter(service -> service.getBinding().equals(POST_BINDING) && service.getLocation().equals("postlocation")).findFirst().isPresent());
assertTrue(acServices.stream().filter(service -> service.getBinding().equals(PAOS_BINDING) && service.getLocation().equals("paoslocation")).findFirst().isPresent());
assertNotNull(entityDescriptor.getCacheDuration());
}
Aggregations