|
@@ -38,43 +38,38 @@ public class AuthenticationExceptionHandler {
|
|
Map map = new HashMap();
|
|
Map map = new HashMap();
|
|
//登录前的获取登录页面的请求接口不知道什么原因会抛出未认证(Full authentication is required to access this resource)
|
|
//登录前的获取登录页面的请求接口不知道什么原因会抛出未认证(Full authentication is required to access this resource)
|
|
//如果抛出未认证在这个调用这个服务接口返回消息
|
|
//如果抛出未认证在这个调用这个服务接口返回消息
|
|
|
|
+ //响应状态码统一为200
|
|
|
|
+ response.setStatus(HttpServletResponse.SC_OK);
|
|
if (matchers("/sys/user/getHospitalMark", request)) {
|
|
if (matchers("/sys/user/getHospitalMark", request)) {
|
|
map.put("code", "0");
|
|
map.put("code", "0");
|
|
map.put("msg", "");
|
|
map.put("msg", "");
|
|
map.put("data", userFacade.getHospitalMark());
|
|
map.put("data", userFacade.getHospitalMark());
|
|
- response.setStatus(HttpServletResponse.SC_OK);
|
|
|
|
} else if (authException instanceof BadCredentialsException) {
|
|
} else if (authException instanceof BadCredentialsException) {
|
|
map.put("code", "00000001");
|
|
map.put("code", "00000001");
|
|
map.put("msg", "用户或密码不正确");
|
|
map.put("msg", "用户或密码不正确");
|
|
- response.setStatus(HttpServletResponse.SC_OK);
|
|
|
|
} else if (authException instanceof AccountStatusException) {
|
|
} else if (authException instanceof AccountStatusException) {
|
|
- map.put("code", "00000001");
|
|
|
|
- map.put("msg", "户状态异常");
|
|
|
|
- response.setStatus(HttpServletResponse.SC_OK);
|
|
|
|
- } else if (authException instanceof AccountExpiredException) {
|
|
|
|
- map.put("code", "00000001");
|
|
|
|
- map.put("msg", "账户过期");
|
|
|
|
- response.setStatus(HttpServletResponse.SC_OK);
|
|
|
|
- } else if (authException instanceof CredentialsExpiredException) {//证书过期
|
|
|
|
- map.put("code", "10020011");
|
|
|
|
- map.put("msg", "登录超时。为确保您的账户安全,系统已自动退出,请重新登录。");
|
|
|
|
- response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
|
|
|
- } else if (authException instanceof DisabledException) {
|
|
|
|
- map.put("code", "00000001");
|
|
|
|
- map.put("msg", "账户不可用");
|
|
|
|
- response.setStatus(HttpServletResponse.SC_OK);
|
|
|
|
- } else if (authException instanceof LockedException) {
|
|
|
|
- map.put("code", "00000001");
|
|
|
|
- map.put("msg", "账户锁定");
|
|
|
|
- response.setStatus(HttpServletResponse.SC_OK);
|
|
|
|
|
|
+ if (authException instanceof LockedException) {
|
|
|
|
+ map.put("code", "00000001");
|
|
|
|
+ map.put("msg", "账户锁定");
|
|
|
|
+ } else if (authException instanceof AccountExpiredException) {//账户过期
|
|
|
|
+ map.put("code", "10020011");
|
|
|
|
+ map.put("msg", "登录超时。为确保您的账户安全,系统已自动退出,请重新登录。");
|
|
|
|
+ } else if (authException instanceof CredentialsExpiredException) {//证书过期
|
|
|
|
+ map.put("code", "10020011");
|
|
|
|
+ map.put("msg", "登录超时。为确保您的账户安全,系统已自动退出,请重新登录。");
|
|
|
|
+ } else if (authException instanceof DisabledException) {
|
|
|
|
+ map.put("code", "00000001");
|
|
|
|
+ map.put("msg", "账户不可用");
|
|
|
|
+ } else {
|
|
|
|
+ map.put("code", "00000001");
|
|
|
|
+ map.put("msg", "用户状态异常");
|
|
|
|
+ }
|
|
} else if (authException instanceof InsufficientAuthenticationException) {
|
|
} else if (authException instanceof InsufficientAuthenticationException) {
|
|
map.put("code", "10020011");
|
|
map.put("code", "10020011");
|
|
map.put("msg", "登录超时。为确保您的账户安全,系统已自动退出,请重新登录。");
|
|
map.put("msg", "登录超时。为确保您的账户安全,系统已自动退出,请重新登录。");
|
|
- response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
|
|
|
} else {
|
|
} else {
|
|
map.put("code", "00000001");
|
|
map.put("code", "00000001");
|
|
map.put("msg", authException.getMessage());
|
|
map.put("msg", authException.getMessage());
|
|
- response.setStatus(HttpServletResponse.SC_OK);
|
|
|
|
}
|
|
}
|
|
response.setContentType("application/json");
|
|
response.setContentType("application/json");
|
|
try {
|
|
try {
|