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


Java ProfileManager.logout方法代码示例

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


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

示例1: destroyApplicationSession

import org.pac4j.core.profile.ProfileManager; //导入方法依赖的package包/类
/**
 * Destroy application session.
 * Also kills all delegated authn profiles via pac4j.
 *
 * @param request  the request
 * @param response the response
 */
protected void destroyApplicationSession(final HttpServletRequest request, final HttpServletResponse response) {
    LOGGER.debug("Destroying application session");
    final ProfileManager manager = WebUtils.getPac4jProfileManager(request, response);
    manager.logout();

    final HttpSession session = request.getSession();
    if (session != null) {
        session.invalidate();
    }
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:18,代码来源:TerminateSessionAction.java

示例2: perform

import org.pac4j.core.profile.ProfileManager; //导入方法依赖的package包/类
@Override
public R perform(final C context, final Config config, final HttpActionAdapter<R, C> httpActionAdapter,
                   final String defaultUrl, final String inputLogoutUrlPattern) {

    logger.debug("=== APP LOGOUT ===");

    // default value
    final String logoutUrlPattern;
    if (inputLogoutUrlPattern == null) {
        logoutUrlPattern = Pac4jConstants.DEFAULT_LOGOUT_URL_PATTERN_VALUE;
    } else {
        logoutUrlPattern = inputLogoutUrlPattern;
    }

    // checks
    assertNotNull("context", context);
    assertNotNull("config", config);
    assertNotNull("httpActionAdapter", httpActionAdapter);
    assertNotBlank(Pac4jConstants.LOGOUT_URL_PATTERN, logoutUrlPattern);

    // logic
    final ProfileManager manager = getProfileManager(context);
    manager.logout();
    postLogout(context);

    final String url = context.getRequestParameter(Pac4jConstants.URL);
    String redirectUrl = defaultUrl;
    if (url != null && Pattern.matches(logoutUrlPattern, url)) {
        redirectUrl = url;
    }
    logger.debug("redirectUrl: {}", redirectUrl);
    final HttpAction action;
    if (redirectUrl != null) {
        action = HttpAction.redirect("redirect", context, redirectUrl);
    } else {
        action = HttpAction.ok("ok", context);
    }

    return httpActionAdapter.adapt(action.getCode(), context);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:41,代码来源:DefaultApplicationLogoutLogic.java

示例3: destroySessionFront

import org.pac4j.core.profile.ProfileManager; //导入方法依赖的package包/类
@Override
public void destroySessionFront(VertxWebContext context, String ticket) {
    store.remove(ticket);

    final SessionStore sessionStore = context.getSessionStore();
    if (sessionStore == null) {
        logger.error("No session store available for this web context");
    } else {
        final String currentSessionId = sessionStore.getOrCreateSessionId(context);
        logger.debug("currentSessionId: {}", currentSessionId);
        final String sessionToTicket = (String) sessionStore.get(context, PAC4J_CAS_TICKET);
        logger.debug("-> ticket: {}", ticket);
        sessionStore.set(context, PAC4J_CAS_TICKET, null);

        if (CommonHelper.areEquals(ticket, sessionToTicket)) {

            // remove profiles
            final ProfileManager manager = profileManagerFactory.apply(context);
            manager.logout();
            logger.debug("destroy the user profiles");
            // and optionally the web session
            if (destroySession) {
                logger.debug("destroy the whole session");
                final boolean invalidated = sessionStore.destroySession(context);
                if (!invalidated) {
                    logger.error("The session has not been invalidated for front channel logout");
                }
            }
        } else {
            logger.error("The user profiles (and session) can not be destroyed for CAS front channel logout because the provided ticket is not the same as the one linked to the current session");
        }
    }
}
 
开发者ID:pac4j,项目名称:vertx-pac4j,代码行数:34,代码来源:VertxCasLogoutHandler.java


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