RemeberMe fix
This commit is contained in:
@@ -2,6 +2,7 @@ package org.maxkey.authn;
|
|||||||
|
|
||||||
import org.maxkey.authn.realm.AbstractAuthenticationRealm;
|
import org.maxkey.authn.realm.AbstractAuthenticationRealm;
|
||||||
import org.maxkey.authn.support.jwt.JwtLoginService;
|
import org.maxkey.authn.support.jwt.JwtLoginService;
|
||||||
|
import org.maxkey.authn.support.rememberme.AbstractRemeberMeService;
|
||||||
import org.maxkey.config.ApplicationConfig;
|
import org.maxkey.config.ApplicationConfig;
|
||||||
import org.maxkey.constants.LOGINTYPE;
|
import org.maxkey.constants.LOGINTYPE;
|
||||||
import org.maxkey.crypto.password.PasswordReciprocal;
|
import org.maxkey.crypto.password.PasswordReciprocal;
|
||||||
@@ -41,6 +42,10 @@ public abstract class AbstractAuthenticationProvider{
|
|||||||
@Autowired
|
@Autowired
|
||||||
@Qualifier("tfaOTPAuthn")
|
@Qualifier("tfaOTPAuthn")
|
||||||
protected AbstractOTPAuthn tfaOTPAuthn;
|
protected AbstractOTPAuthn tfaOTPAuthn;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
@Qualifier("remeberMeService")
|
||||||
|
protected AbstractRemeberMeService remeberMeService;
|
||||||
|
|
||||||
/* @Autowired
|
/* @Autowired
|
||||||
@Qualifier("jwtLoginService")
|
@Qualifier("jwtLoginService")
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import org.slf4j.LoggerFactory;
|
|||||||
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.web.authentication.WebAuthenticationDetails;
|
import org.springframework.security.web.authentication.WebAuthenticationDetails;
|
||||||
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -62,6 +64,10 @@ public class RealmAuthenticationProvider extends AbstractAuthenticationProvider
|
|||||||
if(auth.getJ_remeberme()!=null&&auth.getJ_remeberme().equals("remeberMe")){
|
if(auth.getJ_remeberme()!=null&&auth.getJ_remeberme().equals("remeberMe")){
|
||||||
WebContext.getSession().setAttribute(WebConstants.REMEBER_ME_SESSION,auth.getJ_username());
|
WebContext.getSession().setAttribute(WebConstants.REMEBER_ME_SESSION,auth.getJ_username());
|
||||||
_logger.debug("do Remeber Me");
|
_logger.debug("do Remeber Me");
|
||||||
|
remeberMeService.createRemeberMe(
|
||||||
|
userInfo.getUsername(),
|
||||||
|
WebContext.getRequest(),
|
||||||
|
((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getResponse());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ public class LoginEndpoint {
|
|||||||
//for RemeberMe login
|
//for RemeberMe login
|
||||||
if(!isAuthenticated){
|
if(!isAuthenticated){
|
||||||
if(applicationConfig.getLoginConfig().isRemeberMe()&&remeberMe!=null&& !remeberMe.equals("")){
|
if(applicationConfig.getLoginConfig().isRemeberMe()&&remeberMe!=null&& !remeberMe.equals("")){
|
||||||
|
_logger.debug("Try RemeberMe login ");
|
||||||
isAuthenticated=remeberMeService.login(remeberMe,response);
|
isAuthenticated=remeberMeService.login(remeberMe,response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,6 +110,7 @@ public class LoginEndpoint {
|
|||||||
if(applicationConfig.getLoginConfig().isKerberos()&&
|
if(applicationConfig.getLoginConfig().isKerberos()&&
|
||||||
kerberosUserDomain!=null&&!kerberosUserDomain.equals("")&&
|
kerberosUserDomain!=null&&!kerberosUserDomain.equals("")&&
|
||||||
kerberosToken!=null && !kerberosToken.equals("")){
|
kerberosToken!=null && !kerberosToken.equals("")){
|
||||||
|
_logger.debug("Try Kerberos login ");
|
||||||
isAuthenticated=kerberosService.login(kerberosToken,kerberosUserDomain);
|
isAuthenticated=kerberosService.login(kerberosToken,kerberosUserDomain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,6 +119,7 @@ public class LoginEndpoint {
|
|||||||
if(applicationConfig.getLoginConfig().isWsFederation()&&
|
if(applicationConfig.getLoginConfig().isWsFederation()&&
|
||||||
StringUtils.isNotEmpty(wsFederationWA) &&
|
StringUtils.isNotEmpty(wsFederationWA) &&
|
||||||
wsFederationWA.equalsIgnoreCase(WsFederationConstants.WSIGNIN)){
|
wsFederationWA.equalsIgnoreCase(WsFederationConstants.WSIGNIN)){
|
||||||
|
_logger.debug("Try WsFederation login ");
|
||||||
//isAuthenticated=wsFederationService.login(wsFederationWA,wsFederationWResult,request);
|
//isAuthenticated=wsFederationService.login(wsFederationWA,wsFederationWResult,request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,6 +138,7 @@ public class LoginEndpoint {
|
|||||||
//modelAndView.addObject("jwtToken",jwtLoginService.buildLoginJwt());
|
//modelAndView.addObject("jwtToken",jwtLoginService.buildLoginJwt());
|
||||||
//load Social Sign On Providers
|
//load Social Sign On Providers
|
||||||
if(applicationConfig.getLoginConfig().isSocialSignOn()){
|
if(applicationConfig.getLoginConfig().isSocialSignOn()){
|
||||||
|
_logger.debug("Load Social Sign On Providers ");
|
||||||
modelAndView.addObject("ssopList", socialSignOnProviderService.getSocialSignOnProviders());
|
modelAndView.addObject("ssopList", socialSignOnProviderService.getSocialSignOnProviders());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user