|
|
@ -69,8 +69,16 @@ public class AuthFilter { |
|
|
|
// }
|
|
|
|
}); |
|
|
|
}).setError(e -> { |
|
|
|
if (e instanceof NotLoginException) { |
|
|
|
return SaResult.error(e.getMessage()).setCode(HttpStatus.UNAUTHORIZED); |
|
|
|
if (e instanceof NotLoginException notLoginException) { |
|
|
|
return switch (notLoginException.getType()) { |
|
|
|
case NotLoginException.INVALID_TOKEN -> |
|
|
|
SaResult.error(NotLoginException.INVALID_TOKEN_MESSAGE).setCode(HttpStatus.UNAUTHORIZED); |
|
|
|
case NotLoginException.TOKEN_TIMEOUT -> |
|
|
|
SaResult.error(NotLoginException.TOKEN_TIMEOUT_MESSAGE).setCode(HttpStatus.UNAUTHORIZED); |
|
|
|
case NotLoginException.TOKEN_FREEZE -> |
|
|
|
SaResult.error(NotLoginException.TOKEN_FREEZE_MESSAGE).setCode(HttpStatus.UNAUTHORIZED); |
|
|
|
default -> SaResult.error(e.getMessage()).setCode(HttpStatus.UNAUTHORIZED); |
|
|
|
}; |
|
|
|
} |
|
|
|
return SaResult.error("认证失败,无法访问系统资源").setCode(HttpStatus.UNAUTHORIZED); |
|
|
|
}); |
|
|
|