Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
学习是不可能停的
micro-service-skeleton
提交
c77edac1
M
micro-service-skeleton
项目概览
学习是不可能停的
/
micro-service-skeleton
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
micro-service-skeleton
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c77edac1
编写于
10月 30, 2020
作者:
M
ManongJu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
动态权限校验
上级
21f4a911
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
4 addition
and
9 deletion
+4
-9
mss-gateway/src/main/java/com/microservice/skeleton/gateway/filter/AuthFilter.java
.../com/microservice/skeleton/gateway/filter/AuthFilter.java
+1
-6
other/db/zuul-auth.sql
other/db/zuul-auth.sql
+3
-3
未找到文件。
mss-gateway/src/main/java/com/microservice/skeleton/gateway/filter/AuthFilter.java
浏览文件 @
c77edac1
...
@@ -120,7 +120,6 @@ public class AuthFilter implements GlobalFilter , Ordered {
...
@@ -120,7 +120,6 @@ public class AuthFilter implements GlobalFilter , Ordered {
return
false
;
return
false
;
}
}
private
boolean
hasPermission
(
String
headerToken
,
String
path
){
private
boolean
hasPermission
(
String
headerToken
,
String
path
){
String
url
=
getRealUrl
(
path
);
try
{
try
{
if
(
StringUtils
.
isEmpty
(
headerToken
)){
if
(
StringUtils
.
isEmpty
(
headerToken
)){
return
false
;
return
false
;
...
@@ -140,16 +139,12 @@ public class AuthFilter implements GlobalFilter , Ordered {
...
@@ -140,16 +139,12 @@ public class AuthFilter implements GlobalFilter , Ordered {
return
false
;
return
false
;
}
}
List
<
Authority
>
authorities
=
JSON
.
parseArray
(
authStr
,
Authority
.
class
);
List
<
Authority
>
authorities
=
JSON
.
parseArray
(
authStr
,
Authority
.
class
);
return
authorities
.
stream
().
anyMatch
(
authority
->
antPathMatcher
.
match
(
authority
.
getAuthority
(),
url
));
return
authorities
.
stream
().
anyMatch
(
authority
->
antPathMatcher
.
match
(
authority
.
getAuthority
(),
path
));
}
catch
(
ParseException
e
)
{
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
return
false
;
return
false
;
}
}
private
String
getRealUrl
(
String
path
){
String
[]
splitUrl
=
path
.
split
(
"/"
);
return
path
.
replace
(
"/"
+
splitUrl
[
1
]
,
""
);
}
private
SignedJWT
getSignedJWT
(
String
headerToken
)
throws
ParseException
{
private
SignedJWT
getSignedJWT
(
String
headerToken
)
throws
ParseException
{
String
token
=
headerToken
.
replace
(
JWTConstants
.
TOKEN_PREFIX
,
""
);
String
token
=
headerToken
.
replace
(
JWTConstants
.
TOKEN_PREFIX
,
""
);
log
.
info
(
"token is {}"
,
token
);
log
.
info
(
"token is {}"
,
token
);
...
...
other/db/zuul-auth.sql
浏览文件 @
c77edac1
...
@@ -10,7 +10,7 @@ Target Server Type : MYSQL
...
@@ -10,7 +10,7 @@ Target Server Type : MYSQL
Target Server Version : 50628
Target Server Version : 50628
File Encoding : 65001
File Encoding : 65001
Date: 2020-10-
29 16:47:06
Date: 2020-10-
30 09:12:20
*/
*/
SET
FOREIGN_KEY_CHECKS
=
0
;
SET
FOREIGN_KEY_CHECKS
=
0
;
...
@@ -170,8 +170,8 @@ CREATE TABLE `sys_menu` (
...
@@ -170,8 +170,8 @@ CREATE TABLE `sys_menu` (
-- Records of sys_menu
-- Records of sys_menu
-- ----------------------------
-- ----------------------------
INSERT
INTO
`sys_menu`
VALUES
(
'1'
,
'order'
,
null
,
null
,
'订单管理'
,
null
,
'1'
,
null
,
null
,
null
,
null
,
null
,
null
);
INSERT
INTO
`sys_menu`
VALUES
(
'1'
,
'order'
,
null
,
null
,
'订单管理'
,
null
,
'1'
,
null
,
null
,
null
,
null
,
null
,
null
);
INSERT
INTO
`sys_menu`
VALUES
(
'2'
,
'order_list'
,
'order'
,
'1'
,
'订单列表查询'
,
'/order/list'
,
'2'
,
null
,
null
,
null
,
null
,
null
,
null
);
INSERT
INTO
`sys_menu`
VALUES
(
'2'
,
'order_list'
,
'order'
,
'1'
,
'订单列表查询'
,
'/
mss-upms/
order/list'
,
'2'
,
null
,
null
,
null
,
null
,
null
,
null
);
INSERT
INTO
`sys_menu`
VALUES
(
'3'
,
'order_detail'
,
'order'
,
'1'
,
'订单详情'
,
'/order/detail'
,
'2'
,
null
,
null
,
null
,
null
,
null
,
null
);
INSERT
INTO
`sys_menu`
VALUES
(
'3'
,
'order_detail'
,
'order'
,
'1'
,
'订单详情'
,
'/
mss-upms/
order/detail'
,
'2'
,
null
,
null
,
null
,
null
,
null
,
null
);
-- ----------------------------
-- ----------------------------
-- Table structure for sys_privilege
-- Table structure for sys_privilege
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录