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


Java MutableAttributeMap.get方法代码示例

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


在下文中一共展示了MutableAttributeMap.get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: 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

示例4: 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

示例5: putAttributeToFlowScope

import org.springframework.webflow.core.collection.MutableAttributeMap; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static <T> void putAttributeToFlowScope(String key, T value) {
    RequestContext requestContext = RequestContextHolder.getRequestContext();
    MutableAttributeMap<Object> attrMap = requestContext.getFlowScope();
    ArrayList<T> attr = (ArrayList<T>) attrMap.get(key);
    if (attr == null) {
        attrMap.put(key, new ArrayList<T>());
        attr = (ArrayList<T>) attrMap.get(key);
    }
    attr.add(value);
}
 
开发者ID:suewonjp,项目名称:civilizer,代码行数:12,代码来源:ViewUtil.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 HttpServletRequest request =
            (HttpServletRequest) requestContext.getExternalContext()
                    .getNativeRequest();
    final String requestContextPath = request.getContextPath();
    final Oracle oracle = Oracle.getInstance();

    final List<Attribute> attributes =
            (List<Attribute>) flowScope.get("attributes");

    final String relyingPartyId =
            IdPHelper.getRelyingPartyId(profileRequestContext);
    final Map<String, Boolean> settingsMap =
            (Map<String, Boolean>) flowScope.get("attributeSettings");
    final List<ToggleBean> toggleBeans =
            generateToggleFromAttributes(attributes, settingsMap, oracle,
                    relyingPartyId, requestContextPath);

    flowScope.put("attributeBeans", toggleBeans);

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

示例7: getAttributesFromFlowScope

import org.springframework.webflow.core.collection.MutableAttributeMap; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static <T> List<T> getAttributesFromFlowScope(String key) {
    RequestContext requestContext = RequestContextHolder.getRequestContext();
    MutableAttributeMap<Object> attrMap = requestContext.getFlowScope();
    return (List<T>) attrMap.get(key);
}
 
开发者ID:suewonjp,项目名称:civilizer,代码行数:7,代码来源:ViewUtil.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 AttributeReleaseModule arm =
            IdPHelper.getAttributeReleaseModule();
    final String relyingPartyId =
            IdPHelper.getRelyingPartyId(profileRequestContext);
    final String principalName =
            IdPHelper.getPrincipalName(profileRequestContext);

    final RequestContext requestContext =
            RequestContextHolder.getRequestContext();

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

    final List<Attribute> attributes =
            (List<Attribute>) flowScope.get("attributes");

    final ConsentContext consentContext = getConsentContext();

    final Map<String, Consent> consents =
            consentContext.getCurrentConsents();
    final ReminderContext reminderContext =
            consentContext.getReminderContext();

    try {
        final int remindAfter =
                reminderContext.getTargetReminder().getVisits();
        int currentCount = reminderContext.getCurrentReminder().getVisits();

        currentCount = currentCount % remindAfter;

        final ReminderInterval reminderInterval =
                new ReminderInterval(principalName, relyingPartyId,
                        remindAfter, currentCount);
        arm.updateReminderInterval(reminderInterval);
        log.debug("Stored reminder interval for principal: {} rpid: {}",
                principalName, relyingPartyId);

        final List<Attribute> consentedAttributes =
                new ArrayList<Attribute>();
        for (final Attribute attribute : attributes) {
            final String attributeId = attribute.getId();
            final Consent consent = consents.get(attributeId);
            if (consent == null || !consent.isApproved()) {
                continue;
            }
            consentedAttributes.add(attribute);
        }
        arm.consentAttributeRelease(principalName, relyingPartyId,
                consentedAttributes);
        log.debug("Stored consents for principal: {} rpid: {}",
                principalName, relyingPartyId);

    } catch (final Throwable e) {
        log.error("{} Unable to write consent to storage", getLogPrefix(),
                e);
    }

    log.debug("StoreConsent finished");
}
 
开发者ID:cmu-cylab-privacylens,项目名称:PrivacyLens,代码行数:64,代码来源:StoreConsent.java

示例9: doExecute

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

    // context: intercept/privacy-lens
    // key: stroucki:https://scalepriv.ece.cmu.edu/shibboleth
    final String context = getStorageContext();
    final String key = getStorageKey();

    try {

        final AttributeReleaseModule arm =
                IdPHelper.getAttributeReleaseModule();
        final String relyingPartyId =
                IdPHelper.getRelyingPartyId(profileRequestContext);
        final String principalName =
                IdPHelper.getPrincipalName(profileRequestContext);

        final RequestContext requestContext =
                RequestContextHolder.getRequestContext();

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

        final List<Attribute> attributes =
                (List<Attribute>) flowScope.get("attributes");

        final Map<String, Consent> consents =
                arm.getAttributeConsent(principalName, relyingPartyId,
                        attributes);
        /*
        final StorageRecord storageRecord = getStorageService().read(context, key);
        log.debug("{} Read storage record '{}' with context '{}' and key '{}'", getLogPrefix(), storageRecord,
                context, key);

        if (storageRecord == null) {
            log.debug("{} No storage record for context '{}' and key '{}'", getLogPrefix(), context, key);
            return;
        }

        final Map<String, Consent> consents =
                (Map<String, Consent>) storageRecord.getValue(getStorageSerializer(), context, key);
        */
        getConsentContext().getPreviousConsents().putAll(consents);
        log.debug("Added previous consents from storage");
        final ReminderInterval interval =
                arm.getReminderInterval(principalName, relyingPartyId);
        final ReminderContext reminderContext =
                getConsentContext().getReminderContext();
        final Reminder currentReminder =
                reminderContext.getCurrentReminder();
        final Reminder targetReminder = reminderContext.getTargetReminder();
        currentReminder.setVisits(interval.getCurrentCount());
        targetReminder.setVisits(interval.getRemindAfter());
        log.debug("Added reminder data from storage");
    } catch (final Throwable e) {
        log.error("{} Unable to read consent from storage", getLogPrefix(), e);
    }
}
 
开发者ID:cmu-cylab-privacylens,项目名称:PrivacyLens,代码行数:60,代码来源:ReadConsentFromStorage.java


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