当前位置: 首页>>代码示例>>Java>>正文


Java MutableAttributeMap类代码示例

本文整理汇总了Java中org.springframework.webflow.core.collection.MutableAttributeMap的典型用法代码示例。如果您正苦于以下问题:Java MutableAttributeMap类的具体用法?Java MutableAttributeMap怎么用?Java MutableAttributeMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MutableAttributeMap类属于org.springframework.webflow.core.collection包,在下文中一共展示了MutableAttributeMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: verifyStartAuthentication

import org.springframework.webflow.core.collection.MutableAttributeMap; //导入依赖的package包/类
@Test
public void verifyStartAuthentication() throws Exception {
    final MockHttpServletRequest mockRequest = new MockHttpServletRequest();
    mockRequest.setParameter(ThemeChangeInterceptor.DEFAULT_PARAM_NAME, MY_THEME);
    mockRequest.setParameter(LocaleChangeInterceptor.DEFAULT_PARAM_NAME, MY_LOCALE);
    mockRequest.setParameter(CasProtocolConstants.PARAMETER_METHOD, MY_METHOD);

    final MockHttpSession mockSession = new MockHttpSession();
    mockRequest.setSession(mockSession);

    final ServletExternalContext servletExternalContext = mock(ServletExternalContext.class);
    when(servletExternalContext.getNativeRequest()).thenReturn(mockRequest);

    final MockRequestContext mockRequestContext = new MockRequestContext();
    mockRequestContext.setExternalContext(servletExternalContext);
    mockRequestContext.getFlowScope().put(CasProtocolConstants.PARAMETER_SERVICE,
            org.jasig.cas.services.TestUtils.getService(MY_SERVICE));

    final FacebookClient facebookClient = new FacebookClient(MY_KEY, MY_SECRET);
    final TwitterClient twitterClient = new TwitterClient(MY_KEY, MY_SECRET);
    final Clients clients = new Clients(MY_LOGIN_URL, facebookClient, twitterClient);
    final ClientAction action = new ClientAction();
    action.setCentralAuthenticationService(mock(CentralAuthenticationService.class));
    action.setClients(clients);

    final Event event = action.execute(mockRequestContext);
    assertEquals("error", event.getId());
    assertEquals(MY_THEME, mockSession.getAttribute(ThemeChangeInterceptor.DEFAULT_PARAM_NAME));
    assertEquals(MY_LOCALE, mockSession.getAttribute(LocaleChangeInterceptor.DEFAULT_PARAM_NAME));
    assertEquals(MY_METHOD, mockSession.getAttribute(CasProtocolConstants.PARAMETER_METHOD));
    final MutableAttributeMap flowScope = mockRequestContext.getFlowScope();
    final Map<String, String> urls = (Map<String, String>) flowScope.get(ClientAction.PAC4J_URLS);
    assertTrue((urls.get("Facebook"))
            .startsWith("https://www.facebook.com/v2.2/dialog/oauth?client_id=my_key&redirect_uri=http%3A%2F%2Fcasserver%2Flogin%3F"
                    + Clients.DEFAULT_CLIENT_NAME_PARAMETER + "%3DFacebookClient&state="));
    assertEquals(MY_LOGIN_URL + '?' + Clients.DEFAULT_CLIENT_NAME_PARAMETER
            + "=TwitterClient&needs_client_redirection=true", urls.get("Twitter"));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:39,代码来源:ClientActionTests.java

示例2: verifyGetServiceThemeDoesNotExist

import org.springframework.webflow.core.collection.MutableAttributeMap; //导入依赖的package包/类
@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", org.jasig.cas.services.TestUtils.getService(r.getServiceId()));
    when(ctx.getFlowScope()).thenReturn(scope);
    RequestContextHolder.setRequestContext(ctx);
    request.addHeader("User-Agent", "Mozilla");
    assertEquals("test", this.serviceThemeResolver.resolveThemeName(request));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:20,代码来源:ServiceThemeResolverTests.java

示例3: verifyGetServiceThemeDoesNotExist

import org.springframework.webflow.core.collection.MutableAttributeMap; //导入依赖的package包/类
@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));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:20,代码来源:ServiceThemeResolverTests.java

