Commit 987c3118 by shenjunjie

Merge branch 'feature' into 'dev'

权限部分调整4

See merge request !279
parents 322e7215 58e2301c
...@@ -2,7 +2,6 @@ package com.zhiwei.brandkbs2.auth; ...@@ -2,7 +2,6 @@ package com.zhiwei.brandkbs2.auth;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.zhiwei.brandkbs2.common.GenericAttribute; import com.zhiwei.brandkbs2.common.GenericAttribute;
import com.zhiwei.brandkbs2.enmus.RoleEnum;
import com.zhiwei.brandkbs2.model.CommonCodeEnum; import com.zhiwei.brandkbs2.model.CommonCodeEnum;
import com.zhiwei.brandkbs2.model.ResponseResult; import com.zhiwei.brandkbs2.model.ResponseResult;
import com.zhiwei.brandkbs2.pojo.UserInfo; import com.zhiwei.brandkbs2.pojo.UserInfo;
...@@ -56,18 +55,6 @@ public class AuthAspect { ...@@ -56,18 +55,6 @@ public class AuthAspect {
public Object around(ProceedingJoinPoint joinPoint) throws Throwable { public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
ServletRequestAttributes servletRequestAttributes = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()); ServletRequestAttributes servletRequestAttributes = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes());
HttpServletRequest request = servletRequestAttributes.getRequest(); HttpServletRequest request = servletRequestAttributes.getRequest();
Signature signature = joinPoint.getSignature();
Method method = ((MethodSignature) signature).getMethod();
Class<?> classTarget = joinPoint.getTarget().getClass();
// 优先使用方法权限
Auth auth = method.getAnnotation(Auth.class);
if (null == auth) {
auth = classTarget.getAnnotation(Auth.class);
}
// 不需要验证权限
if (null == auth || RoleEnum.NO_AUTHORISE == auth.role()) {
return joinPoint.proceed();
}
String token = request.getHeader(jwtKey); String token = request.getHeader(jwtKey);
// 存在有效token // 存在有效token
if (null != token && !Tools.tokenEmpty(token)) { if (null != token && !Tools.tokenEmpty(token)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment