Search in sources :

Example 1 with SetServiceUnauthorizedRedirectUrlAction

use of org.apereo.cas.web.flow.login.SetServiceUnauthorizedRedirectUrlAction in project cas by apereo.

the class SetServiceUnauthorizedRedirectUrlActionTests method verifyOperation.

@Test
public void verifyOperation() throws Exception {
    val context = new MockRequestContext();
    val request = new MockHttpServletRequest();
    val response = new MockHttpServletResponse();
    context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, response));
    val action = new SetServiceUnauthorizedRedirectUrlAction(getServicesManager());
    val service = getWebApplicationServiceFactory().createService("https://github.com/apereo/cas");
    WebUtils.putRegisteredService(context, getServicesManager().findServiceBy(service));
    action.execute(context);
    assertNotNull(WebUtils.getUnauthorizedRedirectUrlFromFlowScope(context));
}
Also used : lombok.val(lombok.val) SetServiceUnauthorizedRedirectUrlAction(org.apereo.cas.web.flow.login.SetServiceUnauthorizedRedirectUrlAction) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) ServletExternalContext(org.springframework.webflow.context.servlet.ServletExternalContext) MockRequestContext(org.springframework.webflow.test.MockRequestContext) MockHttpServletResponse(org.springframework.mock.web.MockHttpServletResponse) MockServletContext(org.springframework.mock.web.MockServletContext) Test(org.junit.jupiter.api.Test)

Aggregations

lombok.val (lombok.val)1 SetServiceUnauthorizedRedirectUrlAction (org.apereo.cas.web.flow.login.SetServiceUnauthorizedRedirectUrlAction)1 Test (org.junit.jupiter.api.Test)1 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)1 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)1 MockServletContext (org.springframework.mock.web.MockServletContext)1 ServletExternalContext (org.springframework.webflow.context.servlet.ServletExternalContext)1 MockRequestContext (org.springframework.webflow.test.MockRequestContext)1