示例4: verifyGetServiceThemeDoesNotExist

import org.springframework.webflow.core.collection.MutableAttributeMap; //导入依赖的package包/类
@Test
public void verifyGetServiceThemeDoesNotExist() {
    final RegexRegisteredService r = new RegexRegisteredService();
    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", RegisteredServiceTestUtils.getService(r.getServiceId()));
    when(ctx.getFlowScope()).thenReturn(scope);
    RequestContextHolder.setRequestContext(ctx);
    request.addHeader(WebUtils.USER_AGENT_HEADER, MOZILLA);
    assertEquals(DEFAULT_THEME_NAME, this.serviceThemeResolver.resolveThemeName(request));
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:20,代码来源:ServiceThemeResolverTests.java

示例5: doExecute

import org.springframework.webflow.core.collection.MutableAttributeMap; //导入依赖的package包/类
/** {@inheritDoc} */
@Override protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext,
        @Nonnull final ProfileInterceptorContext interceptorContext) {

    final RequestContext requestContext =
            RequestContextHolder.getRequestContext();

    final MutableAttributeMap<Object> flowScope =
            requestContext.getFlowScope();

    // full name?
    flowScope.put("userName",
            IdPHelper.getPrincipalName(profileRequestContext));

    log.debug("{} Decorated user name", getLogPrefix());
}
 
开发者ID:cmu-cylab-privacylens,项目名称:PrivacyLens,代码行数:17,代码来源:DecorateUserName.java

示例6: doExecute

import org.springframework.webflow.core.collection.MutableAttributeMap; //导入依赖的package包/类
/** {@inheritDoc} */
@Override protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext,
        @Nonnull final ProfileInterceptorContext interceptorContext) {

    final RequestContext requestContext =
            RequestContextHolder.getRequestContext();

    final MutableAttributeMap<Object> flowScope =
            requestContext.getFlowScope();

    final String relyingPartyId =
            IdPHelper.getRelyingPartyId(profileRequestContext);
    flowScope.put("service",
            Oracle.getInstance().getServiceName(relyingPartyId));
    flowScope.put("idpOrganization", General.getInstance().getOrganizationName());

    log.debug("{} Decorated other data", getLogPrefix());
}
 
开发者ID:cmu-cylab-privacylens,项目名称:PrivacyLens,代码行数:19,代码来源:DecorateOther.java

示例7: doExecute

import org.springframework.webflow.core.collection.MutableAttributeMap; //导入依赖的package包/类
/** {@inheritDoc} */
@Override protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext,
        @Nonnull final ProfileInterceptorContext interceptorContext) {

    final RequestContext requestContext =
            RequestContextHolder.getRequestContext();

    final MutableAttributeMap<Object> flowScope =
            requestContext.getFlowScope();
    flowScope.put("adminUrl", General.getInstance().getAdminUrl());
    flowScope.put("adminMail", General.getInstance().getAdminMail());
    flowScope.put("IdPName", General.getInstance().getIdpName());
    flowScope.put("credits", General.getInstance().getCredits());

    log.debug("{} Decorated general data", getLogPrefix());
}
 
开发者ID:cmu-cylab-privacylens,项目名称:PrivacyLens,代码行数:17,代码来源:DecorateGeneral.java

示例8: doExecute

import org.springframework.webflow.core.collection.MutableAttributeMap; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected void doExecute(
        @Nonnull final ProfileRequestContext profileRequestContext,
        @Nonnull final ProfileInterceptorContext interceptorContext) {

    final RequestContext requestContext =
            RequestContextHolder.getRequestContext();

    final MutableAttributeMap<Object> flowScope =
            requestContext.getFlowScope();

    final HttpServletRequest request =
            (HttpServletRequest) requestContext.getExternalContext()
                    .getNativeRequest();

    // CHANGEME use previous consents
    final List<Attribute> attributes =
            (List<Attribute>) flowScope.get("attributes");

    final String attributeList = getReminderAttributes(attributes);

    flowScope.put("attributeList", attributeList);

    log.debug("{} added reminder list", getLogPrefix());
}
 
