java logout_Java Core.logout方法代码示例

java logout_Java Core.logout方法代码示例importcom mendix core Core 导入方法依赖的 package 包 类 privatevoidl IMxRuntimeRe IMxRuntimeRe throwsExcept Stringcontin req getParameter CONTINUATION PARAM detectCo

import com.mendix.core.Core; //导入方法依赖的package包/类

private void login(IMxRuntimeRequest req, IMxRuntimeResponse resp) throws Exception {

String continuation = req.getParameter(CONTINUATION_PARAM);

detectContinuationJsInjection(continuation);

//special case 1: already a valid session, do not bother with a new login

ISession session = this.getSessionFromRequest(req);

if (session != null && !session.getUser().isAnonymous()) {

//Logout old session and initialize new session. This will allow for role changes to take effect.

String userId = session.getUser().getName();

lockOpenID(userId);

try {

loginHandler.onCompleteLogin(userId, continuation, req, resp);

Core.logout(session);

} finally {

unlockOpenID(userId);

}

} else if (!started) {

//special case 2: no OpenID provider discovered

LOG.warn(“OpenId handler is in state ‘NOT STARTED’. Falling back to default login.html”);

redirect(resp, FALLBACK_LOGINPAGE);

} else {

LOG.debug(“Incoming login request, redirecting to OpenID provider”);

AuthRequest authReq = manager.authenticate(discovered, OPENID_RETURN_URL);

authReq.setImmediate(“true”.equalsIgnoreCase(req.getParameter(IMMEDIATE_PARAM)));

String url = authReq.getDestinationUrl(true);

//MWE: publish the url which can be used to sign off

if (SINGLESIGNOFF_ENABLED)

url += “&mxid2.logoffcallback=” + OpenIDUtils.urlEncode(OPENID_LOGOFF_URL);

if (continuation != null)

url += “&mxid2.continuation=” + OpenIDUtils.urlEncode(continuation);

redirect(resp, url);

}

}

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/205252.html原文链接:https://javaforall.net

(0)
上一篇 2026年3月19日 下午6:26
下一篇 2026年3月19日 下午6:27


相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号