本文整理汇总了Java中com.mendix.core.Core.initializeSession方法的典型用法代码示例。如果您正苦于以下问题:Java Core.initializeSession方法的具体用法?Java Core.initializeSession怎么用?Java Core.initializeSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mendix.core.Core
的用法示例。
在下文中一共展示了Core.initializeSession方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeSessionForUser
import com.mendix.core.Core; //导入方法依赖的package包/类
private static ISession initializeSessionForUser(IContext context, String username) throws CoreException {
IUser user = Core.getUser(context, username);
if (user == null) {
throw new RuntimeException("Assertion: user with username '" + username + "' does not exist");
}
return Core.initializeSession(user, null);
}
示例2: createSessionForUser
import com.mendix.core.Core; //导入方法依赖的package包/类
/**
* Given a username, starts a new session for the user and redirects back to index.html.
* If no matching account is found for the user, a new account will be created automatically.
* @param resp
* @param req
* @param user
* @return
* @throws CoreException
* @throws IOException
* @throws NoSuchMethodException
* @throws SecurityException
*/
static public ISession createSessionForUser(IMxRuntimeResponse resp,
IMxRuntimeRequest req, IUser user) throws Exception {
LOG.info("User " + user.getName() + " authenticated. Starting session..");
String sessionid = req.getCookie(XAS_SESSION_ID);
ISession session = Core.initializeSession(user, sessionid);
// Used to enable Single Sign Off request (from remote sso *server*); must only sign off user in a particular User Agent / Browser
String ua = req.getHeader("User-Agent");
session.setUserAgent(ua);
if (LOG.isDebugEnabled())
LOG.debug("Created session, fingerprint: " + OpenIDUtils.getFingerPrint(session));
writeSessionCookies(resp, session);
return session;
}