Kaynağa Gözat

RemeberMe fix

shimingxy 5 yıl önce
ebeveyn
işleme
c70aa8df95

+ 0 - 5
maxkey-core/src/main/java/org/maxkey/authn/AbstractAuthenticationProvider.java

@@ -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);

+ 3 - 2
maxkey-core/src/main/java/org/maxkey/authn/RealmAuthenticationProvider.java

@@ -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",