Skip to content

Commit

Permalink
feat: Allow overriding authentication scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
sberss committed Jun 4, 2024
1 parent 1a4e18e commit d9d467e
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ abstract class DockerRegistryV2Abstract(override val config: DockerRegistryConfi
.handleErrorWith(tryOCIManifest)
}

/**
* Gets the authorization scheme to use for the token request.
*/
protected def getAuthorizationScheme(dockerImageIdentifier: DockerImageIdentifier): AuthScheme = AuthScheme.Bearer

/**
* Returns true if this flow is able to process this docker image,
* false otherwise
Expand Down Expand Up @@ -241,7 +246,7 @@ abstract class DockerRegistryV2Abstract(override val config: DockerRegistryConfi
manifestHeader: Accept
): IO[Request[IO]] = {
val authorizationHeader: Option[Authorization] =
token.map(t => Authorization(Credentials.Token(AuthScheme.Bearer, t)))
token.map(t => Authorization(Credentials.Token(getAuthorizationScheme(imageId), t)))
val request = Method.GET(
buildManifestUri(imageId),
List(
Expand Down

0 comments on commit d9d467e

Please sign in to comment.