Skip to content

Commit

Permalink
Add read/write mutex for refreshing access token
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhung committed Nov 21, 2024
1 parent 3ccc3ad commit ca05dd3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
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 ca05dd3

Please sign in to comment.