Search in sources :

Example 1 with HandleArtifactStepBuilder

use of org.keycloak.testsuite.util.saml.HandleArtifactStepBuilder 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

Test (org.junit.Test)1 ArtifactResponseType (org.keycloak.dom.saml.v2.protocol.ArtifactResponseType)1 SAMLDocumentHolder (org.keycloak.saml.processing.core.saml.v2.common.SAMLDocumentHolder)1 SamlClientBuilder (org.keycloak.testsuite.util.SamlClientBuilder)1 HandleArtifactStepBuilder (org.keycloak.testsuite.util.saml.HandleArtifactStepBuilder)1