Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
education
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
李丛阳
education
Commits
36ba5d78
Commit
36ba5d78
authored
Jan 08, 2018
by
李丛阳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
security
parent
a35cbcda
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
+22
-3
SecurityConfig.java
src/main/java/org/rcisoft/config/SecurityConfig.java
+21
-2
application-dev.yml
src/main/resources/application-dev.yml
+1
-1
No files found.
src/main/java/org/rcisoft/config/SecurityConfig.java
View file @
36ba5d78
...
...
@@ -96,10 +96,29 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.
authenticationEntryPoint
(
new
RestAuthenticationEntryPoint
())
;
http
//添加前置过滤器
.
addFilter
After
(
jwtAuthenTokenFilter
,
UsernamePasswordAuthenticationFilter
.
class
);
.
addFilter
Before
(
jwtAuthenTokenFilter
,
UsernamePasswordAuthenticationFilter
.
class
);
http
//禁用header缓存
.
headers
().
cacheControl
();
/***
*
* 验证流程
* 1. request-> jwtAuthenTokenFilter 通过jwt 获取token 拼接 UserDetail
*
* jwtAuthenTokenFilter 将 UsernamePasswordAuthenticationToken 放置 securityContext
*
* SecurityContextHolder.getContext().setAuthentication(authentication);
*
* 2. jwtAuthenTokenFilter -> spring security
*
* 排除 permitAll() 等验证
*
* 验证失败后 authenticationEntryPoint(new RestAuthenticationEntryPoint())
*
*
*
* 未知 addFilterBefore addFilterAfter 顺序问题 未确定原因
*
*/
}
}
src/main/resources/application-dev.yml
View file @
36ba5d78
server
:
port
:
8081
#context-path: /edu #ContextPath must start with '/' and not end with '/'
context-path
:
/edu
#ContextPath must start with '/' and not end with '/
tomcat
:
max-threads
:
300
#uri-encoding: UTF-8
...
...
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