迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:springboot-oauth2-server开源软件地址:https://gitee.com/wang-bata/springboot-oauth2-server开源软件介绍:Spring Boot Oauth2-master数据库脚本在项目中Oauth2支持的授权方式目前有5类
1. authorization_code
http://localhost:9000/oauth/authorize?response_type=code&scope=read write&client_id=book&redirect_uri=http://www.baidu.com&state=b375bc2b-25f7-4dce-9b36-5f9e2d20bda1
http://www.baidu.com/?code=kG4F2N&state=b375bc2b-25f7-4dce-9b36-5f9e2d20bda1
http://localhost:9000/oauth/token?client_id=book&client_secret=book&grant_type=authorization_code&code=nFXYw1&redirect_uri=http://www.baidu.com
{"access_token":"30626e87-761f-410c-9497-84b29d310dd7","token_type":"bearer","refresh_token":"0843fbec-20e3-4802-93a0-357488403924","expires_in":29,"scope":"read write"}
curl http://localhost:8000/book/classical -H "Authorization: Bearer 30626e87-761f-410c-9497-84b29d310dd7" 2. password
curl -X POST http://localhost:9000/oauth/token -H "Accept: application/json" -d "grant_type=password&scope=read%20write&client_id=curl-client&client_secret=client-secret&username=nangzi&password=nangzi"
{"access_token":"9ac3fe0f-f380-4149-8fca-19a72374365d","token_type":"bearer","refresh_token":"0843fbec-20e3-4802-93a0-357488403924","expires_in":29,"scope":"read write"}
curl http://localhost:8000/book/classical-H "Authorization: Bearer 9ac3fe0f-f380-4149-8fca-19a72374365d" 3. client_credentials
curl -X POST http://localhost:9000/oauth/token -H "Accept: application/json" -d "grant_type=client_credentials&scope=read%20write&client_id=curl-client&client_secret=client-secret"
{"access_token":"904953fc-f446-49f3-9258-06d0f6cfba5b","token_type":"bearer","expires_in":29,"scope":"read write"}
curl http://localhost:8000/book/classical -H "Authorization: Bearer 904953fc-f446-49f3-9258-06d0f6cfba5b" 4. implicit
http://localhost:9000/oauth/authorize?response_type=token&scope=read write&client_id=book&client_secret=book&redirect_uri=http://www.baidu.com&state=b375bc2b-25f7-4dce-9b36-5f9e2d20bda1
http://www.baidu.com/#access_token=aa7779b0-b98e-4739-b0d7-922a811ed134&token_type=bearer&state=b375bc2b-25f7-4dce-9b36-5f9e2d20bda1&expires_in=29
curl http://localhost:8000/book/classical -H "Authorization: Bearer aa7779b0-b98e-4739-b0d7-922a811ed134" 5. refresh_token
curl -X POST http://localhost:9000/oauth/token -H "Accept: application/json" -d "grant_type=refresh_token&refresh_token=0843fbec-20e3-4802-93a0-357488403924&client_id=curl-client&client_secret=client-secret"
{"access_token":"6aa17ed5-e684-4dfa-90a8-61b2ad7c7615","token_type":"bearer","refresh_token":"0843fbec-20e3-4802-93a0-357488403924","expires_in":29,"scope":"read write"}
curl http://localhost:8000/book/classical -H "Authorization: Bearer 6aa17ed5-e684-4dfa-90a8-61b2ad7c7615" ![]() |
2022-08-15
2022-08-17
2023-10-27
2022-09-23
2022-08-13
请发表评论