Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
61c71313
Commit
61c71313
authored
Jul 12, 2023
by
Zheng Jie
Browse files
update SwaggerConfig.java
close
https://github.com/elunez/eladmin/issues/807
parent
6d4a0040
Changes
2
Hide whitespace changes
Inline
Side-by-side
eladmin-common/src/main/java/me/zhengjie/config/SwaggerConfig.java
View file @
61c71313
...
...
@@ -78,7 +78,7 @@ public class SwaggerConfig {
return
new
ApiInfoBuilder
()
.
description
(
"一个简单且易上手的 Spring boot 后台管理框架"
)
.
title
(
"ELADMIN 接口文档"
)
.
version
(
"2.
6
"
)
.
version
(
"2.
7
"
)
.
build
();
}
...
...
@@ -93,8 +93,6 @@ public class SwaggerConfig {
private
List
<
SecurityContext
>
securityContexts
()
{
//设置需要登录认证的路径
List
<
SecurityContext
>
securityContexts
=
new
ArrayList
<>();
// ^(?!auth).*$ 表示所有包含auth的接口不需要使用securitySchemes即不需要带token
// ^标识开始 ()里是一子表达式 ?!/auth表示匹配不是/auth的位置,匹配上则添加请求头,注意路径已/开头 .表示任意字符 *表示前面的字符匹配多次 $标识结束
securityContexts
.
add
(
getContextByPath
());
return
securityContexts
;
}
...
...
@@ -102,7 +100,8 @@ public class SwaggerConfig {
private
SecurityContext
getContextByPath
()
{
return
SecurityContext
.
builder
()
.
securityReferences
(
defaultAuth
())
.
operationSelector
(
o
->
o
.
requestMappingPattern
().
matches
(
"^(?!/auth).*$"
))
// 表示 /auth/code、/auth/login 接口不需要使用securitySchemes即不需要带token
.
operationSelector
(
o
->
o
.
requestMappingPattern
().
matches
(
"^(?!/auth/code|/auth/login).*$"
))
.
build
();
}
...
...
eladmin-system/src/main/java/me/zhengjie/modules/security/rest/AuthorizationController.java
View file @
61c71313
...
...
@@ -22,7 +22,6 @@ import io.swagger.annotations.ApiOperation;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
me.zhengjie.annotation.Log
;
import
me.zhengjie.annotation.rest.AnonymousDeleteMapping
;
import
me.zhengjie.annotation.rest.AnonymousGetMapping
;
import
me.zhengjie.annotation.rest.AnonymousPostMapping
;
import
me.zhengjie.config.RsaProperties
;
...
...
@@ -141,7 +140,7 @@ public class AuthorizationController {
}
@ApiOperation
(
"退出登录"
)
@
Anonymous
DeleteMapping
(
value
=
"/logout"
)
@DeleteMapping
(
value
=
"/logout"
)
public
ResponseEntity
<
Object
>
logout
(
HttpServletRequest
request
)
{
onlineUserService
.
logout
(
tokenProvider
.
getToken
(
request
));
return
new
ResponseEntity
<>(
HttpStatus
.
OK
);
...
...
Write
Preview
Supports
Markdown
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