mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
Make the authorizer and registry authorizer configurable
Fixes: #12584 This change makes the authorizer and registryAuthorizer of the registry client configurable via options. This allows Go SDK users to override the authentication behavior of the client. This PR makes both the authorizer and registryAuthorizer configurable because depending on the exact scenario that may be needed. The default registryAuthorizer only supports a specific implementation of the authorizer. Signed-off-by: Ryan Nowak <nowakra@gmail.com>
This commit is contained in:
parent
dd35343988
commit
3c2ab91263
1 changed files with 20 additions and 0 deletions
|
|
@ -175,6 +175,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…
Reference in a new issue