Skip to content

Commit

Permalink
Fix excluding locally generated refresh tokens (#934)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobiNino authored Sep 5, 2023
1 parent 8818ec5 commit 90c9d87
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion utils/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,14 @@ func GetSpecificConfig(serverId string, defaultOrEmpty bool, excludeRefreshableT
return details, nil
}

// Disables refreshable tokens if set in details.
// Disables the refreshable tokens mechanism if set in details.
// We identify the refreshable tokens mechanism by having both conditions:
// 1. Non-empty username and password
// 2. Non-empty access and refresh token OR token refresh interval enabled
func excludeRefreshableTokensFromDetails(details *ServerDetails) {
if details.WebLogin || details.User == "" || details.Password == "" {
return
}
if details.AccessToken != "" && details.ArtifactoryRefreshToken != "" ||
details.AccessToken != "" && details.RefreshToken != "" {
details.AccessToken = ""
Expand Down

0 comments on commit 90c9d87

Please sign in to comment.