mirror of
https://github.com/project-zot/zot.git
synced 2026-06-15 11:37:56 +08:00
fix(api): clarify nolint comment and add fallback doc in bearer_oidc.go
Agent-Logs-Url: https://github.com/project-zot/zot/sessions/1a321663-3147-46e9-9321-989e5dd0ed3c Co-authored-by: rchincha <45800463+rchincha@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
4372a3faca
commit
1182981b0d
@@ -236,10 +236,12 @@ func getOIDCTokenFromAuthorizationHeader(header string, allowBasicAuth bool) (st
|
||||
}
|
||||
|
||||
pair := strings.SplitN(string(decodedStr), ":", 2) //nolint:mnd
|
||||
if len(pair) != 2 { //nolint:mnd
|
||||
if len(pair) != 2 { //nolint:mnd
|
||||
return "", zerr.ErrInvalidBearerToken
|
||||
}
|
||||
|
||||
// Prefer the password field as the token; fall back to the username field
|
||||
// when the password is empty (e.g. "token:" basic-auth encoding).
|
||||
tokenString := pair[1]
|
||||
if tokenString == "" {
|
||||
tokenString = pair[0]
|
||||
|
||||
Reference in New Issue
Block a user