mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-15 04:52:09 +08:00
WebConstants LOGIN_RESULT
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user