org.springframework.webflow.core.collection.LocalAttributeMap Java Examples

The following examples show how to use org.springframework.webflow.core.collection.LocalAttributeMap. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FrontChannelLogoutActionTests.java    From springboot-shiro-cas-mybatis with MIT License 6 votes vote down vote up
@Before
public void onSetUp() throws Exception {

    this.logoutManager = new LogoutManagerImpl(this.servicesManager,
            new SimpleHttpClientFactoryBean().getObject(), new SamlCompliantLogoutMessageCreator());
    this.frontChannelLogoutAction = new FrontChannelLogoutAction(this.logoutManager);

    this.request = new MockHttpServletRequest();
    this.response = new MockHttpServletResponse();
    this.requestContext = mock(RequestContext.class);
    final ServletExternalContext servletExternalContext = mock(ServletExternalContext.class);
    when(this.requestContext.getExternalContext()).thenReturn(servletExternalContext);
    when(servletExternalContext.getNativeRequest()).thenReturn(request);
    when(servletExternalContext.getNativeResponse()).thenReturn(response);
    final LocalAttributeMap flowScope = new LocalAttributeMap();
    when(this.requestContext.getFlowScope()).thenReturn(flowScope);
    final MockFlowExecutionKey mockFlowExecutionKey = new MockFlowExecutionKey(FLOW_EXECUTION_KEY);
    final MockFlowExecutionContext mockFlowExecutionContext = new MockFlowExecutionContext();
    mockFlowExecutionContext.setKey(mockFlowExecutionKey);
    when(this.requestContext.getFlowExecutionContext()).thenReturn(mockFlowExecutionContext);
}
 
Example #2
Source File: LogoutActionTests.java    From springboot-shiro-cas-mybatis with MIT License 6 votes vote down vote up
@Before
public void onSetUp() throws Exception {
    this.request = new MockHttpServletRequest();
    this.response = new MockHttpServletResponse();
    this.requestContext = mock(RequestContext.class);
    final ServletExternalContext servletExternalContext = mock(ServletExternalContext.class);
    when(this.requestContext.getExternalContext()).thenReturn(servletExternalContext);
    when(servletExternalContext.getNativeRequest()).thenReturn(request);
    when(servletExternalContext.getNativeResponse()).thenReturn(response);
    final LocalAttributeMap flowScope = new LocalAttributeMap();
    when(this.requestContext.getFlowScope()).thenReturn(flowScope);

    this.warnCookieGenerator = new CookieRetrievingCookieGenerator();
    this.serviceRegistryDao = new InMemoryServiceRegistryDaoImpl();
    this.serviceManager = new DefaultServicesManagerImpl(serviceRegistryDao);
    this.serviceManager.reload();

    this.warnCookieGenerator.setCookieName("test");

    this.ticketGrantingTicketCookieGenerator = new CookieRetrievingCookieGenerator();
    this.ticketGrantingTicketCookieGenerator.setCookieName(COOKIE_TGC_ID);

    this.logoutAction = new LogoutAction();
    this.logoutAction.setServicesManager(this.serviceManager);
}
 
Example #3
Source File: ServiceThemeResolverTests.java    From springboot-shiro-cas-mybatis with MIT License 6 votes vote down vote up
@Test
public void verifyGetServiceThemeDoesNotExist() {
    final RegisteredServiceImpl r = new RegisteredServiceImpl();
    r.setTheme("myTheme");
    r.setId(1000);
    r.setName("Test Service");
    r.setServiceId("myServiceId");

    this.servicesManager.save(r);

    final MockHttpServletRequest request = new MockHttpServletRequest();
    final RequestContext ctx = mock(RequestContext.class);
    final MutableAttributeMap scope = new LocalAttributeMap();
    scope.put("service", TestUtils.getService(r.getServiceId()));
    when(ctx.getFlowScope()).thenReturn(scope);
    RequestContextHolder.setRequestContext(ctx);
    request.addHeader("User-Agent", "Mozilla");
    assertEquals("test", this.serviceThemeResolver.resolveThemeName(request));
}
 