开发者ID:cmu-cylab-privacylens,项目名称:PrivacyLens,代码行数:27,代码来源:ReminderAttributeService.java

示例9: getMultiFactorPrimaryPrincipal

import org.springframework.webflow.core.collection.MutableAttributeMap; //导入依赖的package包/类
/**
 * Gets the principal id.
 *
 * @param context the context
 * @return the principal id
 */
public static Principal getMultiFactorPrimaryPrincipal(final RequestContext context) {
    if (context != null) {
        final FlowSession flowSession = context.getFlowExecutionContext().getActiveSession();
        final MutableAttributeMap map = flowSession.getScope();
        final MultiFactorCredentials creds = (MultiFactorCredentials) map.get(CAS_MFA_CREDENTIALS_ATTR_NAME);

        if (creds == null || creds.getPrincipal() == null) {
            throw new IllegalArgumentException("Cannot locate credential object in the flow session map. Credentials missing...");
        }
        final Principal principalId = creds.getPrincipal();
        LOGGER.debug("Determined principal name to use [{}] for authentication", principalId.getId());
        return principalId;
    }
    throw new IllegalArgumentException("Request context could not be retrieved from the webflow.");
}
 
开发者ID:Unicon,项目名称:cas-mfa,代码行数:22,代码来源:MultiFactorRequestContextUtils.java

示例10: testStartBookingFlow

import org.springframework.webflow.core.collection.MutableAttributeMap; //导入依赖的package包/类
public void testStartBookingFlow() {
Booking booking = createTestBooking();

EasyMock.expect(bookingService.createBooking(1L, "keith")).andReturn(booking);

EasyMock.replay(bookingService);

MutableAttributeMap input = new LocalAttributeMap();
input.put("hotelId", "1");
MockExternalContext context = new MockExternalContext();
context.setCurrentUser("keith");
startFlow(input, context);

assertCurrentStateEquals("enterBookingDetails");
assertResponseWrittenEquals("enterBookingDetails", context);
assertTrue(getRequiredFlowAttribute("booking") instanceof Booking);

EasyMock.verify(bookingService);
   }
 
开发者ID:websphere,项目名称:SpringPrimeFacesShowcase,代码行数:20,代码来源:BookingFlowExecutionTests.java

示例11: sessionStarting

import org.springframework.webflow.core.collection.MutableAttributeMap; //导入依赖的package包/类
public void sessionStarting(RequestContext context, FlowSession session, MutableAttributeMap input) {
    boolean reusePersistenceContext = false;
    if (isParentPersistenceContext(session)) {
        if (isPersistenceContext(session.getDefinition())) {
            setHibernateSession(session, getHibernateSession(session.getParent()));
            reusePersistenceContext = true;
        } else {
            unbind(getHibernateSession(session.getParent()));
        }
    }
    if (isPersistenceContext(session.getDefinition()) && (!reusePersistenceContext)) {
        Session hibernateSession = createSession(context);
        setHibernateSession(session, hibernateSession);
        bind(hibernateSession);
    }
}
 
开发者ID:OpenHDS,项目名称:openhds-server,代码行数:17,代码来源:Hibernate4FlowExecutionListener.java

示例12: sessionEnding

import org.springframework.webflow.core.collection.MutableAttributeMap; //导入依赖的package包/类
public void sessionEnding(RequestContext context, FlowSession session, String outcome, MutableAttributeMap output) {
    if (isParentPersistenceContext(session)) {
        return;
    }
    if (isPersistenceContext(session.getDefinition())) {
        final Session hibernateSession = getHibernateSession(session);
        Boolean commitStatus = session.getState().getAttributes().getBoolean("commit");
        if (Boolean.TRUE.equals(commitStatus)) {
            transactionTemplate.execute(new TransactionCallbackWithoutResult() {
                protected void doInTransactionWithoutResult(TransactionStatus status) {
                    sessionFactory.getCurrentSession();
                    // nothing to do; a flush will happen on commit automatically as this is a read-write
                    // transaction
                }
            });
        }
        unbind(hibernateSession);
        hibernateSession.close();
    }
}
 
开发者ID:OpenHDS,项目名称:openhds-server,代码行数:21,代码来源:Hibernate4FlowExecutionListener.java

