Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hel-developer-guide
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
1
Merge Requests
1
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
hel-guide
hel-developer-guide
Commits
b3949daa
Commit
b3949daa
authored
Jan 25, 2018
by
冯景珉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates 框架功能描述/sso.md
Auto commit by GitBook Editor
parent
8a374c61
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
4 deletions
+36
-4
sso.md
框架功能描述/sso.md
+36
-4
No files found.
框架功能描述/sso.md
View file @
b3949daa
...
@@ -40,12 +40,44 @@
...
@@ -40,12 +40,44 @@
#### 配置文件路径r
#### 配置文件路径r
resource/spring/oauth2Security.xml
resource/spring/oauth2Security.xml
#### 使用说明
#### 使用说明
如果想开发内部api用于外界访问,并根据access_token保证安全性,俺么需要对配置文件进行修改。
如果想开发内部api用于外界访问,并根据access_token保证安全性,那么需要对配置文件进行修改。
配置如下:
![](
/assets/mail_state_query.png
)
```
<!--透传API Spring Security 配置-->
<http pattern="/r/api/**"
create-session="stateless"
use-expressions="true"
entry-point-ref="oauth2AuthenticationEntryPoint"
access-decision-manager-ref="oauth2AccessDecisionManager">
<csrf disabled="true"/>
<!--拒绝匿名访问-->
<anonymous enabled="true"/>
<!-- 设置访问权限控制 -->
<intercept-url pattern="/r/api/**" access="hasAnyRole('ROLE_USER','SCOPE_READ')"
method="GET"/>
<intercept-url pattern="/r/api/**" access="hasAnyRole('ROLE_USER','SCOPE_READ')"
method="POST"/>
<intercept-url pattern="/r/api/**" access="hasAnyRole('ROLE_USER','SCOPE_READ')"
method="PUT"/>
<intercept-url pattern="/r/api/**" access="hasAnyRole('ROLE_USER','SCOPE_READ')"
method="DELETE"/>
<!-- oauth 资源过滤器,与resource server配置对应 -->
<custom-filter ref="apiResourceServer" before="PRE_AUTH_FILTER"/>
<!-- 访问拒绝处理器 -->
<access-denied-handler ref="oauth2AccessDeniedHandler"/>
</http>
```
#### 参数说明
*
发送状态: 发送成功(Y) 正在发送(P) 发送失败(F) 待发送(N)。
#### 注意
*
create-session参数表示是否创建session,可以根据需求调整参数(比如单点登录的时候需要设置为ifRequired)。
*
被拦截的url需要access_token才能进行资源访问,否则会因为没有对应的权限而报错。
*
外部api不要开启csrf的配置,使用上述的失效配置即可。
*
intercept-url可以进行细粒度的拦截,指定url的完整路径,以及权限控制和请求类型。
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