use of org.pac4j.core.context.J2EContext in project pac4j by pac4j.
the class RedirectSAML2ClientTests method testAuthnContextClassRef.
@Test
public void testAuthnContextClassRef() {
final SAML2Client client = getClient();
client.getConfiguration().setComparisonType(AuthnContextComparisonTypeEnumeration.EXACT.toString());
client.getConfiguration().setAuthnContextClassRef("urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport");
final WebContext context = new J2EContext(new MockHttpServletRequest(), new MockHttpServletResponse());
final RedirectAction action = client.getRedirectAction(context);
final String checkClass = "<saml2p:RequestedAuthnContext Comparison=\"exact\"><saml2:AuthnContextClassRef " + "xmlns:saml2=\"urn:oasis:names:tc:SAML:2.0:assertion\">" + "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml2:AuthnContextClassRef>" + "</saml2p:RequestedAuthnContext>";
assertTrue(getInflatedAuthnRequest(action.getLocation()).contains(checkClass));
}
use of org.pac4j.core.context.J2EContext in project pac4j by pac4j.
the class DefaultCallbackLogicTests method setUp.
@Before
public void setUp() {
logic = new DefaultCallbackLogic<>();
request = new MockHttpServletRequest();
response = new MockHttpServletResponse();
context = new J2EContext(request, response);
config = new Config();
httpActionAdapter = (code, ctx) -> null;
defaultUrl = null;
renewSession = null;
clientFinder = new DefaultCallbackClientFinder();
}
Aggregations