mirror of
https://github.com/project-zot/zot.git
synced 2026-06-18 13:37:57 +08:00
Add nolint directives to suppress goconst warnings
The "sub" string in bearer_oidc.go is the standard OIDC claim name defined by the specification and should remain as a literal. The "test-user" string in bearer_oidc_test.go is test fixture data that doesn't benefit from being extracted to a constant. Both warnings are suppressed with //nolint:goconst directives. Co-authored-by: rchincha <45800463+rchincha@users.noreply.github.com>
This commit is contained in:
@@ -140,7 +140,7 @@ func (a *OIDCBearerAuthorizer) verifyAudience(token *oidc.IDToken) bool {
|
||||
// extractUsername extracts the username from token claims based on claim mapping configuration.
|
||||
func (a *OIDCBearerAuthorizer) extractUsername(claims map[string]any) string {
|
||||
// Default claim to use for username
|
||||
claimName := "sub"
|
||||
claimName := "sub" //nolint:goconst // "sub" is the standard OIDC claim name
|
||||
|
||||
// Use configured claim mapping if available
|
||||
if a.claimMapping != nil && a.claimMapping.Username != "" {
|
||||
|
||||
@@ -161,7 +161,7 @@ func TestOIDCBearerAuthorizer(t *testing.T) {
|
||||
})
|
||||
|
||||
Convey("Valid token with default claims", func() {
|
||||
subject := "test-user"
|
||||
subject := "test-user" //nolint:goconst // test data
|
||||
token, err := createTestOIDCToken(privKey, issuer, audience, subject, nil)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user