From 93bac074b3f7bd347c329377bf8c14aed7f43c00 Mon Sep 17 00:00:00 2001 From: Jonas Hungershausen Date: Thu, 1 Dec 2022 03:15:40 -0500 Subject: [PATCH] fix: add `client_id` and `client_secret` to `revokeOAuth2Token` (#3373) --- internal/httpclient/api/openapi.yaml | 6 ++++++ internal/httpclient/api_o_auth2.go | 24 +++++++++++++++++++++--- internal/httpclient/docs/OAuth2Api.md | 8 ++++++-- oauth2/handler.go | 4 ++++ spec/api.json | 8 ++++++++ spec/swagger.json | 10 ++++++++++ 6 files changed, 55 insertions(+), 5 deletions(-) diff --git a/internal/httpclient/api/openapi.yaml b/internal/httpclient/api/openapi.yaml index eed2cc8c086..af39890e648 100644 --- a/internal/httpclient/api/openapi.yaml +++ b/internal/httpclient/api/openapi.yaml @@ -4136,6 +4136,12 @@ components: type: object revokeOAuth2Token_request: properties: + client_id: + type: string + x-formData-name: client_id + client_secret: + type: string + x-formData-name: client_secret token: required: - token diff --git a/internal/httpclient/api_o_auth2.go b/internal/httpclient/api_o_auth2.go index 7687167f745..9b96b941b1f 100644 --- a/internal/httpclient/api_o_auth2.go +++ b/internal/httpclient/api_o_auth2.go @@ -3065,9 +3065,11 @@ func (a *OAuth2ApiService) RevokeOAuth2LoginSessionsExecute(r ApiRevokeOAuth2Log } type ApiRevokeOAuth2TokenRequest struct { - ctx context.Context - ApiService *OAuth2ApiService - token *string + ctx context.Context + ApiService *OAuth2ApiService + token *string + clientId *string + clientSecret *string } func (r ApiRevokeOAuth2TokenRequest) Token(token string) ApiRevokeOAuth2TokenRequest { @@ -3075,6 +3077,16 @@ func (r ApiRevokeOAuth2TokenRequest) Token(token string) ApiRevokeOAuth2TokenReq return r } +func (r ApiRevokeOAuth2TokenRequest) ClientId(clientId string) ApiRevokeOAuth2TokenRequest { + r.clientId = &clientId + return r +} + +func (r ApiRevokeOAuth2TokenRequest) ClientSecret(clientSecret string) ApiRevokeOAuth2TokenRequest { + r.clientSecret = &clientSecret + return r +} + func (r ApiRevokeOAuth2TokenRequest) Execute() (*http.Response, error) { return r.ApiService.RevokeOAuth2TokenExecute(r) } @@ -3136,6 +3148,12 @@ func (a *OAuth2ApiService) RevokeOAuth2TokenExecute(r ApiRevokeOAuth2TokenReques if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + if r.clientId != nil { + localVarFormParams.Add("client_id", parameterToString(*r.clientId, "")) + } + if r.clientSecret != nil { + localVarFormParams.Add("client_secret", parameterToString(*r.clientSecret, "")) + } localVarFormParams.Add("token", parameterToString(*r.token, "")) req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { diff --git a/internal/httpclient/docs/OAuth2Api.md b/internal/httpclient/docs/OAuth2Api.md index 0f986582787..92b361e2bb8 100644 --- a/internal/httpclient/docs/OAuth2Api.md +++ b/internal/httpclient/docs/OAuth2Api.md @@ -1662,7 +1662,7 @@ No authorization required ## RevokeOAuth2Token -> RevokeOAuth2Token(ctx).Token(token).Execute() +> RevokeOAuth2Token(ctx).Token(token).ClientId(clientId).ClientSecret(clientSecret).Execute() Revoke OAuth 2.0 Access or Refresh Token @@ -1682,10 +1682,12 @@ import ( func main() { token := "token_example" // string | + clientId := "clientId_example" // string | (optional) + clientSecret := "clientSecret_example" // string | (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.OAuth2Api.RevokeOAuth2Token(context.Background()).Token(token).Execute() + resp, r, err := apiClient.OAuth2Api.RevokeOAuth2Token(context.Background()).Token(token).ClientId(clientId).ClientSecret(clientSecret).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OAuth2Api.RevokeOAuth2Token``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -1705,6 +1707,8 @@ Other parameters are passed through a pointer to a apiRevokeOAuth2TokenRequest s Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **token** | **string** | | + **clientId** | **string** | | + **clientSecret** | **string** | | ### Return type diff --git a/oauth2/handler.go b/oauth2/handler.go index 5317e15859b..b234f436d3f 100644 --- a/oauth2/handler.go +++ b/oauth2/handler.go @@ -614,6 +614,10 @@ type revokeOAuth2Token struct { // in: formData // required: true Token string `json:"token"` + // in: formData + ClientID string `json:"client_id"` + // in: formData + ClientSecret string `json:"client_secret"` } // swagger:route POST /oauth2/revoke oAuth2 revokeOAuth2Token diff --git a/spec/api.json b/spec/api.json index 5a9673ea723..599fc02a152 100644 --- a/spec/api.json +++ b/spec/api.json @@ -3419,6 +3419,14 @@ "application/x-www-form-urlencoded": { "schema": { "properties": { + "client_id": { + "type": "string", + "x-formData-name": "client_id" + }, + "client_secret": { + "type": "string", + "x-formData-name": "client_secret" + }, "token": { "required": [ "token" diff --git a/spec/swagger.json b/spec/swagger.json index c73b76f097f..ea11ddf6749 100755 --- a/spec/swagger.json +++ b/spec/swagger.json @@ -1870,6 +1870,16 @@ "name": "token", "in": "formData", "required": true + }, + { + "type": "string", + "name": "client_id", + "in": "formData" + }, + { + "type": "string", + "name": "client_secret", + "in": "formData" } ], "responses": {