嘿,你好!

这是一个简单的基于Spring Boot 的用户系统 。

实现功能:
1.基于Spring Security的用户注册,登陆,授权。(MySQL).
2.基于Spring Oauth2 的用户接入.password,code模式.


使用指南:
1.源码获取:
git clone https://gitee.com/haipenge/faceye-boot-pom.git
git clone https://gitee.com/haipenge/faceye-boot-util.git
git clone https://gitee.com/haipenge/faceye-boot-jpa.git
git clone https://gitee.com/haipenge/faceye-boot-security.git
2.OAuth2
1).密码模式
curl -X POST -H "Cache-Control:no-cache" -H "Content-Type: application/x-www-form-urlencoded" "http://localhost:8080/oauth/token?client_id=mobile_client&client_secret=secret&grant_type=password&scope=read&username=demo&password=demo"
获取结果如下:
{"access_token":"248613ef-f77d-40ff-97fe-a0e9708ef6ec","token_type":"bearer","refresh_token":"ae08795e-dc80-48eb-a8c8-6e10cdc5b186","expires_in":43199,"scope":"read"}
2).授权码模式
1>生成授权码
在浏览器中打开以下链接,如未登陆,将跳出登陆页面,使用用户demo/demo登陆。
http://localhost:8080/oauth/authorize?client_id=web_client&response_type=code&scope=read&redirect_uri=http://www.baidu.com
登陆成功 后,将出现授权确认页,点击授权,url 将跳转至:https://baidu.com/?code=XXXXXXXXXXXXXX
2>使用授权码换取access_token
curl -X POST -H "Cache-Control: no-cache" -H "Content-Type: application/x-www-form-urlencoded" -d 'redirect_uri=http://www.baidu.com' "http://localhost:8080/oauth/token?client_id=web_client&client_secret=secret&grant_type=authorization_code&code=XXXXXXX"
结果如下:
{"access_token":"248613ef-f77d-40ff-97fe-a0e9708ef6ec","token_type":"bearer","refresh_token":"ae08795e-dc80-48eb-a8c8-6e10cdc5b186","expires_in":43199,"scope":"read"}