Create named token for current provider
Creates a new named token for the provider. The token name must be unique for the provider.
This operation can be invoked on behalf of the current provider only.
You can learn more about named and temporary tokens here.
Example cURL requests
Create named token for current provider
curl -H "x-auth-token: $TOKEN" -X POST -d '{"name": "new-token"}' \
-H 'Content-type: application/json' \
https://$HOST/api/v3/onezone/provider/tokens/named
Request body
Properties of the new named token.
| Property | Type & Description | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name string (TokenPropertyName) Token name (unique for subject user/provider) | |||||||||||||||||||||||||||||||||||||||
type object (TokenPropertyTokenType) The type of the token (object) Enum: {accessToken: {}}{identityToken: {}}{inviteToken: {"...": "..."}}
| |||||||||||||||||||||||||||||||||||||||
caveats array of objects (Caveat) A list of caveats that confine the token.
| |||||||||||||||||||||||||||||||||||||||
customMetadata object (TokenPropertyCustomMetadata) Arbitrary user metadata (JSON) attached to the token | |||||||||||||||||||||||||||||||||||||||
revoked boolean (TokenPropertyRevoked) Determines if this token is revoked (cannot be used) - can be toggled at will | |||||||||||||||||||||||||||||||||||||||
privileges array of strings A list of privileges that will be granted to the user that consumes the invite token. NOTE that this parameter is recognized only if the token type is invite token and the invitation target supports member privileges. The privileges must be valid for given invite token type (for example, group privileges for | |||||||||||||||||||||||||||||||||||||||
usageLimit integer (InviteTokenPropertyUsageLimit) Usage limit for an invite token (positive integer) or | |||||||||||||||||||||||||||||||||||||||
Request Examples
{
"name": "New Token",
"type": {
"inviteToken": {
"inviteType": "userJoinCluster",
"clusterId": "fb73f7ceff5abd995357abbe01c812ce"
}
},
"caveats": [
{
"type": "time",
"validUntil": 1571147494
},
{
"type": "ip",
"whitelist": [
"189.34.15.0/8",
"127.0.0.0/24",
"167.73.12.17"
]
}
],
"customMetadata": {
"jobName": "experiment-15",
"vm": "worker156.cloud.local"
},
"revoked": false,
"privileges": [
"cluster_view",
"cluster_update",
"cluster_delete",
"cluster_view_privileges",
"cluster_set_privileges"
],
"usageLimit": 15
}Responses
Response body contains the Id of newly created named token and its serialized form. Additionally, URI of the created named token in form https://$HOST/api/onezone/v3/tokens/named/{id} is returned in the response Location header.
| Property | Type & Description |
|---|---|
tokenId string (TokenPropertyId) Unique identifier of the token | |
token string (SerializedToken) The token in serialized form. | |
Example
{
"tokenId": "2b5d0dd5aa6443a69277b5ce0544fec2",
"token": "MDAxNWxvY2F0aW9uIG9uZXpvbmUKMDAzYmlkZW50aWZpZXIgOEhmSEFSSGdrbHFCa1pWSTR"
}Invalid request.
| Property | Type & Description | ||||||
|---|---|---|---|---|---|---|---|
error object Object describing an error.
| |||||||
Example
{
"error": {
"id": "badValueString",
"details": {
"key": "name"
},
"description": "Bad value: provided \"name\" must be a string."
}
}Authentication error.
| Property | Type & Description | ||||||
|---|---|---|---|---|---|---|---|
error object Object describing an error.
| |||||||
Example
{
"error": {
"id": "badValueString",
"details": {
"key": "name"
},
"description": "Bad value: provided \"name\" must be a string."
}
}Authorization error.
| Property | Type & Description | ||||||
|---|---|---|---|---|---|---|---|
error object Object describing an error.
| |||||||
Example
{
"error": {
"id": "badValueString",
"details": {
"key": "name"
},
"description": "Bad value: provided \"name\" must be a string."
}
}Resource not found.
| Property | Type & Description | ||||||
|---|---|---|---|---|---|---|---|
error object Object describing an error.
| |||||||
Example
{
"error": {
"id": "badValueString",
"details": {
"key": "name"
},
"description": "Bad value: provided \"name\" must be a string."
}
}Internal server Error.
| Property | Type & Description | ||||||
|---|---|---|---|---|---|---|---|
error object Object describing an error.
| |||||||
Example
{
"error": {
"id": "badValueString",
"details": {
"key": "name"
},
"description": "Bad value: provided \"name\" must be a string."
}
}