示例13: verifyStartAuthentication

import org.springframework.webflow.core.collection.MutableAttributeMap; //导入依赖的package包/类
@Test
public void verifyStartAuthentication() throws Exception {
    final MockHttpServletRequest mockRequest = new MockHttpServletRequest();
    mockRequest.setParameter(ClientAction.THEME, MY_THEME);
    mockRequest.setParameter(ClientAction.LOCALE, MY_LOCALE);
    mockRequest.setParameter(ClientAction.METHOD, MY_METHOD);

    final MockHttpSession mockSession = new MockHttpSession();
    mockRequest.setSession(mockSession);

    final ServletExternalContext servletExternalContext = mock(ServletExternalContext.class);
    when(servletExternalContext.getNativeRequest()).thenReturn(mockRequest);

    final MockRequestContext mockRequestContext = new MockRequestContext();
    mockRequestContext.setExternalContext(servletExternalContext);
    mockRequestContext.getFlowScope().put(ClientAction.SERVICE, new SimpleWebApplicationServiceImpl(MY_SERVICE));

    final FacebookClient facebookClient = new FacebookClient(MY_KEY, MY_SECRET);
    final TwitterClient twitterClient = new TwitterClient(MY_KEY, MY_SECRET);
    final Clients clients = new Clients(MY_LOGIN_URL, facebookClient, twitterClient);
    final ClientAction action = new ClientAction(mock(CentralAuthenticationService.class), clients);

    final Event event = action.execute(mockRequestContext);
    assertEquals("error", event.getId());
    assertEquals(MY_THEME, mockSession.getAttribute(ClientAction.THEME));
    assertEquals(MY_LOCALE, mockSession.getAttribute(ClientAction.LOCALE));
    assertEquals(MY_METHOD, mockSession.getAttribute(ClientAction.METHOD));
    final MutableAttributeMap flowScope = mockRequestContext.getFlowScope();
    assertTrue(((String) flowScope.get("FacebookClientUrl"))
            .startsWith("https://www.facebook.com/v2.2/dialog/oauth?client_id=my_key&redirect_uri=http%3A%2F%2Fcasserver%2Flogin%3F"
                    + Clients.DEFAULT_CLIENT_NAME_PARAMETER + "%3DFacebookClient&state="));
    assertEquals(MY_LOGIN_URL + "?" + Clients.DEFAULT_CLIENT_NAME_PARAMETER
            + "=TwitterClient&needs_client_redirection=true", flowScope.get("TwitterClientUrl"));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:35,代码来源:ClientActionTests.java

示例14: verifyFinishAuthentication

import org.springframework.webflow.core.collection.MutableAttributeMap; //导入依赖的package包/类
@Test
public void verifyFinishAuthentication() throws Exception {
    final MockHttpServletRequest mockRequest = new MockHttpServletRequest();
    mockRequest.setParameter(Clients.DEFAULT_CLIENT_NAME_PARAMETER, "FacebookClient");

    final MockHttpSession mockSession = new MockHttpSession();
    mockSession.setAttribute(ClientAction.THEME, MY_THEME);
    mockSession.setAttribute(ClientAction.LOCALE, MY_LOCALE);
    mockSession.setAttribute(ClientAction.METHOD, MY_METHOD);
    final Service service = new SimpleWebApplicationServiceImpl(MY_SERVICE);
    mockSession.setAttribute(ClientAction.SERVICE, service);
    mockRequest.setSession(mockSession);

    final ServletExternalContext servletExternalContext = mock(ServletExternalContext.class);
    when(servletExternalContext.getNativeRequest()).thenReturn(mockRequest);

    final MockRequestContext mockRequestContext = new MockRequestContext();
    mockRequestContext.setExternalContext(servletExternalContext);

    final FacebookClient facebookClient = new MockFacebookClient();
    final Clients clients = new Clients(MY_LOGIN_URL, facebookClient);

    final TicketGrantingTicket tgt = new TicketGrantingTicketImpl(TGT_ID, mock(Authentication.class), mock(ExpirationPolicy.class));
    final CentralAuthenticationService casImpl = mock(CentralAuthenticationService.class);
    when(casImpl.createTicketGrantingTicket(any(Credential.class))).thenReturn(tgt);
    final ClientAction action = new ClientAction(casImpl, clients);
    final Event event = action.execute(mockRequestContext);
    assertEquals("success", event.getId());
    assertEquals(MY_THEME, mockRequest.getAttribute(ClientAction.THEME));
    assertEquals(MY_LOCALE, mockRequest.getAttribute(ClientAction.LOCALE));
    assertEquals(MY_METHOD, mockRequest.getAttribute(ClientAction.METHOD));
    assertEquals(MY_SERVICE, mockRequest.getAttribute(ClientAction.SERVICE));
    final MutableAttributeMap flowScope = mockRequestContext.getFlowScope();
    final MutableAttributeMap requestScope = mockRequestContext.getRequestScope();
    assertEquals(service, flowScope.get(ClientAction.SERVICE));
    assertEquals(TGT_ID, flowScope.get(TGT_NAME));
    assertEquals(TGT_ID, requestScope.get(TGT_NAME));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:39,代码来源:ClientActionTests.java

示例15: verifyStartAuthentication

import org.springframework.webflow.core.collection.MutableAttributeMap; //导入依赖的package包/类
@Test
public void verifyStartAuthentication() throws Exception {
    final MockHttpServletResponse mockResponse = new MockHttpServletResponse();
    final MockHttpServletRequest mockRequest = new MockHttpServletRequest();
    mockRequest.setParameter(ThemeChangeInterceptor.DEFAULT_PARAM_NAME, MY_THEME);
    mockRequest.setParameter(LocaleChangeInterceptor.DEFAULT_PARAM_NAME, MY_LOCALE);
    mockRequest.setParameter(CasProtocolConstants.PARAMETER_METHOD, MY_METHOD);

    final MockHttpSession mockSession = new MockHttpSession();
    mockRequest.setSession(mockSession);

    final ServletExternalContext servletExternalContext = mock(ServletExternalContext.class);
    when(servletExternalContext.getNativeRequest()).thenReturn(mockRequest);
    when(servletExternalContext.getNativeResponse()).thenReturn(mockResponse);

    final MockRequestContext mockRequestContext = new MockRequestContext();
    mockRequestContext.setExternalContext(servletExternalContext);
    mockRequestContext.getFlowScope().put(CasProtocolConstants.PARAMETER_SERVICE,
            RegisteredServiceTestUtils.getService(MY_SERVICE));

    final FacebookClient facebookClient = new FacebookClient(MY_KEY, MY_SECRET);
    final TwitterClient twitterClient = new TwitterClient("3nJPbVTVRZWAyUgoUKQ8UA", "h6LZyZJmcW46Vu8R47MYfeXTSYGI30EqnWaSwVhFkbA");
    final Clients clients = new Clients(MY_LOGIN_URL, facebookClient, twitterClient);
    final DelegatedClientAuthenticationAction action = new DelegatedClientAuthenticationAction(clients,
            null, mock(CentralAuthenticationService.class),
            "theme", "locale", false);

    final Event event = action.execute(mockRequestContext);
    assertEquals("error", event.getId());
    assertEquals(MY_THEME, mockSession.getAttribute(ThemeChangeInterceptor.DEFAULT_PARAM_NAME));
    assertEquals(MY_LOCALE, mockSession.getAttribute(LocaleChangeInterceptor.DEFAULT_PARAM_NAME));
    assertEquals(MY_METHOD, mockSession.getAttribute(CasProtocolConstants.PARAMETER_METHOD));
    final MutableAttributeMap flowScope = mockRequestContext.getFlowScope();
    final Set<DelegatedClientAuthenticationAction.ProviderLoginPageConfiguration> urls =
            (Set<DelegatedClientAuthenticationAction.ProviderLoginPageConfiguration>) flowScope.get(DelegatedClientAuthenticationAction.PAC4J_URLS);

    assertFalse(urls.isEmpty());
    assertSame(2, urls.size());
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:40,代码来源:DelegatedClientAuthenticationActionTests.java


注:本文中的org.springframework.webflow.core.collection.MutableAttributeMap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。