From d03056eed33b03fe28760eda1930880aa5e8c2c3 Mon Sep 17 00:00:00 2001 From: Yoko Date: Mon, 26 Mar 2018 16:56:14 -0700 Subject: [PATCH] Update Github auth method API reference (#4202) * Update Github auth method API reference * Replaced vault.rocks in API --- website/source/api/auth/github/index.html.md | 136 +++++++++++++++++++ 1 file changed, 136 insertions(+) diff --git a/website/source/api/auth/github/index.html.md b/website/source/api/auth/github/index.html.md index 975aed980..aa72e431e 100644 --- a/website/source/api/auth/github/index.html.md +++ b/website/source/api/auth/github/index.html.md @@ -87,6 +87,142 @@ $ curl \ } ``` +## Map GitHub Teams + +Map a list of policies to a team that exists in the configured GitHub organization. + +| Method | Path | Produces | +| :------- | :--------------------------- | :--------------------- | +| `POST` | `/auth/github/map/teams/:team_name` | `204 (empty body)` | + +### Parameters + +- `key` `(string)` - GitHub team name in "slugified" format +- `value` `(string)` - Comma separated list of policies to assign + +### Sample Payload + +```json +{ + "value": "dev-policy" +} +``` + +### Sample Request + +``` +$ curl \ + --header "X-Vault-Token: ..." \ + --request POST \ + --data @payload.json \ + http://127.0.0.1:8200/v1/auth/github/map/teams/dev +``` + + +## Read Team Mapping + +Reads the GitHub team policy mapping. + +| Method | Path | Produces | +| :------- | :--------------------------- | :--------------------- | +| `GET` | `/auth/github/map/teams:team_name` | `200 application/json` | + +### Sample Request + +``` +$ curl \ + --header "X-Vault-Token: ..." \ + http://127.0.0.1:8200/v1/auth/github/map/teams/dev +``` + +### Sample Response + +```json +{ + "request_id": "812229d7-a82e-0b20-c35b-81ce8c1b9fa6", + "lease_id": "", + "renewable": false, + "lease_duration": 0, + "data": { + "key": "dev", + "value": "dev-policy" + }, + "wrap_info": null, + "warnings": null, + "auth": null +} +``` + +## Map GitHub Users + +Map a list of policies to a specific GitHub user exists in the configured +organization. + +| Method | Path | Produces | +| :------- | :--------------------------- | :--------------------- | +| `POST` | `/auth/github/map/users/:user_name` | `204 (empty body)` | + +### Parameters + +- `key` `(string)` - GitHub user name +- `value` `(string)` - Comma separated list of policies to assign + +### Sample Payload + +```json +{ + "value": "sethvargo-policy" +} +``` + +### Sample Request + +``` +$ curl \ + --header "X-Vault-Token: ..." \ + --request POST \ + --data @payload.json \ + http://127.0.0.1:8200/v1/auth/github/map/users/sethvargo +``` + +The user with username `sethvargo` will be assigned the `sethvargo-policy` +policy **in addition to** any team policies. + +## Read User Mapping + +Reads the GitHub user policy mapping. + +| Method | Path | Produces | +| :------- | :--------------------------- | :--------------------- | +| `GET` | `/auth/github/map/users:user_name` | `200 application/json` | + +### Sample Request + +``` +$ curl \ + --header "X-Vault-Token: ..." \ + http://127.0.0.1:8200/v1/auth/github/map/users/sethvargo +``` + +### Sample Response + +```json +{ + "request_id": "764b6f88-efba-51bd-ed62-cf1c9e80e37a", + "lease_id": "", + "renewable": false, + "lease_duration": 0, + "data": { + "key": "sethvargo", + "value": "sethvargo-policy" + }, + "wrap_info": null, + "warnings": null, + "auth": null +} +``` + + ## Login Login using GitHub access token.