RemeberMe fix

This commit is contained in:
shimingxy 2020-03-29 19:41:55 +08:00
parent 6e62782bc7
commit c70aa8df95
2 changed files with 3 additions and 7 deletions

View File

@ -1,7 +1,6 @@
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;
@ -47,10 +46,6 @@ public abstract class AbstractAuthenticationProvider{
@Qualifier("remeberMeService")
protected AbstractRemeberMeService remeberMeService;
/* @Autowired
@Qualifier("jwtLoginService")
JwtLoginService jwtLoginService;
*/
protected abstract String getProviderName();
protected abstract Authentication doInternalAuthenticate(Authentication authentication);

View File

@ -60,7 +60,9 @@ public class RealmAuthenticationProvider extends AbstractAuthenticationProvider
*/
WebContext.setUserInfo(userInfo);
if(applicationConfig.getLoginConfig().isRemeberMe()){
auth.setAuthenticated(true);
if(auth.isAuthenticated()&&applicationConfig.getLoginConfig().isRemeberMe()){
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");
@ -71,7 +73,6 @@ public class RealmAuthenticationProvider extends AbstractAuthenticationProvider
}
}
auth.setAuthenticated(true);
UsernamePasswordAuthenticationToken usernamePasswordAuthenticationToken =new UsernamePasswordAuthenticationToken(
auth,
"PASSWORD",