Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidHostPrefix = errors.New("host should not contain http or https prefix")
ErrInvalidHostPrefix indicates that a host should not contain the http or https prefix.
Functions ¶
This section is empty.
Types ¶
type AccessTokenProvider ¶
type AccessTokenProvider interface { // GetAuthorizationToken returns the access token for the provided url. GetAuthorizationToken(context context.Context, url *u.URL, additionalAuthenticationContext map[string]interface{}) (string, error) // GetAllowedHostsValidator returns the hosts validator. GetAllowedHostsValidator() *AllowedHostsValidator }
AccessTokenProvider returns access tokens.
type AllowedHostsValidator ¶
type AllowedHostsValidator struct {
// contains filtered or unexported fields
}
AllowedHostsValidator maintains a list of valid hosts and allows authentication providers to check whether a host is valid before authenticating a request
func NewAllowedHostsValidator
deprecated
func NewAllowedHostsValidator(validHosts []string) AllowedHostsValidator
Deprecated: NewAllowedHostsValidator creates a new AllowedHostsValidator object with provided values.
func NewAllowedHostsValidatorErrorCheck ¶ added in v1.5.6
func NewAllowedHostsValidatorErrorCheck(validHosts []string) (*AllowedHostsValidator, error)
NewAllowedHostsValidatorErrorCheck creates a new AllowedHostsValidator object with provided values and performs error checking.
func (*AllowedHostsValidator) GetAllowedHosts ¶
func (v *AllowedHostsValidator) GetAllowedHosts() map[string]bool
GetAllowedHosts returns the list of valid hosts.
func (*AllowedHostsValidator) IsUrlHostValid ¶
func (v *AllowedHostsValidator) IsUrlHostValid(uri *u.URL) bool
IsValidHost returns true if the host is valid.
func (*AllowedHostsValidator) SetAllowedHosts
deprecated
func (v *AllowedHostsValidator) SetAllowedHosts(hosts []string)
Deprecated: SetAllowedHosts sets the list of valid hosts.
func (*AllowedHostsValidator) SetAllowedHostsErrorCheck ¶ added in v1.5.6
func (v *AllowedHostsValidator) SetAllowedHostsErrorCheck(hosts []string) error
SetAllowedHostsErrorCheck sets the list of valid hosts with error checking.
type AnonymousAuthenticationProvider ¶
type AnonymousAuthenticationProvider struct { }
AnonymousAuthenticationProvider implements the AuthenticationProvider interface does not perform any authentication.
func (*AnonymousAuthenticationProvider) AuthenticateRequest ¶
func (provider *AnonymousAuthenticationProvider) AuthenticateRequest(context context.Context, request *abs.RequestInformation, additionalAuthenticationContext map[string]interface{}) error
AuthenticateRequest is a placeholder method that "authenticates" the RequestInformation instance: no-op.
type ApiKeyAuthenticationProvider ¶ added in v0.14.0
type ApiKeyAuthenticationProvider struct {
// contains filtered or unexported fields
}
ApiKeyAuthenticationProvider implements the AuthenticationProvider interface and adds an API key to the request.
func NewApiKeyAuthenticationProvider ¶ added in v0.14.0
func NewApiKeyAuthenticationProvider(apiKey string, parameterName string, keyLocation KeyLocation) (*ApiKeyAuthenticationProvider, error)
NewApiKeyAuthenticationProvider creates a new ApiKeyAuthenticationProvider instance
func NewApiKeyAuthenticationProviderWithValidHosts ¶ added in v0.14.0
func NewApiKeyAuthenticationProviderWithValidHosts(apiKey string, parameterName string, keyLocation KeyLocation, validHosts []string) (*ApiKeyAuthenticationProvider, error)
NewApiKeyAuthenticationProviderWithValidHosts creates a new ApiKeyAuthenticationProvider instance while specifying a list of valid hosts
func (*ApiKeyAuthenticationProvider) AuthenticateRequest ¶ added in v0.14.0
func (p *ApiKeyAuthenticationProvider) AuthenticateRequest(ctx context.Context, request *abs.RequestInformation, additionalAuthenticationContext map[string]interface{}) error
AuthenticateRequest adds the API key to the request.
type AuthenticationProvider ¶
type AuthenticationProvider interface { // AuthenticateRequest authenticates the provided RequestInformation. AuthenticateRequest(context context.Context, request *abs.RequestInformation, additionalAuthenticationContext map[string]interface{}) error }
AuthenticationProvider authenticates the RequestInformation request.
type BaseBearerTokenAuthenticationProvider ¶
type BaseBearerTokenAuthenticationProvider struct {
// contains filtered or unexported fields
}
BaseBearerTokenAuthenticationProvider provides a base class implementing AuthenticationProvider for Bearer token scheme.
func NewBaseBearerTokenAuthenticationProvider ¶
func NewBaseBearerTokenAuthenticationProvider(accessTokenProvider AccessTokenProvider) *BaseBearerTokenAuthenticationProvider
NewBaseBearerTokenAuthenticationProvider creates a new instance of the BaseBearerTokenAuthenticationProvider class.
func (*BaseBearerTokenAuthenticationProvider) AuthenticateRequest ¶
func (provider *BaseBearerTokenAuthenticationProvider) AuthenticateRequest(ctx context.Context, request *abs.RequestInformation, additionalAuthenticationContext map[string]interface{}) error
AuthenticateRequest authenticates the provided RequestInformation instance using the provided authorization token callback.
func (*BaseBearerTokenAuthenticationProvider) GetAuthorizationTokenProvider ¶
func (provider *BaseBearerTokenAuthenticationProvider) GetAuthorizationTokenProvider() AccessTokenProvider
GetAuthorizationTokenProvider returns the access token provider the BaseBearerTokenAuthenticationProvider class uses to authenticate the request.
type KeyLocation ¶ added in v0.14.0
type KeyLocation int
const ( // QUERYPARAMETER_KEYLOCATION is the value for the key location to be used as a query parameter. QUERYPARAMETER_KEYLOCATION KeyLocation = iota // HEADER_KEYLOCATION is the value for the key location to be used as a header. HEADER_KEYLOCATION )