Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
ihooyah-hza-server
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄杰
ihooyah-hza-server
Commits
5210454f
Commit
5210454f
authored
Apr 02, 2020
by
黄杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
readme commit
parent
b2e23f8f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
10 deletions
+3
-10
AccessGatewayFilter.java
.../java/com/ihooyah/gateway/filter/AccessGatewayFilter.java
+3
-6
CacheWebConfig.java
...rc/main/java/com/ihooyah/cache/config/CacheWebConfig.java
+0
-4
No files found.
ihooyah-hza-gateway/src/main/java/com/ihooyah/gateway/filter/AccessGatewayFilter.java
View file @
5210454f
...
...
@@ -4,8 +4,8 @@ import com.alibaba.fastjson.JSONObject;
import
com.ihooyah.auth.config.UserAuthConfig
;
import
com.ihooyah.auth.jwt.UserAuthUtil
;
import
com.ihooyah.common.context.BaseContextHandler
;
import
com.ihooyah.common.msg.ObjectRespInfo
;
import
com.ihooyah.common.msg.RespEnum
;
import
com.ihooyah.common.msg.RespInfo
;
import
com.ihooyah.common.util.jwt.IJWTInfo
;
import
com.ihooyah.gateway.handler.SwaggerProvider
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -43,9 +43,6 @@ public class AccessGatewayFilter implements GlobalFilter {
@Autowired
private
UserAuthConfig
userAuthConfig
;
private
static
final
String
HEADER_NAME
=
"X-Forwarded-Prefix"
;
@Override
public
Mono
<
Void
>
filter
(
ServerWebExchange
serverWebExchange
,
GatewayFilterChain
gatewayFilterChain
)
{
log
.
info
(
"check token and user permission...."
);
...
...
@@ -71,7 +68,7 @@ public class AccessGatewayFilter implements GlobalFilter {
user
=
getJWTUser
(
request
,
mutate
);
}
catch
(
Exception
e
)
{
log
.
error
(
"用户Token过期异常"
,
e
);
return
getVoidMono
(
serverWebExchange
,
new
RespInfo
(
RespEnum
.
AUTH_ACCESSTOKEN_EXPIRED
.
getCode
(),
"User Token Forbidden or Expired!"
));
return
getVoidMono
(
serverWebExchange
,
new
Object
RespInfo
(
RespEnum
.
AUTH_ACCESSTOKEN_EXPIRED
.
getCode
(),
"User Token Forbidden or Expired!"
));
}
return
gatewayFilterChain
.
filter
(
serverWebExchange
.
mutate
().
build
());
...
...
@@ -83,7 +80,7 @@ public class AccessGatewayFilter implements GlobalFilter {
* @param body
*/
@NotNull
private
Mono
<
Void
>
getVoidMono
(
ServerWebExchange
serverWebExchange
,
RespInfo
body
)
{
private
Mono
<
Void
>
getVoidMono
(
ServerWebExchange
serverWebExchange
,
Object
RespInfo
body
)
{
serverWebExchange
.
getResponse
().
setStatusCode
(
HttpStatus
.
OK
);
byte
[]
bytes
=
JSONObject
.
toJSONString
(
body
).
getBytes
(
StandardCharsets
.
UTF_8
);
DataBuffer
buffer
=
serverWebExchange
.
getResponse
().
bufferFactory
().
wrap
(
bytes
);
...
...
ihooyah-hza-modules/ihooyah-hza-cache/src/main/java/com/ihooyah/cache/config/CacheWebConfig.java
View file @
5210454f
...
...
@@ -13,8 +13,4 @@ public class CacheWebConfig implements WebMvcConfigurer {
"classpath:/META-INF/static/"
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment