mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: implement oauth2 RFC 7009 token revocation endpoint (#20362)
Adds RFC 7009 token revocation endpoint
This commit is contained in:
Generated
+45
-4
@@ -809,7 +809,8 @@ curl -X GET http://coder-server:8080/api/v2/oauth2-provider/apps \
|
||||
"endpoints": {
|
||||
"authorization": "string",
|
||||
"device_authorization": "string",
|
||||
"token": "string"
|
||||
"token": "string",
|
||||
"token_revoke": "string"
|
||||
},
|
||||
"icon": "string",
|
||||
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
||||
@@ -836,6 +837,7 @@ Status Code **200**
|
||||
| `»» authorization` | string | false | | |
|
||||
| `»» device_authorization` | string | false | | Device authorization is optional. |
|
||||
| `»» token` | string | false | | |
|
||||
| `»» token_revoke` | string | false | | |
|
||||
| `» icon` | string | false | | |
|
||||
| `» id` | string(uuid) | false | | |
|
||||
| `» name` | string | false | | |
|
||||
@@ -882,7 +884,8 @@ curl -X POST http://coder-server:8080/api/v2/oauth2-provider/apps \
|
||||
"endpoints": {
|
||||
"authorization": "string",
|
||||
"device_authorization": "string",
|
||||
"token": "string"
|
||||
"token": "string",
|
||||
"token_revoke": "string"
|
||||
},
|
||||
"icon": "string",
|
||||
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
||||
@@ -927,7 +930,8 @@ curl -X GET http://coder-server:8080/api/v2/oauth2-provider/apps/{app} \
|
||||
"endpoints": {
|
||||
"authorization": "string",
|
||||
"device_authorization": "string",
|
||||
"token": "string"
|
||||
"token": "string",
|
||||
"token_revoke": "string"
|
||||
},
|
||||
"icon": "string",
|
||||
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
||||
@@ -984,7 +988,8 @@ curl -X PUT http://coder-server:8080/api/v2/oauth2-provider/apps/{app} \
|
||||
"endpoints": {
|
||||
"authorization": "string",
|
||||
"device_authorization": "string",
|
||||
"token": "string"
|
||||
"token": "string",
|
||||
"token_revoke": "string"
|
||||
},
|
||||
"icon": "string",
|
||||
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
||||
@@ -1500,6 +1505,42 @@ curl -X POST http://coder-server:8080/api/v2/oauth2/register \
|
||||
|--------|--------------------------------------------------------------|-------------|--------------------------------------------------------------------------------------------------|
|
||||
| 201 | [Created](https://tools.ietf.org/html/rfc7231#section-6.3.2) | Created | [codersdk.OAuth2ClientRegistrationResponse](schemas.md#codersdkoauth2clientregistrationresponse) |
|
||||
|
||||
## Revoke OAuth2 tokens (RFC 7009)
|
||||
|
||||
### Code samples
|
||||
|
||||
```shell
|
||||
# Example request using curl
|
||||
curl -X POST http://coder-server:8080/api/v2/oauth2/revoke \
|
||||
|
||||
```
|
||||
|
||||
`POST /oauth2/revoke`
|
||||
|
||||
> Body parameter
|
||||
|
||||
```yaml
|
||||
client_id: string
|
||||
token: string
|
||||
token_type_hint: string
|
||||
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
| Name | In | Type | Required | Description |
|
||||
|---------------------|------|--------|----------|-------------------------------------------------------|
|
||||
| `body` | body | object | true | |
|
||||
| `» client_id` | body | string | true | Client ID for authentication |
|
||||
| `» token` | body | string | true | The token to revoke |
|
||||
| `» token_type_hint` | body | string | false | Hint about token type (access_token or refresh_token) |
|
||||
|
||||
### Responses
|
||||
|
||||
| Status | Meaning | Description | Schema |
|
||||
|--------|---------------------------------------------------------|----------------------------|--------|
|
||||
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | Token successfully revoked | |
|
||||
|
||||
## OAuth2 token exchange
|
||||
|
||||
### Code samples
|
||||
|
||||
Generated
+5
-2
@@ -5272,7 +5272,8 @@ Only certain features set these fields: - FeatureManagedAgentLimit|
|
||||
{
|
||||
"authorization": "string",
|
||||
"device_authorization": "string",
|
||||
"token": "string"
|
||||
"token": "string",
|
||||
"token_revoke": "string"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -5283,6 +5284,7 @@ Only certain features set these fields: - FeatureManagedAgentLimit|
|
||||
| `authorization` | string | false | | |
|
||||
| `device_authorization` | string | false | | Device authorization is optional. |
|
||||
| `token` | string | false | | |
|
||||
| `token_revoke` | string | false | | |
|
||||
|
||||
## codersdk.OAuth2AuthorizationServerMetadata
|
||||
|
||||
@@ -5594,7 +5596,8 @@ Only certain features set these fields: - FeatureManagedAgentLimit|
|
||||
"endpoints": {
|
||||
"authorization": "string",
|
||||
"device_authorization": "string",
|
||||
"token": "string"
|
||||
"token": "string",
|
||||
"token_revoke": "string"
|
||||
},
|
||||
"icon": "string",
|
||||
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
||||
|
||||
Reference in New Issue
Block a user