-
Notifications
You must be signed in to change notification settings - Fork 41
Description
The AuthHeaderCache
used in AuthHandshakeMessageHandler
currently in place, seems very sensitive in regards of the URLs which leads to unnecessary API call roundtrips for authentication.
The root cause: AuthHeaderCache
uses the Host
+ AbsolutePath
components of the URI to choose whether we already have an authentication token. This means that for almost every API call we make an authentication roundtrip because the path parts of the URI differ.
The better approach: Looking into AuthHandshakeMessageHandler.SendAsync
and AuthHandshakeMessageHandler.GetAuthenticationAsync
we can see that ultimately only the host part of the URL is relevant for determining the authentication information. It is passed into the CredsProvider.GetCredentialsAsync(registry)
for loading the credentials and then sending them to the server. Hence we could also just consider the domain part in the AuthHeaderCache and avoid roundtrips for every call.
Maybe this was a security concern to allow registries to be operated on different path segements and not send the credentials potentially to a wrong application?
If this is a major concern, we should pass the registry base path into the AuthHandshakeMessageHandler
(created per registry already) and handle the authentication specifically to the base URL.