Forráskód Böngészése

WebConstants LOGIN_RESULT

MaxKey 3 éve
szülő
commit
05a27e987d

+ 6 - 3
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/AbstractAuthenticationProvider.java

@@ -116,8 +116,11 @@ public abstract class AbstractAuthenticationProvider {
         
         changeSession(authentication);
         
-        authenticationRealm.insertLoginHistory(
-                WebContext.getUserInfo(), ConstantsLoginType.LOCAL, "", "xe00000004", "success");
+        authenticationRealm.insertLoginHistory( WebContext.getUserInfo(), 
+						        				ConstantsLoginType.LOCAL, 
+								                "", 
+								                "xe00000004", 
+								                WebConstants.LOGIN_RESULT.SUCCESS);
         
         return authentication;
     }
@@ -331,7 +334,7 @@ public abstract class AbstractAuthenticationProvider {
             loginUser.setDisplayName("not exist");
             loginUser.setLoginCount(0);
             authenticationRealm.insertLoginHistory(loginUser, ConstantsLoginType.LOCAL, "",
-                    WebContext.getI18nValue("login.error.username"), "user not exist");
+                    WebContext.getI18nValue("login.error.username"),WebConstants.LOGIN_RESULT.USER_NOT_EXIST);
             throw new BadCredentialsException(WebContext.getI18nValue("login.error.username"));
         }
         return true;

+ 2 - 1
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/LoginCredential.java

@@ -20,6 +20,7 @@ package org.maxkey.authn;
 import java.util.ArrayList;
 import java.util.Collection;
 
+import org.maxkey.web.WebConstants;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.GrantedAuthority;
 
@@ -40,7 +41,7 @@ public class LoginCredential  implements Authentication {
     String onlineTicket;
     String provider;
     String code;
-    String message="SUCCESS";
+    String message = WebConstants.LOGIN_RESULT.SUCCESS;
     
     ArrayList<GrantedAuthority> grantedAuthority;
     boolean authenticated;

+ 2 - 1
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/httpheader/HttpHeaderEntryPoint.java

@@ -97,7 +97,8 @@ public class HttpHeaderEntryPoint implements AsyncHandlerInterceptor {
 			 isAuthenticated=false;
 		 }else {
 			 _logger.info("Security Authentication   not null . ");
-			 UsernamePasswordAuthenticationToken authenticationToken = (UsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
+			 UsernamePasswordAuthenticationToken authenticationToken = 
+					 (UsernamePasswordAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
 			 String lastSessionUserName = authenticationToken.getPrincipal().toString();
 			 _logger.info("Authentication Principal : " + lastSessionUserName);
 			 if (lastSessionUserName != null && !lastSessionUserName.equals(httpHeaderUsername)) {

+ 2 - 1
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/support/rememberme/HttpRemeberMeEntryPoint.java

@@ -95,7 +95,8 @@ public class HttpRemeberMeEntryPoint implements AsyncHandlerInterceptor {
 	        DateTime expiryDate = loginDate.plusSeconds(remeberMeService.getRemeberMeValidity());
 	        DateTime now = new DateTime();
 	        if (now.isBefore(expiryDate)) {
-	            LoginCredential loginCredential =new LoginCredential(storeRemeberMe.getUsername(),"",ConstantsLoginType.REMEBER_ME);
+	            LoginCredential loginCredential =
+	            		new LoginCredential(storeRemeberMe.getUsername(),"",ConstantsLoginType.REMEBER_ME);
 	            authenticationProvider.authentication(loginCredential,true);
 	            remeberMeService.updateRemeberMe(remeberMeCookie, response);
 	            _logger.debug("RemeberMe Logined in , username " + storeRemeberMe.getUsername());

+ 9 - 0
maxkey-core/src/main/java/org/maxkey/web/WebConstants.java

@@ -85,5 +85,14 @@ public class WebConstants {
     public static final  String ONLINE_TICKET_NAME = "online_ticket";
     
     public static final  String ONLINE_TICKET_PREFIX = "OT";
+    
+    public static final class LOGIN_RESULT{
+    	public static final  String SUCCESS 		= "success";
+    	public static final  String FAIL 			= "fail";
+    	public static final  String PASSWORD_ERROE 	= "password error";
+    	public static final  String USER_NOT_EXIST 	= "user not exist";
+    	
+    	
+    }
 
 }