// non-WEB processing public UserSessionBase processStandaloneSuccessLogin(int authType, String ipAddress) { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); String currentLoginId = authentication.getName(); // Need to build the UserSession XXPortalUser gjUser = daoManager.getXXPortalUser().findByLoginId(currentLoginId); if (gjUser == null) { logger.error("Error getting user for loginId=" + currentLoginId, new Exception()); return null; } XXAuthSession gjAuthSession = new XXAuthSession(); gjAuthSession.setLoginId(currentLoginId); gjAuthSession.setUserId(gjUser.getId()); gjAuthSession.setAuthTime(DateUtil.getUTCDate()); gjAuthSession.setAuthStatus(XXAuthSession.AUTH_STATUS_SUCCESS); gjAuthSession.setAuthType(authType); gjAuthSession.setDeviceType(XACommonEnums.DEVICE_UNKNOWN); gjAuthSession.setExtSessionId(null); gjAuthSession.setRequestIP(ipAddress); gjAuthSession.setRequestUserAgent(null); gjAuthSession = storeAuthSession(gjAuthSession); UserSessionBase userSession = new UserSessionBase(); userSession.setXXPortalUser(gjUser); userSession.setXXAuthSession(gjAuthSession); // create context with user-session and set in thread-local XASecurityContext context = new XASecurityContext(); context.setUserSession(userSession); XAContextHolder.setSecurityContext(context); resetUserSessionForProfiles(userSession); return userSession; }