2017-08-16 02:03:04 +00:00
|
|
|
---
|
|
|
|
layout: "api"
|
2018-07-11 19:52:22 +00:00
|
|
|
page_title: "Google Cloud - Auth Methods - HTTP API"
|
New Docs Website (#5535)
* conversion stage 1
* correct image paths
* add sidebar title to frontmatter
* docs/concepts and docs/internals
* configuration docs and multi-level nav corrections
* commands docs, index file corrections, small item nav correction
* secrets converted
* auth
* add enterprise and agent docs
* add extra dividers
* secret section, wip
* correct sidebar nav title in front matter for apu section, start working on api items
* auth and backend, a couple directory structure fixes
* remove old docs
* intro side nav converted
* reset sidebar styles, add hashi-global-styles
* basic styling for nav sidebar
* folder collapse functionality
* patch up border length on last list item
* wip restructure for content component
* taking middleman hacking to the extreme, but its working
* small css fix
* add new mega nav
* fix a small mistake from the rebase
* fix a content resolution issue with middleman
* title a couple missing docs pages
* update deps, remove temporary markup
* community page
* footer to layout, community page css adjustments
* wip downloads page
* deps updated, downloads page ready
* fix community page
* homepage progress
* add components, adjust spacing
* docs and api landing pages
* a bunch of fixes, add docs and api landing pages
* update deps, add deploy scripts
* add readme note
* update deploy command
* overview page, index title
* Update doc fields
Note this still requires the link fields to be populated -- this is solely related to copy on the description fields
* Update api_basic_categories.yml
Updated API category descriptions. Like the document descriptions you'll still need to update the link headers to the proper target pages.
* Add bottom hero, adjust CSS, responsive friendly
* Add mega nav title
* homepage adjustments, asset boosts
* small fixes
* docs page styling fixes
* meganav title
* some category link corrections
* Update API categories page
updated to reflect the second level headings for api categories
* Update docs_detailed_categories.yml
Updated to represent the existing docs structure
* Update docs_detailed_categories.yml
* docs page data fix, extra operator page remove
* api data fix
* fix makefile
* update deps, add product subnav to docs and api landing pages
* Rearrange non-hands-on guides to _docs_
Since there is no place for these on learn.hashicorp, we'll put them
under _docs_.
* WIP Redirects for guides to docs
* content and component updates
* font weight hotfix, redirects
* fix guides and intro sidenavs
* fix some redirects
* small style tweaks
* Redirects to learn and internally to docs
* Remove redirect to `/vault`
* Remove `.html` from destination on redirects
* fix incorrect index redirect
* final touchups
* address feedback from michell for makefile and product downloads
2018-10-19 15:40:11 +00:00
|
|
|
sidebar_title: "Google Cloud"
|
|
|
|
sidebar_current: "api-http-auth-gcp"
|
2017-08-16 02:03:04 +00:00
|
|
|
description: |-
|
2018-07-11 19:52:22 +00:00
|
|
|
This is the API documentation for the Vault Google Cloud authentication
|
|
|
|
method.
|
2017-08-16 02:03:04 +00:00
|
|
|
---
|
|
|
|
|
2018-07-11 19:52:22 +00:00
|
|
|
# Google Cloud Auth Method (API)
|
2017-08-16 02:03:04 +00:00
|
|
|
|
2018-07-11 19:52:22 +00:00
|
|
|
This is the API documentation for the Vault Google Cloud auth method. To learn
|
|
|
|
more about the usage and operation, see the
|
|
|
|
[Vault Google Cloud method documentation](/docs/auth/gcp.html).
|
2017-08-16 02:03:04 +00:00
|
|
|
|
2017-09-13 01:48:52 +00:00
|
|
|
This documentation assumes the plugin method is mounted at the
|
2017-09-21 21:14:40 +00:00
|
|
|
`/auth/gcp` path in Vault. Since it is possible to enable auth methods
|
2017-08-16 02:03:04 +00:00
|
|
|
at any location, please update your API calls accordingly.
|
|
|
|
|
|
|
|
## Configure
|
|
|
|
|
|
|
|
Configures the credentials required for the plugin to perform API calls
|
2018-07-11 19:52:22 +00:00
|
|
|
to Google Cloud. These credentials will be used to query the status of IAM
|
2017-08-16 02:03:04 +00:00
|
|
|
entities and get service account or other Google public certificates
|
|
|
|
to confirm signed JWTs passed in during login.
|
|
|
|
|
2019-03-22 16:15:37 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :--------------------------- | :--------------------- |
|
|
|
|
| `POST` | `/auth/gcp/config` |
|
2017-08-16 02:03:04 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
2018-07-11 19:52:22 +00:00
|
|
|
- `credentials` `(string: "")` - A JSON string containing the contents
|
|
|
|
of a GCP credentials file. The credentials file must have the following
|
|
|
|
[permissions](https://cloud.google.com/compute/docs/access/iam):
|
2017-08-16 02:03:04 +00:00
|
|
|
|
2018-07-11 19:52:22 +00:00
|
|
|
```
|
|
|
|
iam.serviceAccounts.get
|
|
|
|
iam.serviceAccountKeys.get
|
|
|
|
```
|
2017-08-16 02:03:04 +00:00
|
|
|
|
2018-07-11 19:52:22 +00:00
|
|
|
If this value is empty, Vault will try to use [Application Default
|
|
|
|
Credentials][gcp-adc] from the machine on which the Vault server is running.
|
2018-10-01 17:09:32 +00:00
|
|
|
|
|
|
|
The project must have the `iam.googleapis.com` API [enabled](https://console.cloud.google.com/flows/enableapi?apiid=iam.googleapis.com).
|
2018-07-11 19:52:22 +00:00
|
|
|
|
2017-08-16 02:03:04 +00:00
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
2018-07-11 19:52:22 +00:00
|
|
|
"credentials": "{ \"type\": \"service_account\", \"project_id\": \"project-123456\", ...}"
|
2017-08-16 02:03:04 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
|
|
```
|
|
|
|
$ curl \
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
--request POST \
|
|
|
|
--data @payload.json \
|
2018-03-23 15:41:51 +00:00
|
|
|
http://127.0.0.1:8200/v1/auth/gcp/config
|
2017-08-16 02:03:04 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Read Config
|
|
|
|
|
2018-07-11 19:52:22 +00:00
|
|
|
Returns the configuration, if any, including credentials.
|
2017-08-16 02:03:04 +00:00
|
|
|
|
2019-03-22 16:15:37 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :--------------------------- | :--------------------- |
|
|
|
|
| `GET` | `/auth/gcp/config` |
|
2017-08-16 02:03:04 +00:00
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
|
|
```
|
|
|
|
$ curl \
|
|
|
|
--header "X-Vault-Token: ..." \
|
2018-03-23 15:41:51 +00:00
|
|
|
http://127.0.0.1:8200/v1/auth/gcp/config
|
2017-08-16 02:03:04 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
2018-07-11 19:52:22 +00:00
|
|
|
"data": {
|
|
|
|
"client_email": "service-account@project-123456.iam.gserviceaccount.com",
|
|
|
|
"client_id": "123456789101112131415",
|
|
|
|
"private_key_id": "97fd7ba59a96e1f3830296aedb4f50879e4d5382",
|
|
|
|
"project_id": "project-123456"
|
2017-08-16 02:03:04 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Create Role
|
|
|
|
|
2017-09-13 01:48:52 +00:00
|
|
|
Registers a role in the method. Role types have specific entities
|
2017-08-16 02:03:04 +00:00
|
|
|
that can perform login operations against this endpoint. Constraints specific
|
|
|
|
to the role type must be set on the role. These are applied to the authenticated
|
|
|
|
entities attempting to login.
|
|
|
|
|
2019-03-22 16:15:37 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :--------------------------- | :--------------------- |
|
|
|
|
| `POST` | `/auth/gcp/role/:name` |
|
2017-08-16 02:03:04 +00:00
|
|
|
|
|
|
|
### Parameters
|
2018-07-11 19:52:22 +00:00
|
|
|
|
|
|
|
- `name` `(string: <required>)` - The name of the role.
|
|
|
|
|
|
|
|
- `type` `(string: <required>)` - The type of this role. Certain fields
|
|
|
|
correspond to specific roles and will be rejected otherwise. Please see below
|
|
|
|
for more information.
|
|
|
|
|
2018-12-10 20:54:18 +00:00
|
|
|
- `bound_service_accounts` `(array: <required for iam>)` - An array of
|
|
|
|
service account emails or IDs that login is restricted to,
|
|
|
|
either directly or through an associated instance. If set to
|
|
|
|
`*`, all service accounts are allowed (you can bind this further using
|
|
|
|
`bound_projects`.)
|
|
|
|
|
|
|
|
- `bound_projects` `(array: [])` - An array of GCP project IDs. Only entities
|
|
|
|
belonging to this project can authenticate under the role.
|
|
|
|
|
|
|
|
- `add_group_aliases` `(bool: false)` - If true, any auth token
|
|
|
|
generated under this token will have associated group aliases, namely
|
|
|
|
`project-$PROJECT_ID`, `folder-$PROJECT_ID`, and `organization-$ORG_ID`
|
|
|
|
for the entities project and all its folder or organization ancestors. This
|
|
|
|
requires Vault to have IAM permission `resourcemanager.projects.get`.
|
2019-07-30 19:58:32 +00:00
|
|
|
|
|
|
|
<%= partial "partials/tokenfields" %>
|
2018-12-10 20:54:18 +00:00
|
|
|
|
2018-07-11 19:52:22 +00:00
|
|
|
#### `iam`-only Parameters
|
|
|
|
|
|
|
|
The following parameters are only valid when the role is of type `"iam"`:
|
|
|
|
|
|
|
|
- `max_jwt_exp` `(string: "15m")` - The number of seconds past the time of
|
|
|
|
authentication that the login param JWT must expire within. For example, if a
|
|
|
|
user attempts to login with a token that expires within an hour and this is
|
|
|
|
set to 15 minutes, Vault will return an error prompting the user to create a
|
|
|
|
new signed JWT with a shorter `exp`. The GCE metadata tokens currently do not
|
|
|
|
allow the `exp` claim to be customized.
|
2017-09-21 21:14:40 +00:00
|
|
|
|
2017-09-19 12:44:05 +00:00
|
|
|
- `allow_gce_inference` `(bool: true)` - A flag to determine if this role should
|
2017-09-21 21:14:40 +00:00
|
|
|
allow GCE instances to authenticate by inferring service accounts from the
|
2017-09-19 12:44:05 +00:00
|
|
|
GCE identity metadata token.
|
2017-09-21 21:14:40 +00:00
|
|
|
|
2018-07-11 19:52:22 +00:00
|
|
|
#### `gce`-only Parameters
|
|
|
|
|
|
|
|
The following parameters are only valid when the role is of type `"gce"`:
|
|
|
|
|
|
|
|
- `bound_zones` `(array: [])`: The list of zones that a GCE instance must belong
|
|
|
|
to in order to be authenticated. If `bound_instance_groups` is provided, it is
|
|
|
|
assumed to be a zonal group and the group must belong to this zone.
|
|
|
|
|
|
|
|
- `bound_regions` `(array: [])`: The list of regions that a GCE instance must
|
|
|
|
belong to in order to be authenticated. If `bound_instance_groups` is
|
|
|
|
provided, it is assumed to be a regional group and the group must belong to
|
|
|
|
this region. If `bound_zones` are provided, this attribute is ignored.
|
2017-09-21 21:14:40 +00:00
|
|
|
|
2018-07-11 19:52:22 +00:00
|
|
|
- `bound_instance_groups` `(array: [])`: The instance groups that an authorized
|
|
|
|
instance must belong to in order to be authenticated. If specified, either
|
|
|
|
`bound_zones` or `bound_regions` must be set too.
|
2017-09-21 21:14:40 +00:00
|
|
|
|
2018-07-11 19:52:22 +00:00
|
|
|
- `bound_labels` `(array: [])`: A comma-separated list of GCP labels formatted
|
|
|
|
as "key:value" strings that must be set on authorized GCE instances. Because
|
|
|
|
GCP labels are not currently ACL'd, we recommend that this be used in
|
|
|
|
conjunction with other restrictions.
|
2017-09-19 12:44:05 +00:00
|
|
|
|
2017-08-16 02:03:04 +00:00
|
|
|
### Sample Payload
|
|
|
|
|
2018-07-11 19:52:22 +00:00
|
|
|
Example `iam` role:
|
2017-08-16 02:03:04 +00:00
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"type": "iam",
|
2018-07-11 19:52:22 +00:00
|
|
|
"project_id": "project-123456",
|
|
|
|
"policies": ["prod"],
|
|
|
|
"ttl": "30m",
|
|
|
|
"max_ttl": "24h",
|
|
|
|
"max_jwt_exp": "5m",
|
2018-07-31 14:57:34 +00:00
|
|
|
"bound_service_accounts": [
|
2018-07-11 19:52:22 +00:00
|
|
|
"dev-1@project-123456.iam.gserviceaccount.com"
|
|
|
|
]
|
2017-09-19 12:44:05 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2018-07-11 19:52:22 +00:00
|
|
|
Example `gce` role:
|
2017-09-19 12:44:05 +00:00
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"type": "gce",
|
2018-07-11 19:52:22 +00:00
|
|
|
"project_id": "project-123456",
|
|
|
|
"policies": ["prod"],
|
|
|
|
"bound_zones": ["us-east1-b", "eu-west2-a"],
|
|
|
|
"ttl": "30m",
|
|
|
|
"max_ttl": "24h",
|
|
|
|
"bound_service_accounts": [
|
|
|
|
"dev-1@project-123456.iam.gserviceaccount.com"
|
|
|
|
]
|
2017-08-16 02:03:04 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
|
|
```
|
|
|
|
$ curl \
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
--request POST \
|
|
|
|
--data @payload.json \
|
2018-07-11 19:52:22 +00:00
|
|
|
http://127.0.0.1:8200/v1/auth/gcp/role/my-role
|
2017-08-16 02:03:04 +00:00
|
|
|
```
|
|
|
|
|
2018-07-11 19:52:22 +00:00
|
|
|
## Edit Service Accounts on IAM Role
|
2017-08-16 02:03:04 +00:00
|
|
|
|
2017-09-13 01:48:52 +00:00
|
|
|
Edit service accounts for an existing IAM role in the method.
|
2017-08-16 02:03:04 +00:00
|
|
|
This allows you to add or remove service accounts from the list of
|
|
|
|
service accounts on the role.
|
|
|
|
|
2019-03-22 16:15:37 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :---------------------------------------| :------------------|
|
|
|
|
| `POST` | `/auth/gcp/role/:name/service-accounts` |
|
2017-08-16 02:03:04 +00:00
|
|
|
|
|
|
|
### Parameters
|
2018-07-11 19:52:22 +00:00
|
|
|
|
|
|
|
- `name` `(string: <required>)` - The name of an existing `iam` type role. This
|
|
|
|
will return an error if role is not an `iam` type role.
|
|
|
|
|
|
|
|
- `add` `(array: [])` - The list of service accounts to add to the role's
|
|
|
|
service accounts.
|
|
|
|
|
|
|
|
- `remove` `(array: [])` - The list of service accounts to remove from the
|
|
|
|
role's service accounts.
|
2017-08-16 02:03:04 +00:00
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"add": [
|
2018-07-11 19:52:22 +00:00
|
|
|
"dev-1@project-123456.iam.gserviceaccount.com",
|
|
|
|
"123456789"
|
2017-08-16 02:03:04 +00:00
|
|
|
],
|
|
|
|
"remove": [
|
2018-07-11 19:52:22 +00:00
|
|
|
"dev-2@project-123456.iam.gserviceaccount.com"
|
2017-09-19 12:44:05 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
|
|
```
|
|
|
|
$ curl \
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
--request POST \
|
|
|
|
--data @payload.json \
|
2018-07-11 19:52:22 +00:00
|
|
|
http://127.0.0.1:8200/v1/auth/gcp/role/my-role
|
2017-09-19 12:44:05 +00:00
|
|
|
```
|
|
|
|
|
2018-07-11 19:52:22 +00:00
|
|
|
## Edit Labels on GCE Role
|
2017-09-19 12:44:05 +00:00
|
|
|
|
2018-07-11 19:52:22 +00:00
|
|
|
Edit labels for an existing GCE role in the backend. This allows you to add or
|
|
|
|
remove labels (keys, values, or both) from the list of keys on the role.
|
2017-09-19 12:44:05 +00:00
|
|
|
|
2019-03-22 16:15:37 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :---------------------------------------| :------------------|
|
|
|
|
| `POST` | `/auth/gcp/role/:name/labels` |
|
2017-09-19 12:44:05 +00:00
|
|
|
|
|
|
|
### Parameters
|
2018-07-11 19:52:22 +00:00
|
|
|
|
|
|
|
- `name` `(string: <required>)` - The name of an existing `gce` role. This will
|
|
|
|
return an error if role is not a `gce` type role.
|
|
|
|
|
|
|
|
- `add` `(array: [])` - The list of `key:value` labels to add to the GCE role's
|
|
|
|
bound labels.
|
|
|
|
|
|
|
|
- `remove` `(array: [])` - The list of label _keys_ to remove from the role's
|
|
|
|
bound labels. If any of the specified keys do not exist, no error is returned
|
|
|
|
(idempotent).
|
2017-09-21 21:14:40 +00:00
|
|
|
|
2017-09-19 12:44:05 +00:00
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"add": [
|
2018-07-11 19:52:22 +00:00
|
|
|
"foo:bar",
|
|
|
|
"env:dev",
|
|
|
|
"key:value"
|
2017-08-16 02:03:04 +00:00
|
|
|
],
|
2017-09-19 12:44:05 +00:00
|
|
|
"remove": [
|
2018-07-11 19:52:22 +00:00
|
|
|
"key1",
|
|
|
|
"key2"
|
2017-09-19 12:44:05 +00:00
|
|
|
]
|
2017-08-16 02:03:04 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
|
|
```
|
|
|
|
$ curl \
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
--request POST \
|
|
|
|
--data @payload.json \
|
2018-07-11 19:52:22 +00:00
|
|
|
http://127.0.0.1:8200/v1/auth/gcp/role/my-role
|
2017-08-16 02:03:04 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Read Role
|
|
|
|
|
|
|
|
Returns the previously registered role configuration.
|
|
|
|
|
2019-03-22 16:15:37 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :--------------------------- | :--------------------- |
|
|
|
|
| `GET` | `/auth/gcp/role/:name` |
|
2017-08-16 02:03:04 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
2018-07-11 19:52:22 +00:00
|
|
|
- `name` `(string: <required>)` - The name of the role to read.
|
2017-08-16 02:03:04 +00:00
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
|
|
```
|
|
|
|
$ curl \
|
|
|
|
--header "X-Vault-Token: ..." \
|
2018-07-11 19:52:22 +00:00
|
|
|
http://127.0.0.1:8200/v1/auth/gcp/role/my-role
|
2017-08-16 02:03:04 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
2018-07-11 19:52:22 +00:00
|
|
|
"data": {
|
|
|
|
"bound_labels": {
|
|
|
|
"env": "dev",
|
|
|
|
"foo": "bar",
|
|
|
|
"key": "value"
|
2017-08-16 02:03:04 +00:00
|
|
|
},
|
2018-07-11 19:52:22 +00:00
|
|
|
"bound_service_accounts": [
|
|
|
|
"dev-1@project-123456.iam.gserviceaccount.com"
|
|
|
|
],
|
|
|
|
"bound_zones": [
|
|
|
|
"eu-west2-a",
|
|
|
|
"us-east1-b"
|
|
|
|
],
|
|
|
|
"max_ttl": 86400,
|
|
|
|
"policies": [
|
|
|
|
"prod"
|
|
|
|
],
|
|
|
|
"project_id": "project-123456",
|
2018-11-15 21:56:12 +00:00
|
|
|
"type": "gce",
|
2018-07-11 19:52:22 +00:00
|
|
|
"ttl": 1800
|
|
|
|
}
|
2017-08-16 02:03:04 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## List Roles
|
|
|
|
|
|
|
|
Lists all the roles that are registered with the plugin.
|
|
|
|
|
2019-03-22 16:15:37 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :--------------------------- | :--------------------- |
|
|
|
|
| `LIST` | `/auth/gcp/roles` |
|
2017-08-16 02:03:04 +00:00
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
|
|
```
|
|
|
|
$ curl \
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
--request LIST \
|
2018-03-23 15:41:51 +00:00
|
|
|
http://127.0.0.1:8200/v1/auth/gcp/roles
|
2017-08-16 02:03:04 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
2018-07-11 19:52:22 +00:00
|
|
|
"data": {
|
|
|
|
"keys": [
|
|
|
|
"my-role",
|
|
|
|
"my-other-role"
|
|
|
|
]
|
|
|
|
}
|
2017-08-16 02:03:04 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Delete Role
|
|
|
|
|
|
|
|
Deletes the previously registered role.
|
|
|
|
|
2019-03-22 16:15:37 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :--------------------------- | :--------------------- |
|
|
|
|
| `DELETE` | `/auth/gcp/role/:role` |
|
2017-08-16 02:03:04 +00:00
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
2018-07-11 19:52:22 +00:00
|
|
|
- `role` `(string: <required>)` - The name of the role to delete.
|
2017-08-16 02:03:04 +00:00
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
|
|
```
|
|
|
|
$ curl \
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
--request DELETE \
|
2018-07-11 19:52:22 +00:00
|
|
|
http://127.0.0.1:8200/v1/auth/gcp/role/my-role
|
2017-08-16 02:03:04 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Login
|
|
|
|
|
2018-07-11 19:52:22 +00:00
|
|
|
Login to retrieve a Vault token. This endpoint takes a signed JSON Web Token
|
|
|
|
(JWT) and a role name for some entity. It verifies the JWT signature with Google
|
|
|
|
Cloud to authenticate that entity and then authorizes the entity for the given
|
|
|
|
role.
|
2017-08-16 02:03:04 +00:00
|
|
|
|
2019-03-22 16:15:37 +00:00
|
|
|
| Method | Path |
|
|
|
|
| :--------------------------- | :--------------------- |
|
|
|
|
| `POST` | `/auth/gcp/login` |
|
2017-08-16 02:03:04 +00:00
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
2018-07-11 19:52:22 +00:00
|
|
|
- `role` `(string: <required>)` - The name of the role against which the login
|
|
|
|
is being attempted.
|
|
|
|
|
|
|
|
- `jwt` `(string: <required>)` - A Signed [JSON Web Token][jwt].
|
|
|
|
|
|
|
|
- For `iam` type roles, this is a JWT signed with the
|
|
|
|
[`signJwt` method][signjwt-method] or a self-signed JWT.
|
|
|
|
|
|
|
|
- For `gce` type roles, this is an [identity metadata token][instance-token].
|
2017-08-16 02:03:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
2018-07-11 19:52:22 +00:00
|
|
|
"role": "my-role",
|
|
|
|
"jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
|
2017-08-16 02:03:04 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
|
|
```
|
|
|
|
$ curl \
|
|
|
|
--request POST \
|
|
|
|
--data @payload.json \
|
2018-03-23 15:41:51 +00:00
|
|
|
http://127.0.0.1:8200/v1/auth/gcp/login
|
2017-08-16 02:03:04 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
2018-07-11 19:52:22 +00:00
|
|
|
"auth": {
|
|
|
|
"client_token": "f33f8c72-924e-11f8-cb43-ac59d697597c",
|
|
|
|
"accessor": "0e9e354a-520f-df04-6867-ee81cae3d42d",
|
|
|
|
"policies": [
|
|
|
|
"default",
|
|
|
|
"dev",
|
|
|
|
"prod"
|
|
|
|
],
|
|
|
|
"metadata": {
|
2018-12-10 20:54:18 +00:00
|
|
|
"project_id": "my-project",
|
2018-07-11 19:52:22 +00:00
|
|
|
"role": "my-role",
|
|
|
|
"service_account_email": "dev1@project-123456.iam.gserviceaccount.com",
|
|
|
|
"service_account_id": "111111111111111111111"
|
2017-08-16 02:03:04 +00:00
|
|
|
},
|
2018-07-11 19:52:22 +00:00
|
|
|
"lease_duration": 2764800,
|
|
|
|
"renewable": true
|
|
|
|
}
|
2017-08-16 02:03:04 +00:00
|
|
|
}
|
|
|
|
```
|
2018-07-11 19:52:22 +00:00
|
|
|
|
|
|
|
[gcp-adc]: https://developers.google.com/identity/protocols/application-default-credentials
|
|
|
|
[jwt]: https://tools.ietf.org/html/rfc7519
|
|
|
|
[signjwt-method]: https://cloud.google.com/iam/reference/rest/v1/projects.serviceAccounts/signJwt
|
|
|
|
[instance-token]: https://cloud.google.com/compute/docs/instances/verifying-instance-identity#request_signature
|