OCI: WWW-Authenticate's scheme should be treated case-insensitive (#336)

This commit is contained in:
Nikolay Edigaryev 2022-11-25 16:59:38 +04:00 committed by GitHub
parent 70f9fcc12e
commit c27d4a089c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -312,7 +312,7 @@ class Registry {
let wwwAuthenticate = try WWWAuthenticate(rawHeaderValue: wwwAuthenticateRaw)
if wwwAuthenticate.scheme == "Basic" {
if wwwAuthenticate.scheme.lowercased() == "basic" {
if let (user, password) = try lookupCredentials(host: baseURL.host!) {
currentAuthToken = BasicAuthentication(user: user, password: password)
}
@ -320,7 +320,7 @@ class Registry {
return
}
if wwwAuthenticate.scheme != "Bearer" {
if wwwAuthenticate.scheme.lowercased() != "bearer" {
throw RegistryError.AuthFailed(why: "WWW-Authenticate header's authentication scheme "
+ "\"\(wwwAuthenticate.scheme)\" is unsupported, expected \"Bearer\" scheme")
}