Providers

This commit is contained in:
MaxKey
2022-04-21 17:39:13 +08:00
parent 7bba47a46c
commit 0f7189c51d
5 changed files with 112 additions and 176 deletions

View File

@@ -21,8 +21,10 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import org.maxkey.authn.jwt.AuthJwtService; import org.maxkey.authn.jwt.AuthJwtService;
import org.maxkey.authn.online.OnlineTicket;
import org.maxkey.authn.online.OnlineTicketService; import org.maxkey.authn.online.OnlineTicketService;
import org.maxkey.authn.realm.AbstractAuthenticationRealm; import org.maxkey.authn.realm.AbstractAuthenticationRealm;
import org.maxkey.authn.web.AuthorizationUtils;
import org.maxkey.configuration.ApplicationConfig; import org.maxkey.configuration.ApplicationConfig;
import org.maxkey.constants.ConstsLoginType; import org.maxkey.constants.ConstsLoginType;
import org.maxkey.constants.ConstsStatus; import org.maxkey.constants.ConstsStatus;
@@ -39,6 +41,7 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.web.authentication.WebAuthenticationDetails;
/** /**
* login Authentication abstract class. * login Authentication abstract class.
* *
@@ -92,6 +95,7 @@ public abstract class AbstractAuthenticationProvider {
public Authentication authenticate(LoginCredential authentication){ public Authentication authenticate(LoginCredential authentication){
if(authentication.getAuthType().equalsIgnoreCase("trusted")) { if(authentication.getAuthType().equalsIgnoreCase("trusted")) {
//risk remove
return null; return null;
} }
AbstractAuthenticationProvider provider = providers.get(authentication.getAuthType() + PROVIDER_SUFFIX); AbstractAuthenticationProvider provider = providers.get(authentication.getAuthType() + PROVIDER_SUFFIX);
@@ -101,60 +105,64 @@ public abstract class AbstractAuthenticationProvider {
public Authentication authenticate(LoginCredential authentication,boolean trusted){ public Authentication authenticate(LoginCredential authentication,boolean trusted){
AbstractAuthenticationProvider provider = providers.get(AuthType.TRUSTED + PROVIDER_SUFFIX); AbstractAuthenticationProvider provider = providers.get(AuthType.TRUSTED + PROVIDER_SUFFIX);
return provider == null ? null : provider.doAuthenticate(authentication); return provider.doAuthenticate(authentication);
} }
public void addAuthenticationProvider(AbstractAuthenticationProvider provider) { public void addAuthenticationProvider(AbstractAuthenticationProvider provider) {
providers.put(provider.getProviderName(), provider); providers.put(provider.getProviderName(), provider);
} }
/**
* captcha validate .
*
* @param authType String
* @param captcha String
*/
protected void captchaValid(String captcha, String authType) {
// for basic
if (authType.equalsIgnoreCase(AuthType.NORMAL)) {
_logger.info("captcha : "
+ WebContext.getSession().getAttribute(
WebConstants.KAPTCHA_SESSION_KEY).toString());
if (captcha == null || !captcha
.equals(WebContext.getSession().getAttribute(
WebConstants.KAPTCHA_SESSION_KEY).toString())) {
String message = WebContext.getI18nValue("login.error.captcha");
_logger.debug("login captcha valid error.");
throw new BadCredentialsException(message);
}
}
}
/** /**
* captcha validate. * createOnlineSession
* * @param credential
* @param otpCaptcha String * @param userInfo
* @param authType String * @return
* @param userInfo UserInfo
*/ */
protected void tftcaptchaValid(String otpCaptcha, String authType, UserInfo userInfo) { public UsernamePasswordAuthenticationToken createOnlineTicket(LoginCredential credential,UserInfo userInfo) {
// for one time password 2 factor //Online Tickit
if (applicationConfig.getLoginConfig().isMfa() OnlineTicket onlineTicket = new OnlineTicket();
&& authType.equalsIgnoreCase(AuthType.TFA)) {
UserInfo validUserInfo = new UserInfo(); userInfo.setOnlineTicket(onlineTicket.getTicketId());
validUserInfo.setUsername(userInfo.getUsername());
validUserInfo.setSharedSecret(userInfo.getSharedSecret()); SigninPrincipal principal = new SigninPrincipal(userInfo);
validUserInfo.setSharedCounter(userInfo.getSharedCounter()); //set OnlineTicket
validUserInfo.setId(userInfo.getId()); principal.setOnlineTicket(onlineTicket);
if (otpCaptcha == null || !tfaOtpAuthn.validate(validUserInfo, otpCaptcha)) { ArrayList<GrantedAuthority> grantedAuthoritys = authenticationRealm.grantAuthority(userInfo);
String message = WebContext.getI18nValue("login.error.captcha"); principal.setAuthenticated(true);
_logger.debug("login captcha valid error.");
throw new BadCredentialsException(message); for(GrantedAuthority administratorsAuthority : grantedAdministratorsAuthoritys) {
if(grantedAuthoritys.contains(administratorsAuthority)) {
principal.setRoleAdministrators(true);
_logger.trace("ROLE ADMINISTRATORS Authentication .");
} }
} }
_logger.debug("Granted Authority {}" , grantedAuthoritys);
principal.setGrantedAuthorityApps(authenticationRealm.queryAuthorizedApps(grantedAuthoritys));
UsernamePasswordAuthenticationToken authenticationToken =
new UsernamePasswordAuthenticationToken(
principal,
"PASSWORD",
grantedAuthoritys
);
authenticationToken.setDetails(
new WebAuthenticationDetails(WebContext.getRequest()));
onlineTicket.setAuthentication(authenticationToken);
//store onlineTicket
this.onlineTicketServices.store(onlineTicket.getTicketId(), onlineTicket);
/*
* put Authentication to current session context
*/
AuthorizationUtils.setAuthentication(authenticationToken);
return authenticationToken;
} }
/** /**
* login user by j_username and j_cname first query user by j_cname if first * login user by j_username and j_cname first query user by j_cname if first
* step userinfo is null,query user from system. * step userinfo is null,query user from system.
@@ -255,24 +263,4 @@ public abstract class AbstractAuthenticationProvider {
return true; return true;
} }
public void setApplicationConfig(ApplicationConfig applicationConfig) {
this.applicationConfig = applicationConfig;
}
public void setAuthenticationRealm(AbstractAuthenticationRealm authenticationRealm) {
this.authenticationRealm = authenticationRealm;
}
public void setTfaOtpAuthn(AbstractOtpAuthn tfaOtpAuthn) {
this.tfaOtpAuthn = tfaOtpAuthn;
}
public void setOnlineTicketServices(OnlineTicketService onlineTicketServices) {
this.onlineTicketServices = onlineTicketServices;
}
public void setOtpAuthnService(OtpAuthnService otpAuthnService) {
this.otpAuthnService = otpAuthnService;
}
} }

View File

@@ -17,16 +17,11 @@
package org.maxkey.authn.provider; package org.maxkey.authn.provider;
import java.util.ArrayList;
import org.maxkey.authn.AbstractAuthenticationProvider; import org.maxkey.authn.AbstractAuthenticationProvider;
import org.maxkey.authn.LoginCredential; import org.maxkey.authn.LoginCredential;
import org.maxkey.authn.SigninPrincipal;
import org.maxkey.authn.jwt.AuthJwtService; import org.maxkey.authn.jwt.AuthJwtService;
import org.maxkey.authn.online.OnlineTicket;
import org.maxkey.authn.online.OnlineTicketService; import org.maxkey.authn.online.OnlineTicketService;
import org.maxkey.authn.realm.AbstractAuthenticationRealm; import org.maxkey.authn.realm.AbstractAuthenticationRealm;
import org.maxkey.authn.web.AuthorizationUtils;
import org.maxkey.configuration.ApplicationConfig; import org.maxkey.configuration.ApplicationConfig;
import org.maxkey.constants.ConstsLoginType; import org.maxkey.constants.ConstsLoginType;
import org.maxkey.entity.Institutions; import org.maxkey.entity.Institutions;
@@ -36,11 +31,10 @@ import org.maxkey.web.WebConstants;
import org.maxkey.web.WebContext; import org.maxkey.web.WebContext;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.web.authentication.WebAuthenticationDetails;
/** /**
@@ -84,10 +78,7 @@ public class MfaAuthenticationProvider extends AbstractAuthenticationProvider {
_logger.debug("authentication " + loginCredential); _logger.debug("authentication " + loginCredential);
Institutions inst = (Institutions)WebContext.getAttribute(WebConstants.CURRENT_INST); Institutions inst = (Institutions)WebContext.getAttribute(WebConstants.CURRENT_INST);
if(inst.getCaptchaSupport().equalsIgnoreCase("YES")) {
captchaValid(loginCredential.getCaptcha(),loginCredential.getAuthType());
}
emptyPasswordValid(loginCredential.getPassword()); emptyPasswordValid(loginCredential.getPassword());
UserInfo userInfo = null; UserInfo userInfo = null;
@@ -98,7 +89,7 @@ public class MfaAuthenticationProvider extends AbstractAuthenticationProvider {
statusValid(loginCredential , userInfo); statusValid(loginCredential , userInfo);
//mfa //mfa
tftcaptchaValid(loginCredential.getOtpCaptcha(),loginCredential.getAuthType(),userInfo); mfacaptchaValid(loginCredential.getOtpCaptcha(),userInfo);
//Validate PasswordPolicy //Validate PasswordPolicy
authenticationRealm.getPasswordPolicyValidator().passwordPolicyValid(userInfo); authenticationRealm.getPasswordPolicyValidator().passwordPolicyValid(userInfo);
@@ -109,7 +100,7 @@ public class MfaAuthenticationProvider extends AbstractAuthenticationProvider {
//apply PasswordSetType and resetBadPasswordCount //apply PasswordSetType and resetBadPasswordCount
authenticationRealm.getPasswordPolicyValidator().applyPasswordPolicy(userInfo); authenticationRealm.getPasswordPolicyValidator().applyPasswordPolicy(userInfo);
authenticationToken = createOnlineSession(loginCredential,userInfo); authenticationToken = createOnlineTicket(loginCredential,userInfo);
// user authenticated // user authenticated
_logger.debug("'{}' authenticated successfully by {}.", _logger.debug("'{}' authenticated successfully by {}.",
loginCredential.getPrincipal(), getProviderName()); loginCredential.getPrincipal(), getProviderName());
@@ -133,50 +124,30 @@ public class MfaAuthenticationProvider extends AbstractAuthenticationProvider {
return authenticationToken; return authenticationToken;
} }
public UsernamePasswordAuthenticationToken createOnlineSession(LoginCredential credential,UserInfo userInfo) { /**
//Online Tickit * captcha validate.
OnlineTicket onlineTicket = new OnlineTicket(); *
* @param otpCaptcha String
userInfo.setOnlineTicket(onlineTicket.getTicketId()); * @param authType String
* @param userInfo UserInfo
SigninPrincipal principal = new SigninPrincipal(userInfo); */
//set OnlineTicket protected void mfacaptchaValid(String otpCaptcha, UserInfo userInfo) {
principal.setOnlineTicket(onlineTicket); // for one time password 2 factor
ArrayList<GrantedAuthority> grantedAuthoritys = authenticationRealm.grantAuthority(userInfo); if (applicationConfig.getLoginConfig().isMfa()) {
principal.setAuthenticated(true); UserInfo validUserInfo = new UserInfo();
validUserInfo.setUsername(userInfo.getUsername());
for(GrantedAuthority administratorsAuthority : grantedAdministratorsAuthoritys) { validUserInfo.setSharedSecret(userInfo.getSharedSecret());
if(grantedAuthoritys.contains(administratorsAuthority)) { validUserInfo.setSharedCounter(userInfo.getSharedCounter());
principal.setRoleAdministrators(true); validUserInfo.setId(userInfo.getId());
_logger.trace("ROLE ADMINISTRATORS Authentication ."); if (otpCaptcha == null || !tfaOtpAuthn.validate(validUserInfo, otpCaptcha)) {
String message = WebContext.getI18nValue("login.error.captcha");
_logger.debug("login captcha valid error.");
throw new BadCredentialsException(message);
} }
} }
_logger.debug("Granted Authority {}" , grantedAuthoritys);
principal.setGrantedAuthorityApps(authenticationRealm.queryAuthorizedApps(grantedAuthoritys));
UsernamePasswordAuthenticationToken authenticationToken =
new UsernamePasswordAuthenticationToken(
principal,
"PASSWORD",
grantedAuthoritys
);
authenticationToken.setDetails(
new WebAuthenticationDetails(WebContext.getRequest()));
onlineTicket.setAuthentication(authenticationToken);
//store onlineTicket
this.onlineTicketServices.store(onlineTicket.getTicketId(), onlineTicket);
/*
* put Authentication to current session context
*/
AuthorizationUtils.setAuthentication(authenticationToken);
return authenticationToken;
} }
} }

