Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
polysoft-nafmii
/
polysoft-parent
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 7c50c135
authored
Apr 25, 2021
by
zhoujinghao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
jwt修改
1 parent
a961ffd9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
17 deletions
nafmii-gateway/pom.xml
nafmii-gateway/src/main/java/org/nafmii/config/AccessFilter.java
nafmii-gateway/pom.xml
View file @
7c50c13
...
@@ -27,16 +27,12 @@
...
@@ -27,16 +27,12 @@
<dependency>
<dependency>
<groupId>
org.nafmii
</groupId>
<groupId>
org.nafmii
</groupId>
<artifactId>
nafmii-common
</artifactId>
<artifactId>
nafmii-common
</artifactId>
</dependency>
<exclusions>
<!-- 去掉springboot默认配置 -->
<dependency>
<exclusion>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<artifactId>
spring-boot-starter-web
</artifactId>
<!--<exclusions><!– 去掉springboot默认配置 –>-->
</exclusion>
<!--<exclusion>-->
</exclusions>
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-starter-logging</artifactId>-->
<!--</exclusion>-->
<!--</exclusions>-->
</dependency>
</dependency>
</dependencies>
</dependencies>
...
...
nafmii-gateway/src/main/java/org/nafmii/config/AccessFilter.java
View file @
7c50c13
...
@@ -33,19 +33,17 @@ public class AccessFilter implements GlobalFilter, Ordered {
...
@@ -33,19 +33,17 @@ public class AccessFilter implements GlobalFilter, Ordered {
@Autowired
@Autowired
private
AntPathMatcher
antPathMatcher
;
//路径匹配器
private
AntPathMatcher
antPathMatcher
;
//路径匹配器
@Override
@Override
public
Mono
<
Void
>
filter
(
ServerWebExchange
exchange
,
GatewayFilterChain
chain
)
{
public
Mono
<
Void
>
filter
(
ServerWebExchange
exchange
,
GatewayFilterChain
chain
)
{
String
url
=
exchange
.
getRequest
().
getURI
().
getPath
();
String
url
=
exchange
.
getRequest
().
getURI
().
getPath
();
List
<
String
>
skipAuthUrls
=
new
ArrayList
<>();
//相关不需要的接口地址
//相关不需要的接口地址
skipAuthUrls
.
add
(
"111111"
)
;
String
skip
=
"app/nafmii/**"
;
//跳过不需要验证的url
//跳过不需要验证的url
for
(
String
skip
:
skipAuthUrls
)
{
if
(
antPathMatcher
.
match
(
skip
,
url
)){
if
(
antPathMatcher
.
match
(
skip
,
url
)){
return
chain
.
filter
(
exchange
);
return
chain
.
filter
(
exchange
);
}
}
}
//获取token
//获取token
String
token
=
exchange
.
getRequest
().
getHeaders
().
getFirst
(
JwtUtils
.
TOKEN_HEADER
);
String
token
=
exchange
.
getRequest
().
getHeaders
().
getFirst
(
JwtUtils
.
TOKEN_HEADER
);
if
(
StringUtils
.
isBlank
(
token
)){
if
(
StringUtils
.
isBlank
(
token
)){
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment