use of org.pac4j.saml.profile.api.SAML2ResponseValidator in project pac4j by pac4j.
the class SAML2LogoutMessageReceiverTest method shouldAcceptLogoutResponse.
@Test
public void shouldAcceptLogoutResponse() {
var webContext = getMockWebContext();
var context = getSaml2MessageContext(webContext);
SAML2ResponseValidator validator = getLogoutValidator("/logoutUrl");
var unit = new SAML2LogoutMessageReceiver(validator, context.getSAML2Configuration());
try {
unit.receiveMessage(context);
fail("Should have thrown a FoundAction");
} catch (SAMLException e) {
fail(e.getMessage());
} catch (FoundAction e) {
assertTrue("SAML2LogoutMessageReceiver processed the logout message successfully", true);
MatcherAssert.assertThat(e.getLocation(), is("/logoutUrl"));
}
}
use of org.pac4j.saml.profile.api.SAML2ResponseValidator in project pac4j by pac4j.
the class SAML2LogoutMessageReceiverTest method shouldAcceptLogoutResponseWithNoRedirect.
@Test
public void shouldAcceptLogoutResponseWithNoRedirect() {
var webContext = getMockWebContext();
var context = getSaml2MessageContext(webContext);
SAML2ResponseValidator validator = getLogoutValidator("");
var unit = new SAML2LogoutMessageReceiver(validator, context.getSAML2Configuration());
try {
unit.receiveMessage(context);
fail("Should have thrown a FoundAction");
} catch (SAMLException e) {
fail(e.getMessage());
} catch (OkAction e) {
assertTrue("SAML2LogoutMessageReceiver processed the logout message successfully", true);
MatcherAssert.assertThat(e.getContent(), is(""));
}
}
Aggregations