Search in sources :

Example 26 with ArtifactResponseType

use of org.keycloak.dom.saml.v2.protocol.ArtifactResponseType in project keycloak by keycloak.

the class ArtifactBindingTest method testArtifactBindingLoginGetArtifactResponseTwice.

@Test
public void testArtifactBindingLoginGetArtifactResponseTwice() {
    SamlClientBuilder clientBuilder = new SamlClientBuilder();
    HandleArtifactStepBuilder handleArtifactBuilder = new HandleArtifactStepBuilder(getAuthServerSamlEndpoint(REALM_NAME), SAML_CLIENT_ID_SALES_POST, clientBuilder);
    SAMLDocumentHolder response = clientBuilder.authnRequest(getAuthServerSamlEndpoint(REALM_NAME), SAML_CLIENT_ID_SALES_POST, SAML_ASSERTION_CONSUMER_URL_SALES_POST, SamlClient.Binding.REDIRECT).setProtocolBinding(JBossSAMLURIConstants.SAML_HTTP_ARTIFACT_BINDING.getUri()).build().login().user(bburkeUser).build().handleArtifact(handleArtifactBuilder).build().processSamlResponse(ARTIFACT_RESPONSE).transformObject(ob -> {
        assertThat(ob, isSamlResponse(JBossSAMLURIConstants.STATUS_SUCCESS));
        return null;
    }).build().handleArtifact(handleArtifactBuilder).replayPost(true).build().doNotFollowRedirects().executeAndTransform(this::getArtifactResponse);
    assertThat(response.getSamlObject(), instanceOf(ArtifactResponseType.class));
    ArtifactResponseType artifactResponse = (ArtifactResponseType) response.getSamlObject();
    assertThat(artifactResponse, isSamlStatusResponse(JBossSAMLURIConstants.STATUS_SUCCESS));
    assertThat(artifactResponse.getAny(), nullValue());
}
Also used : SAMLDocumentHolder(org.keycloak.saml.processing.core.saml.v2.common.SAMLDocumentHolder) SamlClientBuilder(org.keycloak.testsuite.util.SamlClientBuilder) ArtifactResponseType(org.keycloak.dom.saml.v2.protocol.ArtifactResponseType) HandleArtifactStepBuilder(org.keycloak.testsuite.util.saml.HandleArtifactStepBuilder) Test(org.junit.Test)

Aggregations

ArtifactResponseType (org.keycloak.dom.saml.v2.protocol.ArtifactResponseType)25 Test (org.junit.Test)17 SAMLDocumentHolder (org.keycloak.saml.processing.core.saml.v2.common.SAMLDocumentHolder)17 SamlClientBuilder (org.keycloak.testsuite.util.SamlClientBuilder)16 StatusResponseType (org.keycloak.dom.saml.v2.protocol.StatusResponseType)14 ResponseType (org.keycloak.dom.saml.v2.protocol.ResponseType)13 NameIDMappingResponseType (org.keycloak.dom.saml.v2.protocol.NameIDMappingResponseType)9 ProcessingException (org.keycloak.saml.common.exceptions.ProcessingException)7 Document (org.w3c.dom.Document)6 SamlDeployment (org.keycloak.adapters.saml.SamlDeployment)5 LogoutRequestType (org.keycloak.dom.saml.v2.protocol.LogoutRequestType)5 ParsingException (org.keycloak.saml.common.exceptions.ParsingException)5 ByteArrayInputStream (java.io.ByteArrayInputStream)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 IOException (java.io.IOException)3 Matchers.containsString (org.hamcrest.Matchers.containsString)3 Charsets (com.google.common.base.Charsets)2 URI (java.net.URI)2 URISyntaxException (java.net.URISyntaxException)2 MessageDigest (java.security.MessageDigest)2