|
@ -479,7 +479,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
|
|
|
}
|
|
|
/*如果是移动端登陆则移除之前的token,
|
|
|
在网关处通过HTTP状态码告知前端是过期(402)还是账号在别处登陆(403),
|
|
|
在网关处通过HTTP状态码告知前端是过期 还是账号在别处登陆
|
|
|
实现同一账号只能在一处登陆*/
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
if (request.getHeader("login-device") != null && request.getHeader("login-device").equals("mobile")) {
|
|
@ -555,13 +555,13 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
public ResponseEntity<Oauth2Envelop> handleException(Exception e) throws Exception {
|
|
|
LOG.debug(e.getMessage(), e);
|
|
|
if (e instanceof UsernameNotFoundException) {
|
|
|
return handleOAuth2Exception(new Oauth2Envelop("用户不存在!", ResultStatus.USER_NO_EXIST), e);
|
|
|
return handleOAuth2Exception(new Oauth2Envelop("账号或者密码错误!", ResultStatus.INVALID_GRANT), e);
|
|
|
} else if (e instanceof NoSuchClientException) {
|
|
|
return handleOAuth2Exception(new Oauth2Envelop("应用未注册!", ResultStatus.APP_NO_EXIST), e);
|
|
|
} else if (e instanceof InvalidGrantException) {
|
|
|
return handleOAuth2Exception(new Oauth2Envelop("应用未注册!", ResultStatus.INVALID_GRANT), e);
|
|
|
} else if (e instanceof InvalidGrantException || e instanceof UsernameNotFoundException) {
|
|
|
return handleOAuth2Exception(new Oauth2Envelop(invalidGrantMessage((InvalidGrantException)e), ResultStatus.INVALID_GRANT), e);
|
|
|
} else if (e instanceof InvalidTokenException) {
|
|
|
return handleOAuth2Exception(new Oauth2Envelop("Token有误/过期!", ResultStatus.ERROR_TOKEN), e);
|
|
|
return handleOAuth2Exception(new Oauth2Envelop("Token过期!", ResultStatus.EXPIRE), e);
|
|
|
} else if (e instanceof InvalidRequestException) {
|
|
|
return handleOAuth2Exception(new Oauth2Envelop("参数" + e.getMessage() + "缺失!", ResultStatus.ERROR_PARA), e);
|
|
|
} else if (e instanceof IllegalAccessException) {
|