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


Java FlowSession类代码示例

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


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

示例1: sessionEnded

import org.springframework.webflow.execution.FlowSession; //导入依赖的package包/类
@Override
public void sessionEnded(final RequestContext context, final FlowSession session, final String outcome,
                         final AttributeMap output) {

    if ( session.isRoot() ) {
        final HttpServletRequest request = WebUtils.getHttpServletRequest(context);
        // get session but don't create it if it doesn't already exist
        final HttpSession webSession = request.getSession(false);

        if (webSession != null) {
            LOGGER.debug("Terminate web session {} in {} seconds", webSession.getId(), this.timeToDieInSeconds);
            // set the web session to die in timeToDieInSeconds
            webSession.setMaxInactiveInterval(this.timeToDieInSeconds);
        }
    }
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:17,代码来源:TerminateWebSessionListener.java

示例2: getCredential

import org.springframework.webflow.execution.FlowSession; //导入依赖的package包/类
/**
 * Gets credential from the context.
 *
 * @param context the context
 * @return the credential, or null if it cant be found in the context or if it has no id.
 */
public static Credential getCredential(final RequestContext context) {
    final Credential cFromRequest = (Credential) context.getRequestScope().get(PARAMETER_CREDENTIAL);
    final Credential cFromFlow = (Credential) context.getFlowScope().get(PARAMETER_CREDENTIAL);

    Credential credential = cFromRequest != null ? cFromRequest : cFromFlow;

    if (credential == null) {
        final FlowSession session = context.getFlowExecutionContext().getActiveSession();
        credential = session.getScope().get(PARAMETER_CREDENTIAL, Credential.class);
    }
    if (credential != null && StringUtils.isBlank(credential.getId())) {
        return null;
    }
    return credential;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:22,代码来源:WebUtils.java

示例3: getMultiFactorPrimaryPrincipal

import org.springframework.webflow.execution.FlowSession; //导入依赖的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: createTicketGrantingTicket

import org.springframework.webflow.execution.FlowSession; //导入依赖的package包/类
/**
 * Creates the ticket granting ticket.
 *
 * @param authentication the authentication
 * @param context        the context
 * @param credentials    the credentials
 * @param messageContext the message context
 * @param id             the id
 * @return the event
 * @throws Exception the exception
 */
private Event createTicketGrantingTicket(final Authentication authentication, final RequestContext context,
                                         final Credential credentials, final MessageContext messageContext,
                                         final String id) throws Exception {

    final MultiFactorCredentials mfa = MultiFactorRequestContextUtils.getMfaCredentials(context);

    mfa.addAuthenticationToChain(authentication);
    mfa.getChainedCredentials().put(id, credentials);

    MultiFactorRequestContextUtils.setMfaCredentials(context, mfa);

    final TicketGrantingTicket tgt = this.cas.createTicketGrantingTicket(mfa);
    WebUtils.putTicketGrantingTicketInScopes(context, tgt);
    final FlowSession session = context.getFlowExecutionContext().getActiveSession();
    logger.debug("Located active webflow session {}", session.getDefinition().getId());
    session.getParent().getScope().put("ticketGrantingTicketId", tgt.getId());
    return getSuccessEvent(context);

}
 
开发者ID:Unicon,项目名称:cas-mfa,代码行数:31,代码来源:TerminatingMultiFactorAuthenticationViaFormAction.java

示例5: sessionStarting

import org.springframework.webflow.execution.FlowSession; //导入依赖的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

示例6: sessionEnding

import org.springframework.webflow.execution.FlowSession; //导入依赖的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

示例7: putTicketGrantingTicketInScopes

import org.springframework.webflow.execution.FlowSession; //导入依赖的package包/类
/**
 * Put ticket granting ticket in request and flow scopes.
 *
 * @param context     the context
 * @param ticketValue the ticket value
 */
public static void putTicketGrantingTicketInScopes(final RequestContext context, final String ticketValue) {
    putTicketGrantingTicketIntoMap(context.getRequestScope(), ticketValue);
    putTicketGrantingTicketIntoMap(context.getFlowScope(), ticketValue);

    FlowSession session = context.getFlowExecutionContext().getActiveSession().getParent();
    while (session != null) {
        putTicketGrantingTicketIntoMap(session.getScope(), ticketValue);
        session = session.getParent();
    }
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:17,代码来源:WebUtils.java

示例8: doExecute

import org.springframework.webflow.execution.FlowSession; //导入依赖的package包/类
@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);
}
 
开发者ID:Unicon,项目名称:cas-mfa,代码行数:13,代码来源:GenerateMultiFactorCredentialsAction.java

示例9: sessionEnded

import org.springframework.webflow.execution.FlowSession; //导入依赖的package包/类
public void sessionEnded(RequestContext context, FlowSession session, String outcome, AttributeMap output) {
    if (isParentPersistenceContext(session)) {
        if (!isPersistenceContext(session.getDefinition())) {
            bind(getHibernateSession(session.getParent()));
        }
    }
}
 
开发者ID:OpenHDS,项目名称:openhds-server,代码行数:8,代码来源:Hibernate4FlowExecutionListener.java

示例10: isParentPersistenceContext

import org.springframework.webflow.execution.FlowSession; //导入依赖的package包/类
private boolean isParentPersistenceContext(FlowSession flowSession) {
    return ((!flowSession.isRoot()) && isPersistenceContext(flowSession.getParent().getDefinition()));
}
 
开发者ID:OpenHDS,项目名称:openhds-server,代码行数:4,代码来源:Hibernate4FlowExecutionListener.java

示例11: getHibernateSession

import org.springframework.webflow.execution.FlowSession; //导入依赖的package包/类
private Session getHibernateSession(FlowSession session) {
    return (Session) session.getScope().get(PERSISTENCE_CONTEXT_ATTRIBUTE);
}
 
开发者ID:OpenHDS,项目名称:openhds-server,代码行数:4,代码来源:Hibernate4FlowExecutionListener.java

示例12: setHibernateSession

import org.springframework.webflow.execution.FlowSession; //导入依赖的package包/类
private void setHibernateSession(FlowSession session, Session hibernateSession) {
    session.getScope().put(PERSISTENCE_CONTEXT_ATTRIBUTE, hibernateSession);
}
 
开发者ID:OpenHDS,项目名称:openhds-server,代码行数:4,代码来源:Hibernate4FlowExecutionListener.java


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