Merge pull request #12588 from rynowak/rynowak/override-authorizer

Make the authorizer and registry authorizer configurable
pull/13484/head
Scott Rigby 1 month ago committed by GitHub
commit 28770bfc1d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -206,6 +206,26 @@ func ClientOptWriter(out io.Writer) ClientOption {
}
}
// ClientOptAuthorizer returns a function that sets the authorizer setting on a client options set. This
// can be used to override the default authorization mechanism.
//
// Depending on the use-case you may need to set both ClientOptAuthorizer and ClientOptRegistryAuthorizer.
func ClientOptAuthorizer(authorizer auth.Client) ClientOption {
return func(client *Client) {
client.authorizer = authorizer
}
}
// ClientOptRegistryAuthorizer returns a function that sets the registry authorizer setting on a client options set. This
// can be used to override the default authorization mechanism.
//
// Depending on the use-case you may need to set both ClientOptAuthorizer and ClientOptRegistryAuthorizer.
func ClientOptRegistryAuthorizer(registryAuthorizer *registryauth.Client) ClientOption {
return func(client *Client) {
client.registryAuthorizer = registryAuthorizer
}
}
// ClientOptCredentialsFile returns a function that sets the credentialsFile setting on a client options set
func ClientOptCredentialsFile(credentialsFile string) ClientOption {
return func(client *Client) {

Loading…
Cancel
Save