mirror of
https://github.com/cirruslabs/tart.git
synced 2026-09-30 03:01:12 +02:00
OCI: WWW-Authenticate's scheme should be treated case-insensitive (#336)
This commit is contained in:
@@ -312,7 +312,7 @@ class Registry {
|
|||||||
|
|
||||||
let wwwAuthenticate = try WWWAuthenticate(rawHeaderValue: wwwAuthenticateRaw)
|
let wwwAuthenticate = try WWWAuthenticate(rawHeaderValue: wwwAuthenticateRaw)
|
||||||
|
|
||||||
if wwwAuthenticate.scheme == "Basic" {
|
if wwwAuthenticate.scheme.lowercased() == "basic" {
|
||||||
if let (user, password) = try lookupCredentials(host: baseURL.host!) {
|
if let (user, password) = try lookupCredentials(host: baseURL.host!) {
|
||||||
currentAuthToken = BasicAuthentication(user: user, password: password)
|
currentAuthToken = BasicAuthentication(user: user, password: password)
|
||||||
}
|
}
|
||||||
@@ -320,7 +320,7 @@ class Registry {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if wwwAuthenticate.scheme != "Bearer" {
|
if wwwAuthenticate.scheme.lowercased() != "bearer" {
|
||||||
throw RegistryError.AuthFailed(why: "WWW-Authenticate header's authentication scheme "
|
throw RegistryError.AuthFailed(why: "WWW-Authenticate header's authentication scheme "
|
||||||
+ "\"\(wwwAuthenticate.scheme)\" is unsupported, expected \"Bearer\" scheme")
|
+ "\"\(wwwAuthenticate.scheme)\" is unsupported, expected \"Bearer\" scheme")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user