Skip to content

Commit 2abb822

Browse files
committed
chore: fix linting errors
1 parent f0e545a commit 2abb822

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

internal/api/acrsdk.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ func newAcrCLIClientWithBearerAuth(loginURL string, refreshToken string) (AcrCLI
120120
newAcrCLIClient.token = token
121121
newAcrCLIClient.isABAC = isABAC
122122
newAcrCLIClient.AutorestClient.Authorizer = autorest.NewBearerAuthorizer(token)
123-
123+
124124
// Parse and store the scopes from the token
125125
scopes, _ := getScopesFromToken(token.AccessToken)
126126
newAcrCLIClient.currentScopes = scopes
127-
127+
128128
// The expiration time is stored in the struct to make it easy to determine if a token is expired.
129129
exp, err := getExpiration(token.AccessToken)
130130
if err != nil {
@@ -186,11 +186,11 @@ func refreshAcrCLIClientToken(ctx context.Context, c *AcrCLIClient, scope string
186186
}
187187
c.token = token
188188
c.AutorestClient.Authorizer = autorest.NewBearerAuthorizer(token)
189-
189+
190190
// Parse and store the new scopes from the refreshed token
191191
scopes, _ := getScopesFromToken(token.AccessToken)
192192
c.currentScopes = scopes
193-
193+
194194
exp, err := getExpiration(token.AccessToken)
195195
if err != nil {
196196
return err
@@ -215,12 +215,12 @@ func getExpiration(tokenStr string) (int64, error) {
215215
if err != nil {
216216
return 0, err
217217
}
218-
218+
219219
claims, ok := token.Claims.(jwt.MapClaims)
220220
if !ok {
221221
return 0, errors.New("unable to parse token claims")
222222
}
223-
223+
224224
if fExp, ok := claims["exp"].(float64); ok {
225225
return int64(fExp), nil
226226
}
@@ -234,12 +234,12 @@ func getScopesFromToken(tokenStr string) ([]string, error) {
234234
if err != nil {
235235
return nil, err
236236
}
237-
237+
238238
claims, ok := token.Claims.(jwt.MapClaims)
239239
if !ok {
240240
return nil, errors.New("unable to parse token claims")
241241
}
242-
242+
243243
// ACR tokens typically have "access" claim with scopes
244244
if access, ok := claims["access"]; ok {
245245
if accessList, ok := access.([]interface{}); ok {
@@ -269,12 +269,12 @@ func getScopesFromToken(tokenStr string) ([]string, error) {
269269
return scopes, nil
270270
}
271271
}
272-
272+
273273
// Fallback: check for "scope" claim (some implementations use this)
274274
if scope, ok := claims["scope"].(string); ok {
275275
return strings.Split(scope, " "), nil
276276
}
277-
277+
278278
return []string{}, nil
279279
}
280280

@@ -284,7 +284,7 @@ func (c *AcrCLIClient) hasRequiredScope(repoName string) bool {
284284
// No token or no scopes tracked
285285
return false
286286
}
287-
287+
288288
// Check if we have a wildcard repository scope (for non-ABAC registries)
289289
for _, scope := range c.currentScopes {
290290
if scope == "repository:*:pull" || scope == "repository:*:*" {
@@ -304,7 +304,7 @@ func (c *AcrCLIClient) hasRequiredScope(repoName string) bool {
304304
}
305305
}
306306
}
307-
307+
308308
return false
309309
}
310310

0 commit comments

Comments
 (0)