本文整理汇总了Java中com.mendix.core.Core.logout方法的典型用法代码示例。如果您正苦于以下问题:Java Core.logout方法的具体用法?Java Core.logout怎么用?Java Core.logout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mendix.core.Core
的用法示例。
在下文中一共展示了Core.logout方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: login
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);
}
}
示例2: logoff
import com.mendix.core.Core; //导入方法依赖的package包/类
private void logoff(IMxRuntimeRequest req, IMxRuntimeResponse resp) throws CoreException {
if (SINGLESIGNOFF_ENABLED) {
resp.addCookie(getSessionCookieName(), "", "/", "", 0, true);
resp.addCookie(SessionInitializer.XASID_COOKIE, "", "/", "", 0, true);
resp.setStatus(IMxRuntimeResponse.SEE_OTHER);
resp.addHeader("location", OPENID_PROVIDER + "/../" + LOGOFF);
} else {
ISession ses = this.getSessionFromRequest(req);
if (ses != null) {
Core.logout(ses);
}
redirect(resp, INDEX_PAGE);
}
}
示例3: executeAction
import com.mendix.core.Core; //导入方法依赖的package包/类
@Override
public java.lang.Boolean executeAction() throws Exception
{
// BEGIN USER CODE
Collection<? extends ISession> activeSessions = Core.getActiveSessions();
for (ISession session : activeSessions) {
if(session.getUser() != null && session.getUser().getName().equals(openId)) {
Core.logout(session);
}
}
return true;
// END USER CODE
}