From c27d4a089c70bf25f0e16f3bc3c5c64ffc5b96ac Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Fri, 25 Nov 2022 16:59:38 +0400 Subject: [PATCH] OCI: WWW-Authenticate's scheme should be treated case-insensitive (#336) --- Sources/tart/OCI/Registry.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/tart/OCI/Registry.swift b/Sources/tart/OCI/Registry.swift index 9e193e6..30c0a06 100644 --- a/Sources/tart/OCI/Registry.swift +++ b/Sources/tart/OCI/Registry.swift @@ -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") }