Skip to content

Authentication Handler makes too many authentication roundtrips.  #391

@Danielku15

Description

@Danielku15

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions