From 0b039f1628d544eba2089c3aeb2ac5ab192f19eb Mon Sep 17 00:00:00 2001 From: Tien Nguyen Date: Wed, 22 May 2024 12:53:07 -0400 Subject: [PATCH 1/2] prep release 4.1.0 Signed-off-by: Tien Nguyen --- .generator/config.yaml | 2 +- .generator/templates/client.mustache | 19 ++++++++++++++----- CHANGELOG.md | 7 ++++++- openapitools.json | 7 +++++++ 4 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 openapitools.json diff --git a/.generator/config.yaml b/.generator/config.yaml index 43c3b903..daed8e46 100644 --- a/.generator/config.yaml +++ b/.generator/config.yaml @@ -8,7 +8,7 @@ additionalProperties: enumClassPrefix: true generateInterfaces: true packageName: okta - packageVersion: 4.0.0 + packageVersion: 4.1.0 useOneOfDiscriminatorLookup: true disallowAdditionalPropertiesIfNotPresent: false files: diff --git a/.generator/templates/client.mustache b/.generator/templates/client.mustache index ba76be84..f18efe2d 100644 --- a/.generator/templates/client.mustache +++ b/.generator/templates/client.mustache @@ -396,8 +396,12 @@ func getAccessTokenForPrivateKey(httpClient *http.Client, orgURL, clientAssertio tokenResponse.Body = origResp var accessToken *RequestAccessToken - if tokenResponse.StatusCode >= 400 && strings.Contains(string(respBody), "invalid_dpop_proof") { - return getAccessTokenForDpopPrivateKey(tokenRequest, httpClient, orgURL, "", maxRetries, maxBackoff) + if tokenResponse.StatusCode >= 300 { + if strings.Contains(string(respBody), "invalid_dpop_proof") { + return getAccessTokenForDpopPrivateKey(tokenRequest, httpClient, orgURL, "", maxRetries, maxBackoff) + } else { + return nil, "", nil, err + } } _, err = buildResponse(tokenResponse, nil, &accessToken) @@ -436,9 +440,14 @@ func getAccessTokenForDpopPrivateKey(tokenRequest *http.Request, httpClient *htt if err != nil { return nil, "", nil, err } - if tokenResponse.StatusCode >= 400 && strings.Contains(string(respBody), "use_dpop_nonce") { - newNonce := tokenResponse.Header.Get("Dpop-Nonce") - return getAccessTokenForDpopPrivateKey(tokenRequest, httpClient, orgURL, newNonce, maxRetries, maxBackoff) + + if tokenResponse.StatusCode >= 300 { + if strings.Contains(string(respBody), "use_dpop_nonce") { + newNonce := tokenResponse.Header.Get("Dpop-Nonce") + return getAccessTokenForDpopPrivateKey(tokenRequest, httpClient, orgURL, newNonce, maxRetries, maxBackoff) + } else { + return nil, "", nil, err + } } origResp := io.NopCloser(bytes.NewBuffer(respBody)) tokenResponse.Body = origResp diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d09ac54..8dfab6ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,13 @@ # Changelog Running changelog of releases since `2.0.0-rc.4` +## v4.1.0 + - Add support for dpop (#454) Thanks [@duytiennguyen-okta] + - Fix object that does not have additional properties (#456) Thanks [@duytiennguyen-okta] + - Fix header accept issue that only accept application/json (#457) Thanks [@duytiennguyen-okta] + ## v4.0.0 - - Release v4 version of the sdk base on openapi spec v3 (#427) Thanks [@duytiennguyen-okta] + - Release v4 version of the sdk base on openapi spec v3 (#4) Thanks [@duytiennguyen-okta] ## v2.19.0 - Upgrade dependency (#378) Thanks [@duytiennguyen-okta] diff --git a/openapitools.json b/openapitools.json new file mode 100644 index 00000000..4053ae89 --- /dev/null +++ b/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "7.0.1" + } +} From 8f520c23becd32cde52c634574c1be61821d546e Mon Sep 17 00:00:00 2001 From: Tien Nguyen Date: Wed, 22 May 2024 12:56:48 -0400 Subject: [PATCH 2/2] remove unused Signed-off-by: Tien Nguyen --- openapitools.json | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 openapitools.json diff --git a/openapitools.json b/openapitools.json deleted file mode 100644 index 4053ae89..00000000 --- a/openapitools.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "spaces": 2, - "generator-cli": { - "version": "7.0.1" - } -}