use of org.springframework.webflow.context.servlet.ServletExternalContext in project cas by apereo.
the class X509CertificateCredentialsNonInteractiveActionTests method verifyNoCredentialsResultsInError.
@Test
public void verifyNoCredentialsResultsInError() throws Exception {
final MockRequestContext context = new MockRequestContext();
context.setExternalContext(new ServletExternalContext(new MockServletContext(), new MockHttpServletRequest(), new MockHttpServletResponse()));
assertEquals("error", this.action.execute(context).getId());
}
use of org.springframework.webflow.context.servlet.ServletExternalContext in project cas by apereo.
the class X509CertificateCredentialsNonInteractiveActionTests method verifyCredentialsResultsInSuccess.
@Test
public void verifyCredentialsResultsInSuccess() throws Exception {
final MockRequestContext context = new MockRequestContext();
final MockHttpServletRequest request = new MockHttpServletRequest();
request.setAttribute("javax.servlet.request.X509Certificate", new X509Certificate[] { VALID_CERTIFICATE });
context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, new MockHttpServletResponse()));
assertEquals("success", this.action.execute(context).getId());
}
use of org.springframework.webflow.context.servlet.ServletExternalContext in project cas by apereo.
the class PrincipalFromRequestRemoteUserNonInteractiveCredentialsActionTests method verifyRemoteUserDoesntExists.
@Test
public void verifyRemoteUserDoesntExists() throws Exception {
final MockRequestContext context = new MockRequestContext();
context.setExternalContext(new ServletExternalContext(new MockServletContext(), new MockHttpServletRequest(), new MockHttpServletResponse()));
assertEquals("error", this.action.execute(context).getId());
}
use of org.springframework.webflow.context.servlet.ServletExternalContext in project cas by apereo.
the class PrincipalFromRequestUserPrincipalNonInteractiveCredentialsActionTests method verifyRemoteUserDoesntExists.
@Test
public void verifyRemoteUserDoesntExists() throws Exception {
final MockRequestContext context = new MockRequestContext();
context.setExternalContext(new ServletExternalContext(new MockServletContext(), new MockHttpServletRequest(), new MockHttpServletResponse()));
Assert.assertEquals("error", this.action.execute(context).getId());
}
use of org.springframework.webflow.context.servlet.ServletExternalContext in project cas by apereo.
the class OpenIdSingleSignOnActionTests method verifySuccessfulServiceTicket.
@Test
public void verifySuccessfulServiceTicket() throws Exception {
final MockRequestContext context = new MockRequestContext();
final MockHttpServletRequest request = new MockHttpServletRequest();
final Authentication authentication = CoreAuthenticationTestUtils.getAuthentication("scootman28");
final TicketGrantingTicket t = new TicketGrantingTicketImpl("TGT-11", authentication, new NeverExpiresExpirationPolicy());
this.ticketRegistry.addTicket(t);
request.setParameter(OpenIdProtocolConstants.OPENID_IDENTITY, "http://openid.aol.com/scootman28");
request.setParameter(OpenIdProtocolConstants.OPENID_RETURNTO, "http://www.cnn.com");
final OpenIdService service = new OpenIdServiceFactory("").createService(request);
context.getFlowScope().put("service", service);
context.getFlowScope().put("ticketGrantingTicketId", t.getId());
context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, new MockHttpServletResponse()));
assertEquals("success", this.action.execute(context).getId());
}
Aggregations