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.support.jwt.JwtLoginService;
|
||||
import org.maxkey.authn.support.rememberme.AbstractRemeberMeService;
|
||||
import org.maxkey.config.ApplicationConfig;
|
||||
import org.maxkey.constants.LOGINTYPE;
|
||||
import org.maxkey.crypto.password.PasswordReciprocal;
|
||||
@@ -41,6 +42,10 @@ public abstract class AbstractAuthenticationProvider{
|
||||
@Autowired
|
||||
@Qualifier("tfaOTPAuthn")
|
||||
protected AbstractOTPAuthn tfaOTPAuthn;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("remeberMeService")
|
||||
protected AbstractRemeberMeService remeberMeService;
|
||||
|
||||
/* @Autowired
|
||||
@Qualifier("jwtLoginService")
|
||||
|
||||
@@ -8,6 +8,8 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
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")){
|
||||
WebContext.getSession().setAttribute(WebConstants.REMEBER_ME_SESSION,auth.getJ_username());
|
||||
_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
|
||||
if(!isAuthenticated){
|
||||
if(applicationConfig.getLoginConfig().isRemeberMe()&&remeberMe!=null&& !remeberMe.equals("")){
|
||||
_logger.debug("Try RemeberMe login ");
|
||||
isAuthenticated=remeberMeService.login(remeberMe,response);
|
||||
}
|
||||
}
|
||||
@@ -109,6 +110,7 @@ public class LoginEndpoint {
|
||||
if(applicationConfig.getLoginConfig().isKerberos()&&
|
||||
kerberosUserDomain!=null&&!kerberosUserDomain.equals("")&&
|
||||
kerberosToken!=null && !kerberosToken.equals("")){
|
||||
_logger.debug("Try Kerberos login ");
|
||||
isAuthenticated=kerberosService.login(kerberosToken,kerberosUserDomain);
|
||||
}
|
||||
}
|
||||
@@ -117,6 +119,7 @@ public class LoginEndpoint {
|
||||
if(applicationConfig.getLoginConfig().isWsFederation()&&
|
||||
StringUtils.isNotEmpty(wsFederationWA) &&
|
||||
wsFederationWA.equalsIgnoreCase(WsFederationConstants.WSIGNIN)){
|
||||
_logger.debug("Try WsFederation login ");
|
||||
//isAuthenticated=wsFederationService.login(wsFederationWA,wsFederationWResult,request);
|
||||
}
|
||||
}
|
||||
@@ -135,6 +138,7 @@ public class LoginEndpoint {
|
||||
//modelAndView.addObject("jwtToken",jwtLoginService.buildLoginJwt());
|
||||
//load Social Sign On Providers
|
||||
if(applicationConfig.getLoginConfig().isSocialSignOn()){
|
||||
_logger.debug("Load Social Sign On Providers ");
|
||||
modelAndView.addObject("ssopList", socialSignOnProviderService.getSocialSignOnProviders());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user