# spring-cloud-auth-gateway-system **Repository Path**: singlekingdom/spring-cloud-auth-gateway-system ## Basic Information - **Project Name**: spring-cloud-auth-gateway-system - **Description**: first commit - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2019-09-07 - **Last Updated**: 2022-11-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # spring-cloud-auth-gateway-system #### 介绍 带权限校验的springcloud全家桶 #### 软件架构 测试Oauth2, demo #### 使用说明 1. 启动auth,8001,eureka,zuul,四个模块 2. 使用postman调用接口,post请求 ```bash http://localhost:8762/auth/oauth/token?grant_type=password&username=哈哈&password=1 在postman的authorization中选择basic autho,填入账号密码android ``` 返回数据例子 ```json { "access_token": "35b8cde3-7ad1-4bf5-b390-2acb703d3b5c", "token_type": "bearer", "refresh_token": "22915ebe-b336-4519-b37f-3384290c6e3b", "expires_in": 42497, "scope": "read" } ``` 3. 请求获取用户信息, ```text GET:http://localhost:8762/auth/api/member GET:http://localhost:8762/member/api/current ``` 需要在postman中加入请求头 ```text "access_token": "35b8cde3-7ad1-4bf5-b390-2acb703d3b5c", ``` 返回数据例子 ```json { "authorities": [ { "authority": "ROLE_ADMIN" }, { "authority": "current" }, { "authority": "exit" }, { "authority": "member" }, { "authority": "query" } ], "details": { "remoteAddress": "127.0.0.1", "sessionId": null, "tokenValue": "35b8cde3-7ad1-4bf5-b390-2acb703d3b5c", "tokenType": "Bearer", "decodedDetails": null }, "authenticated": true, "userAuthentication": { "authorities": [ { "authority": "ROLE_ADMIN" }, { "authority": "current" }, { "authority": "exit" }, { "authority": "member" }, { "authority": "query" } ], "details": { "grant_type": "password", "username": "哈哈" }, "authenticated": true, "principal": { "password": null, "username": "哈哈", "authorities": [ { "authority": "ROLE_ADMIN" }, { "authority": "current" }, { "authority": "exit" }, { "authority": "member" }, { "authority": "query" } ], "accountNonExpired": true, "accountNonLocked": true, "credentialsNonExpired": true, "enabled": true }, "credentials": null, "name": "哈哈" }, "clientOnly": false, "oauth2Request": { "clientId": "android", "scope": [ "read" ], "requestParameters": { "grant_type": "password", "username": "哈哈" }, "resourceIds": [], "authorities": [], "approved": true, "refresh": false, "redirectUri": null, "responseTypes": [], "extensions": {}, "refreshTokenRequest": null, "grantType": "password" }, "principal": { "password": null, "username": "哈哈", "authorities": [ { "authority": "ROLE_ADMIN" }, { "authority": "current" }, { "authority": "exit" }, { "authority": "member" }, { "authority": "query" } ], "accountNonExpired": true, "accountNonLocked": true, "credentialsNonExpired": true, "enabled": true }, "credentials": "", "name": "哈哈" } ```