@@ -71,18 +71,19 @@ private static bool TryParseAuthenticationInfo(HttpResponseMessage msg, [NotNull
71
71
if ( header . Scheme is not null )
72
72
{
73
73
scheme = header . Scheme ;
74
- var keyValues = ParseBearerArgs ( header . Parameter ) ;
75
- if ( keyValues is null )
76
- {
77
- return false ;
78
- }
79
74
80
75
if ( header . Scheme . Equals ( BasicAuthScheme , StringComparison . OrdinalIgnoreCase ) )
81
76
{
82
- return TryParseBasicAuthInfo ( keyValues , msg . RequestMessage ! . RequestUri ! , out bearerAuthInfo ) ;
77
+ bearerAuthInfo = null ;
78
+ return true ;
83
79
}
84
80
else if ( header . Scheme . Equals ( BearerAuthScheme , StringComparison . OrdinalIgnoreCase ) )
85
81
{
82
+ var keyValues = ParseBearerArgs ( header . Parameter ) ;
83
+ if ( keyValues is null )
84
+ {
85
+ return false ;
86
+ }
86
87
return TryParseBearerAuthInfo ( keyValues , out bearerAuthInfo ) ;
87
88
}
88
89
else
@@ -110,12 +111,6 @@ static bool TryParseBearerAuthInfo(Dictionary<string, string> authValues, [NotNu
110
111
}
111
112
}
112
113
113
- static bool TryParseBasicAuthInfo ( Dictionary < string , string > authValues , Uri requestUri , out AuthInfo ? authInfo )
114
- {
115
- authInfo = null ;
116
- return true ;
117
- }
118
-
119
114
static Dictionary < string , string > ? ParseBearerArgs ( string ? bearerHeaderArgs )
120
115
{
121
116
if ( bearerHeaderArgs is null )
@@ -159,7 +154,6 @@ public DateTimeOffset ResolvedExpiration
159
154
/// </summary>
160
155
private async Task < ( AuthenticationHeaderValue , DateTimeOffset ) ? > GetAuthenticationAsync ( string registry , string scheme , AuthInfo ? bearerAuthInfo , CancellationToken cancellationToken )
161
156
{
162
-
163
157
DockerCredentials ? privateRepoCreds ;
164
158
// Allow overrides for auth via environment variables
165
159
if ( GetDockerCredentialsFromEnvironment ( _registryMode ) is ( string credU , string credP ) )
@@ -311,8 +305,7 @@ internal static (string credU, string credP)? GetDockerCredentialsFromEnvironmen
311
305
else
312
306
{
313
307
_logger . LogTrace ( Resource . GetString ( nameof ( Strings . CouldntDeserializeJsonToken ) ) ) ;
314
- // logging and returning null to try HTTP GET instead
315
- return null ;
308
+ return null ; // try next method
316
309
}
317
310
}
318
311
0 commit comments