IAM-base组件代码优化
This commit is contained in:
parent
44d591a17a
commit
adacf6f0d3
|
@ -54,28 +54,6 @@
|
|||
<version>2.0.4</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.8.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.60</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
-->
|
||||
<!-- 依赖shiro、JWT -->
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
|
|
|
@ -61,12 +61,7 @@ public class BindPermissionAspect {
|
|||
}
|
||||
BindPermission bindPermission = AnnotationUtils.getAnnotation(method, BindPermission.class);
|
||||
String annoPermissionCode = ":"+bindPermission.code();
|
||||
// 先看Class是否有BindPermission注解,如果有则拼接: 目前获取不到?
|
||||
//BindPermission parentAnno = AnnotationUtils.findAnnotation(method.getDeclaringClass(), BindPermission.class);
|
||||
//if(parentAnno != null){
|
||||
// annoPermissionCode = parentAnno.code() + ":" + annoPermissionCode;
|
||||
//}
|
||||
if(annoPermissionCode.endsWith(annoPermissionCode)){
|
||||
if(permissionCode.endsWith(annoPermissionCode)){
|
||||
try{
|
||||
IamSecurityUtils.getSubject().checkPermission(permissionCode);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public class AnnotationUtils extends org.springframework.core.annotation.Annotat
|
|||
String[] methodAndUrl = extractRequestMethodAndMappingUrl(method);
|
||||
String requestMethod = methodAndUrl[0], url = methodAndUrl[1];
|
||||
// 赋值权限和方法
|
||||
if(V.notEmpty(url)){
|
||||
if(V.notEmpty(requestMethod) && V.notEmpty(url)){
|
||||
for(String m : requestMethod.split(Cons.SEPARATOR_COMMA)){
|
||||
for(String u : url.split(Cons.SEPARATOR_COMMA)){
|
||||
if(V.notEmpty(controllerMappingUri)){
|
||||
|
@ -79,14 +79,20 @@ public class AnnotationUtils extends org.springframework.core.annotation.Annotat
|
|||
requestMethod = RequestMethod.PATCH.name();
|
||||
url = getNotEmptyStr(anno.value(), anno.path());
|
||||
}
|
||||
else if(method.getAnnotation(RequestMapping.class) != null){
|
||||
else if(AnnotationUtils.getAnnotation(method, RequestMapping.class) != null){
|
||||
RequestMapping anno = AnnotationUtils.getAnnotation(method, RequestMapping.class);
|
||||
if(V.notEmpty(anno.method())){
|
||||
List<String> methods = Arrays.stream(anno.method()).map(m -> m.name()).collect(Collectors.toList());
|
||||
requestMethod = S.join(methods);
|
||||
}
|
||||
else{
|
||||
requestMethod = "GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS,TRACE";
|
||||
}
|
||||
url = getNotEmptyStr(anno.value(), anno.path());
|
||||
}
|
||||
else{
|
||||
log.warn("无法识别到URL Mapping相关注解: "+method.getName());
|
||||
}
|
||||
return new String[]{requestMethod, url};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue