Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ioc_sixiang_license
Project
Project
Details
Activity
Releases
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
zengtianlai3
ioc_sixiang_license
Commits
3e1aa57b
Commit
3e1aa57b
authored
Jun 14, 2022
by
AfirSraftGarrier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文档说明
parent
c039d96e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
51 deletions
+5
-51
CorsConfig.java
.../src/main/java/iot/sixiang/license/config/CorsConfig.java
+0
-2
Knife4jConfig.java
...c/main/java/iot/sixiang/license/config/Knife4jConfig.java
+0
-40
JwtFilter.java
license/src/main/java/iot/sixiang/license/jwt/JwtFilter.java
+5
-9
No files found.
license/src/main/java/iot/sixiang/license/config/CorsConfig.java
View file @
3e1aa57b
...
@@ -24,8 +24,6 @@ public class CorsConfig implements WebMvcConfigurer {
...
@@ -24,8 +24,6 @@ public class CorsConfig implements WebMvcConfigurer {
@Override
@Override
public
void
addResourceHandlers
(
ResourceHandlerRegistry
registry
)
{
public
void
addResourceHandlers
(
ResourceHandlerRegistry
registry
)
{
registry
.
addResourceHandler
(
"doc.html"
).
addResourceLocations
(
"classpath:/META-INF/resources/"
);
registry
.
addResourceHandler
(
"/webjars/**"
).
addResourceLocations
(
"classpath:/META-INF/resources/webjars/"
);
}
}
@Override
@Override
...
...
license/src/main/java/iot/sixiang/license/config/Knife4jConfig.java
deleted
100644 → 0
View file @
c039d96e
package
iot
.
sixiang
.
license
.
config
;
import
com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
springfox.documentation.builders.ApiInfoBuilder
;
import
springfox.documentation.builders.PathSelectors
;
import
springfox.documentation.builders.RequestHandlerSelectors
;
import
springfox.documentation.spi.DocumentationType
;
import
springfox.documentation.spring.web.plugins.Docket
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc
;
/**
* Created by m33 on 2022/6/13 20:04
*/
@Configuration
@EnableSwagger2WebMvc
@EnableKnife4j
//@Import(BeanValidatorPluginsConfiguration.class)
public
class
Knife4jConfig
{
@Bean
public
Docket
docket
()
{
Docket
docket
=
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
apiInfo
(
new
ApiInfoBuilder
()
.
description
(
"实名制服务器接口文档"
)
.
termsOfServiceUrl
(
"http://web.license.srthinker.com/"
)
.
version
(
"1.0"
)
.
build
())
//分组名称
.
groupName
(
"iot_license"
)
.
select
()
//这里指定Controller扫描包路径
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"iot.sixiang.license.controller"
))
.
paths
(
PathSelectors
.
any
())
.
build
();
return
docket
;
}
}
license/src/main/java/iot/sixiang/license/jwt/JwtFilter.java
View file @
3e1aa57b
...
@@ -20,16 +20,12 @@ public class JwtFilter implements Filter {
...
@@ -20,16 +20,12 @@ public class JwtFilter implements Filter {
private
static
final
String
url2
=
"/resource"
;
private
static
final
String
url2
=
"/resource"
;
private
static
final
String
url3
=
"/doc.html"
;
private
static
final
String
url3
=
"/doc.html"
;
private
static
final
String
url4
=
"/v3/swagger-login"
;
private
static
final
String
url4
=
"/v2/api-docs"
;
private
static
final
String
url5
=
"/swagger-ui.html"
;
private
static
final
String
url6
=
"/static"
;
private
static
final
String
url7
=
"/swagger-resources"
;
private
static
final
String
url7
=
"/swagger-resources"
;
private
static
final
String
url8
=
"/webjars/"
;
private
static
final
String
url8
=
"/webjars/"
;
@Override
@Override
public
void
init
(
FilterConfig
filterConfig
)
throws
ServletException
{
public
void
init
(
FilterConfig
filterConfig
)
throws
ServletException
{
}
}
@Override
@Override
...
@@ -46,7 +42,7 @@ public class JwtFilter implements Filter {
...
@@ -46,7 +42,7 @@ public class JwtFilter implements Filter {
String
token
=
request
.
getHeader
(
"authorization"
);
String
token
=
request
.
getHeader
(
"authorization"
);
boolean
check
=
true
;
boolean
check
=
true
;
String
uri
=
request
.
getRequestURI
();
String
uri
=
request
.
getRequestURI
();
if
(
uri
.
contains
(
url1
)
||
uri
.
contains
(
url2
)
||
uri
.
contains
(
url3
)
||
uri
.
contains
(
url4
)
||
uri
.
contains
(
url
5
)
||
uri
.
contains
(
url6
)
||
uri
.
contains
(
url
7
)
||
uri
.
contains
(
url8
))
{
if
(
uri
.
contains
(
url1
)
||
uri
.
contains
(
url2
)
||
uri
.
contains
(
url3
)
||
uri
.
contains
(
url4
)
||
uri
.
contains
(
url7
)
||
uri
.
contains
(
url8
))
{
check
=
false
;
check
=
false
;
}
}
if
(!
check
)
{
if
(!
check
)
{
...
@@ -74,9 +70,9 @@ public class JwtFilter implements Filter {
...
@@ -74,9 +70,9 @@ public class JwtFilter implements Filter {
String
userId
=
userData
.
get
(
"userId"
).
asString
();
String
userId
=
userData
.
get
(
"userId"
).
asString
();
String
userName
=
userData
.
get
(
"userName"
).
asString
();
String
userName
=
userData
.
get
(
"userName"
).
asString
();
String
password
=
userData
.
get
(
"password"
).
asString
();
String
password
=
userData
.
get
(
"password"
).
asString
();
// //拦截器 拿到用户信息,放到request中
// //拦截器 拿到用户信息,放到request中
// request.setAttribute("userName", userName);
// request.setAttribute("userName", userName);
// request.setAttribute("password", password);
// request.setAttribute("password", password);
LoginUser
loginUser
=
new
LoginUser
(
userId
,
userName
,
password
);
LoginUser
loginUser
=
new
LoginUser
(
userId
,
userName
,
password
);
UserUtils
.
setLoginUser
(
loginUser
);
UserUtils
.
setLoginUser
(
loginUser
);
...
...
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