use of org.pac4j.core.exception.http.OkAction in project pac4j by pac4j.
the class PostSAML2ClientTests method testSetComparisonTypeWithPostBinding.
@Test
public void testSetComparisonTypeWithPostBinding() {
final var client = getClient();
client.getConfiguration().setComparisonType(AuthnContextComparisonTypeEnumeration.EXACT.toString());
final var action = (OkAction) client.getRedirectionAction(MockWebContext.create(), new MockSessionStore()).get();
assertTrue(getDecodedAuthnRequest(action.getContent()).contains("Comparison=\"exact\""));
}
use of org.pac4j.core.exception.http.OkAction in project pac4j by pac4j.
the class PostSAML2ClientTests method testStandardSpEntityIdForPostBinding.
@Test
public void testStandardSpEntityIdForPostBinding() {
final var client = getClient();
client.getConfiguration().setServiceProviderEntityId("http://localhost:8080/cb");
final var action = (OkAction) client.getRedirectionAction(MockWebContext.create(), new MockSessionStore()).get();
final var issuerJdk11 = "<saml2:Issuer " + "xmlns:saml2=\"urn:oasis:names:tc:SAML:2.0:assertion\" " + "Format=\"urn:oasis:names:tc:SAML:2.0:nameid-format:entity\">http://localhost:8080/cb</saml2:Issuer>";
final var decodedAuthnRequest = getDecodedAuthnRequest(action.getContent());
assertTrue(decodedAuthnRequest.contains(issuerJdk11));
}
use of org.pac4j.core.exception.http.OkAction 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