The previous article is standing on the shoulders of giants to study OAuth2.0, but also to quickly help you know OAuth2.0, gossip less, I based on the framework of the use of OAuth2.0 summary, draw a simple flowchart (according to user name + password to achieve OAuth2.0 login authentication):
The diagram above clearly describes the current log in login process, and now we make the relevant micro-service for login, parsing the following:
Request Method: POST
Service Url:http://localhost:8080/user/login
Parameter type: Application/json
Headers: Content-Type: application/json Authorization: Basic QXkjkdkYkhfeyKOKKHUM67ejfjeSfnrRdk5nPT0= Body:{ "userName":"admin", ---也可以是手机号码等 "password": "e10adc3949ba59abbe56e057f20f883e"
Return value type: Application/json
The result set returned:
{ "code": "200", "message": "Success", "version": "v1.0", "data": { "userInfo": { "userId": "00001", "pwd": "e10adc3949ba59abbe56e057f20f883e", "userName": "admin", "mobile": "15875500000", "telephone": "", "wechat": "", "email": "[email protected]", "status": "1", "createTime": "2017-06-26" }, "roleIds": "100", "tokenInfo": { "accessToken":"4de55a69-e372-4766-acd3-1c419d6f2fda", "tokenType": "bearer", "webTokent":"uHSLjfJoQwU4t4PAqCzH1SN0fp7PUWKluPNS+x1dZ8R9Gx+NJkBI7w==", "refreshToken":"d3d71594-5c3f-4a68-a7e5-b8d21c4fa73b", "expiresIn": 34644, "scope": "read write" }
Note: You can test with the Postman tool
Framework Design idea: Provide independent Commonservice-sso microservices, provide component-sso dependent components, and provide micro-service client User-service Micro-service interface for user login.
The entire execution process is as follows: User-service---> Commonservice-sso---> Component-sso
The service gateway is not explained here, and it is later related to how service authentication and authentication are implemented between the service gateway and SSO single Sign-on.
Integrate spring Cloud Cloud architecture-SSO Single Sign-on OAuth2.0 login process (2)