本文整理汇总了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();
}
}
示例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);
}
示例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");
}
}
}