Skip to content

Commit

Permalink
Merge pull request #460 from okta/prep-release-4.1.0
Browse files Browse the repository at this point in the history
prep release 4.1.0
  • Loading branch information
duytiennguyen-okta authored May 22, 2024
2 parents 097ef41 + 8f520c2 commit 90b60d8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .generator/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ additionalProperties:
enumClassPrefix: true
generateInterfaces: true
packageName: okta
packageVersion: 4.0.0
packageVersion: 4.1.0
useOneOfDiscriminatorLookup: true
disallowAdditionalPropertiesIfNotPresent: false
files:
Expand Down
19 changes: 14 additions & 5 deletions .generator/templates/client.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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]
Expand Down

0 comments on commit 90b60d8

Please sign in to comment.