Skip to content

Commit

Permalink
Merge pull request #226 from jfrog/GH-225-fix-concurrency-issue
Browse files Browse the repository at this point in the history
Add read/write mutex for refreshing access token
  • Loading branch information
alexhung authored Nov 21, 2024
2 parents 3ccc3ad + cc0353d commit e031c3a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.8.2 (November 21, 2024). Tested on Artifactory 7.98.8 with Vault v1.18.1 and OpenBao v2.0.0

BUG FIXES:

* Fix concurrency error when refreshing user token. Issue: [#225](https://github.com/jfrog/artifactory-secrets-plugin/issues/225) PR: [#226](https://github.com/jfrog/artifactory-secrets-plugin/pull/226)

## 1.8.1 (November 8, 2024). Tested on Artifactory 7.98.8 with Vault v1.18.1 and OpenBao v2.0.0

BUG FIXES:
Expand Down
1 change: 0 additions & 1 deletion artifactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ func (b *backend) CreateToken(config baseConfiguration, role artifactoryRole) (*
return nil, createErr
}

//noinspection GoUnhandledErrorResult
defer resp.Body.Close()

if resp.StatusCode != http.StatusOK {
Expand Down
3 changes: 3 additions & 0 deletions path_config_user_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ type userTokenConfiguration struct {
}

func (c *userTokenConfiguration) RefreshAccessToken(ctx context.Context, req *logical.Request, username string, b *backend, adminBaseConfig baseConfiguration) error {
b.configMutex.Lock()
defer b.configMutex.Unlock()

logger := b.Logger().With("func", "RefreshAccessToken")

if c.RefreshToken == "" {
Expand Down

0 comments on commit e031c3a

Please sign in to comment.