spring-oauth-server实践:授权方式四:client_credentials 模式下access_token的产生
2017-07-11 19:51
681 查看
授权结果
获取access_token成功, 访问资源服务器APIhttp://localhost:9000/api-gateway-engine/unity/user_info?access_token=94d129e7-7898-4084-9c08-6bfe27a2521e
准备工作
一、授权过程
FirewalledRequest[ Request(POST //10.200.44.82:9000/api-gateway-engine/oauth/token)@6406550f]1、身份识别
2、权限检查
org.springframework.security.access.vote.AuthenticatedVoter@4d4dfe95
3、授权处理
3.1、授权入口
请求参数
ClientCredentialsTokenGranter.grant("client_credentials",tokenRequest)
org.springframework.security.oauth2.provider.client.ClientCredentialsTokenGranter@97e8aa0
3.2、获取数据库中的oauth_client_details信息
3.3、创建OAuth2Authentication对象(根据storedOAuth2Request对象(client+tokenRequest))
3.4、构建storedOAuth2Request(根据client和tokenRequest)
3.5、如果已经存在access_token, 更新数据库返回
二、结果验证
1、授权结果
第二步 访问资源服务器的API
access_token
94d129e7-7898-4084-9c08-6bfe27a2521e
token_type
bearer
scope
read write
expires_in
2591843
获取access_token成功, 访问资源服务器API
http://localhost:9000/api-gateway-engine/unity/user_info?access_token=94d129e7-7898-4084-9c08-6bfe27a2521e JSON格式的资源服务器数据
2、访问业务
相关文章推荐
- spring-oauth-server实践:使用授权方式四:client_credentials 模式下access_token做业务!!!
- spring-oauth-server实践:授权方式四:client_credentials 模式下有效期内重复申请 access_token ?
- spring-oauth-server实践:授权方式四:client_credentials 模式的refresh_token?
- spring-oauth-server实践:使用授权方式四:client_credentials 模式的客户端和服务端交互
- spring-oauth-server实践:授权方式1、2、3和授权方式4的token对象.authorities产生方式比较
- spring-oauth-server实践:授权方式三:PASSWORD模式下 authorities:ROLE_{user.privillege}, ROLE_USER
- spring-oauth-server实践:OAuth2.0 通过header 传递 access_token 验证
- spring-oauth-server实践:access_token的有效期分析
- 在ASP.NET中基于Owin OAuth使用Client Credentials Grant授权发放Token(一)
- 基于 IdentityServer3 实现 OAuth 2.0 授权服务【密码模式(Resource Owner Password Credentials)】
- 在ASP.NET中基于Owin OAuth使用Client Credentials Grant授权发放Token
- 基于 IdentityServer3 实现 OAuth 2.0 授权服务【客户端模式(Client Credentials Grant)】
- Leo仿【DOTA视频站】项目实践【四】---- 授权获取优酷access_token
- OAuth2.0学习(1-8) 授权方式五之Access_Token令牌过期更新
- 基于OWIN WebAPI 使用OAuth授权服务【客户端模式(Client Credentials Grant)】
- [ASP.net教程] 新浪OAuth网站登陆连接,请求access_token时遇到21323 miss client id or secret 的解决方案
- spring-oauth-server实践:客户端和服务端环境搭建
- 新浪OAuth网站登陆连接,请求access_token时遇到21323 miss client id or secret 的解决方案
- (转)基于OWIN WebAPI 使用OAuth授权服务【客户端模式(Client Credentials Grant)】
- Oauth支持的5类 grant_type 及说明 authorization_code — 授权码模式(即先登录获取code,再获取token) password — 密码模式(将用户名,密码传