login fail message
This commit is contained in:
@@ -190,6 +190,11 @@ public class LoginEntryPoint {
|
||||
(Integer)WebContext.getAttribute(WebConstants.CURRENT_USER_PASSWORD_SET_TYPE));
|
||||
authJwtMessage = new Message<AuthJwt>(authJwt);
|
||||
|
||||
}else {//fail
|
||||
String errorMsg = WebContext.getAttribute(WebConstants.LOGIN_ERROR_SESSION_MESSAGE) == null ?
|
||||
"" : WebContext.getAttribute(WebConstants.LOGIN_ERROR_SESSION_MESSAGE).toString();
|
||||
authJwtMessage.setMessage(errorMsg);
|
||||
_logger.debug("login fail , message {}",errorMsg);
|
||||
}
|
||||
}else {
|
||||
_logger.error("Login AuthN type must eq normal , tfa or mobile . ");
|
||||
|
||||
@@ -81,12 +81,20 @@ public class LoginEntryPoint {
|
||||
|
||||
@RequestMapping(value={"/signin"}, produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||
public ResponseEntity<?> signin( @RequestBody LoginCredential loginCredential) {
|
||||
Message<AuthJwt> authJwtMessage = new Message<AuthJwt>(Message.FAIL);
|
||||
if(authTokenService.validateJwtToken(loginCredential.getState())){
|
||||
Authentication authentication = authenticationProvider.authenticate(loginCredential);
|
||||
AuthJwt authJwt = authTokenService.genAuthJwt(authentication);
|
||||
return new Message<AuthJwt>(authJwt).buildResponse();
|
||||
if(authentication != null) {
|
||||
AuthJwt authJwt = authTokenService.genAuthJwt(authentication);
|
||||
authJwtMessage = new Message<AuthJwt>(authJwt);
|
||||
}else {//fail
|
||||
String errorMsg = WebContext.getAttribute(WebConstants.LOGIN_ERROR_SESSION_MESSAGE) == null ?
|
||||
"" : WebContext.getAttribute(WebConstants.LOGIN_ERROR_SESSION_MESSAGE).toString();
|
||||
authJwtMessage.setMessage(Message.FAIL,errorMsg);
|
||||
_logger.debug("login fail , message {}",errorMsg);
|
||||
}
|
||||
}
|
||||
return new Message<AuthJwt>(Message.FAIL).buildResponse();
|
||||
return authJwtMessage.buildResponse();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user