1.OAUTH CODE授权模式  参照 http://www.barretlee.com/blog/2016/01/10/oauth2-introduce/

2.spring oauth2参照 http://blog.csdn.net/neosmith/article/details/52539927

3. 参照DEMO https://github.com/Stephen-sen/springSercurityOAuth2

4.spring oauth jwt使用RSA 参照: http://blog.csdn.net/zhao1949/article/details/68064984


oauth_client_details的测试数据

client_id client_secret authorized_grant_types  
client secret client_credentials,refresh_token 客户端模式
code secret authorization_code,refresh_token 授权码模式
password secret password,refresh_token 密码模式



1.客户端模式 适用场景:内网系统,系统间的校验。
请求地址:POST http://localhost:8080/oauth/token
BODY参数:①grant_type=client_credentials

HEADER参数: Username=client Password=secret  组装成Authorization=Basic Y2xpZW50OmNsaWVudA==。 spring的规范使用HEADER传递客户端信息

2.密码模式 适用场景:SDK,无法让用户在网页上填写用户名和密码,或者纯后台服务。
请求地址:POST http://localhost:8080/oauth/token
BODY参数:①user_name=***  ②password=***  ③grant_type=password
HEADER参数: Username=password Password=secret  组装成Authorization=Basic cGFzc3dvcmQ6c2VjcmV0。 spring的规范使用HEADER传递客户端信息


3.授权码模式 适用场景: 对第三方系统授权 或者需要统一页面登录
请求地址:GET: http://localhost:8080/oauth/authorize?client_id=client&grant_type=authorization_code&response_type=code&redirect_uri=http://www.baidu.com
核心参数:①client_id =***   ②grant_type=authorization_code  ③response_type=code
请求地址:POST: http://client:[email protected]:8080/oauth/token
核心参数:①grant_type =authorization_code   ②code=GET返回的CODE  ③client_secret=***

oauth_client_details的表数据:
client_id  client_secret   authorized_grant_types
client       secret           authorization_code,refresh_token,implicit,password,client_credentials


授权码模式的时序图

OAUTH2.0


相关文章:

  • 2022-02-05
猜你喜欢
  • 2021-08-22
  • 2021-08-16
  • 2021-10-03
相关资源
相似解决方案