|
@@ -31,24 +31,21 @@ public class AuthUtils {
|
|
|
|
|
|
public static ServletRequestAttributes getRequestAttributes() {
|
|
|
RequestAttributes r = RequestContextHolder.currentRequestAttributes();
|
|
|
- return (ServletRequestAttributes) r;
|
|
|
+ return (ServletRequestAttributes) r;
|
|
|
}
|
|
|
|
|
|
public static HttpServletRequest getRequest() {
|
|
|
ServletRequestAttributes r = getRequestAttributes();
|
|
|
- return r == null ? null : r.getRequest();
|
|
|
+ return r.getRequest();
|
|
|
}
|
|
|
|
|
|
public static HttpServletResponse getResponse() {
|
|
|
ServletRequestAttributes r = getRequestAttributes();
|
|
|
- return r == null ? null : r.getResponse();
|
|
|
+ return r.getResponse();
|
|
|
}
|
|
|
|
|
|
public static String getToken() {
|
|
|
HttpServletRequest request = getRequest();
|
|
|
- if (request == null) {
|
|
|
- return null;
|
|
|
- }
|
|
|
return (String) request.getAttribute(AuthUtils.REQ_TOKEN);
|
|
|
}
|
|
|
public static Long getUserId() {
|
|
@@ -61,9 +58,6 @@ public class AuthUtils {
|
|
|
|
|
|
public static AuthUser getUser() {
|
|
|
HttpServletRequest request = getRequest();
|
|
|
- if (request == null) {
|
|
|
- return null;
|
|
|
- }
|
|
|
AuthUser user = null;
|
|
|
Object o = request.getAttribute(REQ_USER);
|
|
|
if (o != null) {
|