Search in sources :

Example 1 with PAOS_BINDING

use of ddf.security.samlp.impl.SamlProtocol.PAOS_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());
}
Also used : AttributeQuery(org.opensaml.saml.saml2.core.AttributeQuery) Arrays(java.util.Arrays) AssertionConsumerService(org.opensaml.saml.saml2.metadata.AssertionConsumerService) Assert.assertNotNull(org.junit.Assert.assertNotNull) LogoutResponse(org.opensaml.saml.saml2.core.LogoutResponse) Assert.assertTrue(org.junit.Assert.assertTrue) POST_BINDING(ddf.security.samlp.impl.SamlProtocol.POST_BINDING) Test(org.junit.Test) PAOS_BINDING(ddf.security.samlp.impl.SamlProtocol.PAOS_BINDING) SOAP_BINDING(ddf.security.samlp.impl.SamlProtocol.SOAP_BINDING) LogoutRequest(org.opensaml.saml.saml2.core.LogoutRequest) List(java.util.List) Assert.assertNull(org.junit.Assert.assertNull) WSSecurityException(org.apache.wss4j.common.ext.WSSecurityException) SingleSignOnService(org.opensaml.saml.saml2.metadata.SingleSignOnService) REDIRECT_BINDING(ddf.security.samlp.impl.SamlProtocol.REDIRECT_BINDING) LogoutWrapper(ddf.security.samlp.LogoutWrapper) EntityDescriptor(org.opensaml.saml.saml2.metadata.EntityDescriptor) Collections(java.util.Collections) Assert.assertEquals(org.junit.Assert.assertEquals) Response(org.opensaml.saml.saml2.core.Response) EntityDescriptor(org.opensaml.saml.saml2.metadata.EntityDescriptor) AssertionConsumerService(org.opensaml.saml.saml2.metadata.AssertionConsumerService) Test(org.junit.Test)

Aggregations

LogoutWrapper (ddf.security.samlp.LogoutWrapper)1 PAOS_BINDING (ddf.security.samlp.impl.SamlProtocol.PAOS_BINDING)1 POST_BINDING (ddf.security.samlp.impl.SamlProtocol.POST_BINDING)1 REDIRECT_BINDING (ddf.security.samlp.impl.SamlProtocol.REDIRECT_BINDING)1 SOAP_BINDING (ddf.security.samlp.impl.SamlProtocol.SOAP_BINDING)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 List (java.util.List)1 WSSecurityException (org.apache.wss4j.common.ext.WSSecurityException)1 Assert.assertEquals (org.junit.Assert.assertEquals)1 Assert.assertNotNull (org.junit.Assert.assertNotNull)1 Assert.assertNull (org.junit.Assert.assertNull)1 Assert.assertTrue (org.junit.Assert.assertTrue)1 Test (org.junit.Test)1 AttributeQuery (org.opensaml.saml.saml2.core.AttributeQuery)1 LogoutRequest (org.opensaml.saml.saml2.core.LogoutRequest)1 LogoutResponse (org.opensaml.saml.saml2.core.LogoutResponse)1 Response (org.opensaml.saml.saml2.core.Response)1 AssertionConsumerService (org.opensaml.saml.saml2.metadata.AssertionConsumerService)1 EntityDescriptor (org.opensaml.saml.saml2.metadata.EntityDescriptor)1