Search in sources :

Example 6 with Response

use of org.apereo.cas.authentication.principal.Response in project cas by apereo.

the class GoogleAccountsServiceFactoryTests method verifyAuthnRequest.

@Test
public void verifyAuthnRequest() throws Exception {
    final MockHttpServletRequest request = new MockHttpServletRequest();
    final String samlRequest = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<samlp:AuthnRequest xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\" " + "ID=\"5545454455\" Version=\"2.0\" IssueInstant=\"Value\" " + "ProtocolBinding=\"urn:oasis:names.tc:SAML:2.0:bindings:HTTP-Redirect\" " + "ProviderName=\"https://localhost:8443/myRutgers\" AssertionConsumerServiceURL=\"https://localhost:8443/myRutgers\"/>";
    request.setParameter(SamlProtocolConstants.PARAMETER_SAML_REQUEST, encodeMessage(samlRequest));
    final GoogleAccountsService service = (GoogleAccountsService) this.factory.createService(request);
    service.setPrincipal(CoreAuthenticationTestUtils.getPrincipal());
    assertNotNull(service);
    final Response response = googleAccountsServiceResponseBuilder.build(service, "SAMPLE_TICKET");
    assertNotNull(response);
}
Also used : Response(org.apereo.cas.authentication.principal.Response) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) Test(org.junit.Test)

Example 7 with Response

use of org.apereo.cas.authentication.principal.Response in project cas by apereo.

the class RedirectToServiceAction method doExecute.

@Override
protected Event doExecute(final RequestContext requestContext) throws Exception {
    final WebApplicationService service = WebUtils.getService(requestContext);
    final String serviceTicketId = WebUtils.getServiceTicketFromRequestScope(requestContext);
    final Response response = responseBuilderLocator.locate(service).build(service, serviceTicketId);
    WebUtils.putServiceResponseIntoRequestScope(requestContext, response);
    WebUtils.putServiceOriginalUrlIntoRequestScope(requestContext, service);
    return new EventFactorySupport().event(this, response.getResponseType().name().toLowerCase());
}
Also used : Response(org.apereo.cas.authentication.principal.Response) WebApplicationService(org.apereo.cas.authentication.principal.WebApplicationService) EventFactorySupport(org.springframework.webflow.action.EventFactorySupport)

Aggregations

Response (org.apereo.cas.authentication.principal.Response)7 Test (org.junit.Test)6 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)3 IOException (java.io.IOException)2 AuthenticationResult (org.apereo.cas.authentication.AuthenticationResult)2 ZonedDateTime (java.time.ZonedDateTime)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 DefaultResponse (org.apereo.cas.authentication.principal.DefaultResponse)1 WebApplicationService (org.apereo.cas.authentication.principal.WebApplicationService)1 ParameterList (org.openid4java.message.ParameterList)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1 EventFactorySupport (org.springframework.webflow.action.EventFactorySupport)1