Ejemplo n.º 1
0
 @Test
 public void testForceAuthIsSetForPostBinding() throws Exception {
   final SAML2Client client = getClient();
   client.getConfiguration().setForceAuth(true);
   final WebContext context =
       new J2EContext(new MockHttpServletRequest(), new MockHttpServletResponse());
   final RedirectAction action = client.getRedirectAction(context);
   assertTrue(getDecodedAuthnRequest(action.getContent()).contains("ForceAuthn=\"true\""));
 }
Ejemplo n.º 2
0
 @Test
 public void testSetComparisonTypeWithPostBinding() throws Exception {
   final SAML2Client client = getClient();
   client
       .getConfiguration()
       .setComparisonType(AuthnContextComparisonTypeEnumeration.EXACT.toString());
   final WebContext context =
       new J2EContext(new MockHttpServletRequest(), new MockHttpServletResponse());
   final RedirectAction action = client.getRedirectAction(context);
   assertTrue(getDecodedAuthnRequest(action.getContent()).contains("Comparison=\"exact\""));
 }
Ejemplo n.º 3
0
 @Test
 public void testRelayState() throws HttpAction {
   final SAML2Client client = getClient();
   final WebContext context =
       new J2EContext(new MockHttpServletRequest(), new MockHttpServletResponse());
   context.setSessionAttribute(SAML2Client.SAML_RELAY_STATE_ATTRIBUTE, "relayState");
   final RedirectAction action = client.getRedirectAction(context);
   assertTrue(
       action
           .getContent()
           .contains("<input type=\"hidden\" name=\"RelayState\" value=\"relayState\"/>"));
 }
Ejemplo n.º 4
0
 @Test
 public void testCustomSpEntityIdForPostBinding() throws Exception {
   final SAML2Client client = getClient();
   client.getConfiguration().setServiceProviderEntityId("http://localhost:8080/callback");
   final WebContext context =
       new J2EContext(new MockHttpServletRequest(), new MockHttpServletResponse());
   final RedirectAction action = client.getRedirectAction(context);
   assertTrue(
       getDecodedAuthnRequest(action.getContent())
           .contains(
               "<saml2:Issuer xmlns:saml2=\"urn:oasis:names:tc:SAML:2.0:assertion\">http://localhost:8080/callback</saml2:Issuer>"));
 }