View File

@@ -17,6 +17,7 @@
package org.maxkey.authn.provider; package org.maxkey.authn.provider;
import org.maxkey.authn.AbstractAuthenticationProvider;
import org.maxkey.authn.LoginCredential; import org.maxkey.authn.LoginCredential;
import org.maxkey.authn.online.OnlineTicketService; import org.maxkey.authn.online.OnlineTicketService;
import org.maxkey.authn.realm.AbstractAuthenticationRealm; import org.maxkey.authn.realm.AbstractAuthenticationRealm;
@@ -40,7 +41,7 @@ import org.springframework.security.core.AuthenticationException;
* @author Crystal.Sea * @author Crystal.Sea
* *
*/ */
public class MobileAuthenticationProvider extends NormalAuthenticationProvider { public class MobileAuthenticationProvider extends AbstractAuthenticationProvider {
private static final Logger _logger = private static final Logger _logger =
LoggerFactory.getLogger(MobileAuthenticationProvider.class); LoggerFactory.getLogger(MobileAuthenticationProvider.class);
@@ -67,7 +68,7 @@ public class MobileAuthenticationProvider extends NormalAuthenticationProvider {
} }
@Override @Override
public Authentication authenticate(LoginCredential loginCredential) { public Authentication doAuthenticate(LoginCredential loginCredential) {
UsernamePasswordAuthenticationToken authenticationToken = null; UsernamePasswordAuthenticationToken authenticationToken = null;
_logger.debug("Trying to authenticate user '{}' via {}", _logger.debug("Trying to authenticate user '{}' via {}",
loginCredential.getPrincipal(), getProviderName()); loginCredential.getPrincipal(), getProviderName());
@@ -86,12 +87,12 @@ public class MobileAuthenticationProvider extends NormalAuthenticationProvider {
//Validate PasswordPolicy //Validate PasswordPolicy
authenticationRealm.getPasswordPolicyValidator().passwordPolicyValid(userInfo); authenticationRealm.getPasswordPolicyValidator().passwordPolicyValid(userInfo);
mobilecaptchaValid(loginCredential.getPassword(),userInfo); mobileCaptchaValid(loginCredential.getPassword(),userInfo);
//apply PasswordSetType and resetBadPasswordCount //apply PasswordSetType and resetBadPasswordCount
authenticationRealm.getPasswordPolicyValidator().applyPasswordPolicy(userInfo); authenticationRealm.getPasswordPolicyValidator().applyPasswordPolicy(userInfo);
authenticationToken = createOnlineSession(loginCredential,userInfo); authenticationToken = createOnlineTicket(loginCredential,userInfo);
// user authenticated // user authenticated
_logger.debug("'{}' authenticated successfully by {}.", _logger.debug("'{}' authenticated successfully by {}.",
loginCredential.getPrincipal(), getProviderName()); loginCredential.getPrincipal(), getProviderName());
@@ -124,7 +125,7 @@ public class MobileAuthenticationProvider extends NormalAuthenticationProvider {
* @param authType String * @param authType String
* @param userInfo UserInfo * @param userInfo UserInfo
*/ */
protected void mobilecaptchaValid(String password, UserInfo userInfo) { protected void mobileCaptchaValid(String password, UserInfo userInfo) {
// for mobile password // for mobile password
if (applicationConfig.getLoginConfig().isMfa()) { if (applicationConfig.getLoginConfig().isMfa()) {
UserInfo validUserInfo = new UserInfo(); UserInfo validUserInfo = new UserInfo();

View File

@@ -17,16 +17,13 @@
package org.maxkey.authn.provider; package org.maxkey.authn.provider;
import java.util.ArrayList; import java.text.ParseException;
import org.apache.commons.lang3.StringUtils;
import org.maxkey.authn.AbstractAuthenticationProvider; import org.maxkey.authn.AbstractAuthenticationProvider;
import org.maxkey.authn.LoginCredential; import org.maxkey.authn.LoginCredential;
import org.maxkey.authn.SigninPrincipal;
import org.maxkey.authn.jwt.AuthJwtService; import org.maxkey.authn.jwt.AuthJwtService;
import org.maxkey.authn.online.OnlineTicket;
import org.maxkey.authn.online.OnlineTicketService; import org.maxkey.authn.online.OnlineTicketService;
import org.maxkey.authn.realm.AbstractAuthenticationRealm; import org.maxkey.authn.realm.AbstractAuthenticationRealm;
import org.maxkey.authn.web.AuthorizationUtils;
import org.maxkey.configuration.ApplicationConfig; import org.maxkey.configuration.ApplicationConfig;
import org.maxkey.constants.ConstsLoginType; import org.maxkey.constants.ConstsLoginType;
import org.maxkey.entity.Institutions; import org.maxkey.entity.Institutions;
@@ -36,11 +33,11 @@ import org.maxkey.web.WebConstants;
import org.maxkey.web.WebContext; import org.maxkey.web.WebContext;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.GrantedAuthority; import com.nimbusds.jwt.JWTClaimsSet;
import org.springframework.security.web.authentication.WebAuthenticationDetails;
/** /**
@@ -85,7 +82,7 @@ public class NormalAuthenticationProvider extends AbstractAuthenticationProvider
Institutions inst = (Institutions)WebContext.getAttribute(WebConstants.CURRENT_INST); Institutions inst = (Institutions)WebContext.getAttribute(WebConstants.CURRENT_INST);
if(inst.getCaptchaSupport().equalsIgnoreCase("YES")) { if(inst.getCaptchaSupport().equalsIgnoreCase("YES")) {
captchaValid(loginCredential.getCaptcha(),loginCredential.getAuthType()); captchaValid(loginCredential.getState(),loginCredential.getCaptcha());
} }
emptyPasswordValid(loginCredential.getPassword()); emptyPasswordValid(loginCredential.getPassword());
@@ -105,7 +102,7 @@ public class NormalAuthenticationProvider extends AbstractAuthenticationProvider
//apply PasswordSetType and resetBadPasswordCount //apply PasswordSetType and resetBadPasswordCount
authenticationRealm.getPasswordPolicyValidator().applyPasswordPolicy(userInfo); authenticationRealm.getPasswordPolicyValidator().applyPasswordPolicy(userInfo);
authenticationToken = createOnlineSession(loginCredential,userInfo); authenticationToken = createOnlineTicket(loginCredential,userInfo);
// user authenticated // user authenticated
_logger.debug("'{}' authenticated successfully by {}.", _logger.debug("'{}' authenticated successfully by {}.",
loginCredential.getPrincipal(), getProviderName()); loginCredential.getPrincipal(), getProviderName());
@@ -129,50 +126,28 @@ public class NormalAuthenticationProvider extends AbstractAuthenticationProvider
return authenticationToken; return authenticationToken;
} }
public UsernamePasswordAuthenticationToken createOnlineSession(LoginCredential credential,UserInfo userInfo) { /**
//Online Tickit * captcha validate .
OnlineTicket onlineTicket = new OnlineTicket(); *
* @param authType String
userInfo.setOnlineTicket(onlineTicket.getTicketId()); * @param captcha String
* @throws ParseException
SigninPrincipal principal = new SigninPrincipal(userInfo); */
//set OnlineTicket protected void captchaValid(String state ,String captcha) throws ParseException {
principal.setOnlineTicket(onlineTicket); // for basic
ArrayList<GrantedAuthority> grantedAuthoritys = authenticationRealm.grantAuthority(userInfo); JWTClaimsSet claim = authJwtService.resolve(state);
principal.setAuthenticated(true); if(claim == null) {
throw new BadCredentialsException(WebContext.getI18nValue("login.error.captcha"));
for(GrantedAuthority administratorsAuthority : grantedAdministratorsAuthoritys) { }
if(grantedAuthoritys.contains(administratorsAuthority)) { Object momentaryCaptcha = momentaryService.get("", claim.getJWTID());
principal.setRoleAdministrators(true); _logger.info("captcha : {} , momentary Captcha : {} " ,captcha, momentaryCaptcha);
_logger.trace("ROLE ADMINISTRATORS Authentication ."); if (StringUtils.isBlank(captcha) || !captcha.equals(momentaryCaptcha.toString())) {
} _logger.debug("login captcha valid error.");
throw new BadCredentialsException(WebContext.getI18nValue("login.error.captcha"));
} }
_logger.debug("Granted Authority {}" , grantedAuthoritys);
principal.setGrantedAuthorityApps(authenticationRealm.queryAuthorizedApps(grantedAuthoritys));
UsernamePasswordAuthenticationToken authenticationToken =
new UsernamePasswordAuthenticationToken(
principal,
"PASSWORD",
grantedAuthoritys
);
authenticationToken.setDetails(
new WebAuthenticationDetails(WebContext.getRequest()));
onlineTicket.setAuthentication(authenticationToken);
//store onlineTicket
this.onlineTicketServices.store(onlineTicket.getTicketId(), onlineTicket);
/*
* put Authentication to current session context
*/
AuthorizationUtils.setAuthentication(authenticationToken);
return authenticationToken;
} }
} }

View File

@@ -17,6 +17,7 @@
package org.maxkey.authn.provider; package org.maxkey.authn.provider;
import org.maxkey.authn.AbstractAuthenticationProvider;
import org.maxkey.authn.LoginCredential; import org.maxkey.authn.LoginCredential;
import org.maxkey.authn.online.OnlineTicketService; import org.maxkey.authn.online.OnlineTicketService;
import org.maxkey.authn.realm.AbstractAuthenticationRealm; import org.maxkey.authn.realm.AbstractAuthenticationRealm;
@@ -33,7 +34,7 @@ import org.springframework.security.core.Authentication;
* @author Crystal.Sea * @author Crystal.Sea
* *
*/ */
public class TrustedAuthenticationProvider extends NormalAuthenticationProvider { public class TrustedAuthenticationProvider extends AbstractAuthenticationProvider {
private static final Logger _logger = private static final Logger _logger =
LoggerFactory.getLogger(TrustedAuthenticationProvider.class); LoggerFactory.getLogger(TrustedAuthenticationProvider.class);
@@ -63,7 +64,7 @@ public class TrustedAuthenticationProvider extends NormalAuthenticationProvider
authenticationRealm.getPasswordPolicyValidator().passwordPolicyValid(loadeduserInfo); authenticationRealm.getPasswordPolicyValidator().passwordPolicyValid(loadeduserInfo);
//apply PasswordSetType and resetBadPasswordCount //apply PasswordSetType and resetBadPasswordCount
authenticationRealm.getPasswordPolicyValidator().applyPasswordPolicy(loadeduserInfo); authenticationRealm.getPasswordPolicyValidator().applyPasswordPolicy(loadeduserInfo);
Authentication authentication = createOnlineSession(loginCredential,loadeduserInfo); Authentication authentication = createOnlineTicket(loginCredential,loadeduserInfo);
authenticationRealm.insertLoginHistory( loadeduserInfo, authenticationRealm.insertLoginHistory( loadeduserInfo,
loginCredential.getAuthType(), loginCredential.getAuthType(),