Example #4
Source File: FrontChannelLogoutActionTests.java    From cas4.0.x-server-wechat with Apache License 2.0 6 votes vote down vote up
@Before
public void onSetUp() throws Exception {
    final LogoutManager logoutManager = new LogoutManagerImpl(mock(ServicesManager.class),
            new SimpleHttpClient(), new SamlCompliantLogoutMessageCreator());
    this.frontChannelLogoutAction = new FrontChannelLogoutAction(logoutManager);

    this.request = new MockHttpServletRequest();
    this.response = new MockHttpServletResponse();
    this.requestContext = mock(RequestContext.class);
    final ServletExternalContext servletExternalContext = mock(ServletExternalContext.class);
    when(this.requestContext.getExternalContext()).thenReturn(servletExternalContext);
    when(servletExternalContext.getNativeRequest()).thenReturn(request);
    when(servletExternalContext.getNativeResponse()).thenReturn(response);
    final LocalAttributeMap flowScope = new LocalAttributeMap();
    when(this.requestContext.getFlowScope()).thenReturn(flowScope);
    final MockFlowExecutionKey mockFlowExecutionKey = new MockFlowExecutionKey(FLOW_EXECUTION_KEY);
    final MockFlowExecutionContext mockFlowExecutionContext = new MockFlowExecutionContext();
    mockFlowExecutionContext.setKey(mockFlowExecutionKey);
    when(this.requestContext.getFlowExecutionContext()).thenReturn(mockFlowExecutionContext);
}
 
Example #5
Source File: LogoutActionTests.java    From cas4.0.x-server-wechat with Apache License 2.0 6 votes vote down vote up
@Before
public void onSetUp() throws Exception {
    this.request = new MockHttpServletRequest();
    this.response = new MockHttpServletResponse();
    this.requestContext = mock(RequestContext.class);
    final ServletExternalContext servletExternalContext = mock(ServletExternalContext.class);
    when(this.requestContext.getExternalContext()).thenReturn(servletExternalContext);
    when(servletExternalContext.getNativeRequest()).thenReturn(request);
    when(servletExternalContext.getNativeResponse()).thenReturn(response);
    final LocalAttributeMap flowScope = new LocalAttributeMap();
    when(this.requestContext.getFlowScope()).thenReturn(flowScope);

    this.warnCookieGenerator = new CookieRetrievingCookieGenerator();
    this.serviceRegistryDao = new InMemoryServiceRegistryDaoImpl();
    this.serviceManager = new DefaultServicesManagerImpl(serviceRegistryDao);
    this.serviceManager.reload();

    this.warnCookieGenerator.setCookieName("test");

    this.ticketGrantingTicketCookieGenerator = new CookieRetrievingCookieGenerator();
    this.ticketGrantingTicketCookieGenerator.setCookieName(COOKIE_TGC_ID);

    this.logoutAction = new LogoutAction();
    this.logoutAction.setServicesManager(this.serviceManager);
}
 
Example #6
Source File: AddSoRPersonFlowTests.java    From openregistry with Apache License 2.0 5 votes vote down vote up
@Test
public void testStartFlow() {
    ReconciliationCriteria criteria = constructReconciliationCriteria(RUDYARD, KIPLING, null, EMAIL_ADDRESS, PHONE_NUMBER, new Date(0), OR_WEBAPP_IDENTIFIER);
    MutableAttributeMap input = new LocalAttributeMap();
    input.put("personSearch", criteria);
    ExternalContext context = new MockExternalContext();

    startFlow(context);
    assertCurrentStateEquals("addPerson");
}
 
Example #7
Source File: GenerateMultiFactorCredentialsAction.java    From cas-mfa with Apache License 2.0 5 votes vote down vote up
@Override
protected Event doExecute(final RequestContext context) {
    final FlowSession session = context.getFlowExecutionContext().getActiveSession();
    LOGGER.debug("Authentication has entered the flow [{}] executing state [{}",
            context.getActiveFlow().getId(), session.getState().getId());
    final Credential creds = WebUtils.getCredential(context);
    final String id = creds != null ? creds.getId() : null;

    final Credential mfaCreds = createCredentials(context, creds, id);
    final AttributeMap map = new LocalAttributeMap(ATTRIBUTE_ID_MFA_CREDENTIALS, mfaCreds);
    return new Event(this, EVENT_ID_SUCCESS, map);
}
 
Example #8
Source File: AuthenticationViaFormAction.java    From cas4.0.x-server-wechat with Apache License 2.0 4 votes vote down vote up
private Event newEvent(final String id, final Exception error) {
    return new Event(this, id, new LocalAttributeMap("error", error));
}
 
Example #9
Source File: AuthenticationViaFormAction.java    From taoshop with Apache License 2.0 2 votes vote down vote up
/**
 * New event based on the id, which contains an error attribute referring to the exception occurred.
 *
 * @param id the id
 * @param error the error
 * @return the event
 */
private Event newEvent(final String id, final Exception error) {
    return new Event(this, id, new LocalAttributeMap("error", error));
}
 
Example #10
Source File: AuthenticationViaFormAction.java    From springboot-shiro-cas-mybatis with MIT License 2 votes vote down vote up
/**
 * New event based on the id, which contains an error attribute referring to the exception occurred.
 *
 * @param id the id
 * @param error the error
 * @return the event
 */
private Event newEvent(final String id, final Exception error) {
    return new Event(this, id, new LocalAttributeMap("error", error));
}