securityprovider

package
v1.11.1-0...-1d444b7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package securityprovider contains some default securityprovider implementations, which can be used as a RequestEditorFn of a client.

Index

Constants

View Source
const (
	// ErrSecurityProviderApiKeyInvalidIn indicates a usage of an invalid In.
	// Should be cookie, header or query
	ErrSecurityProviderApiKeyInvalidIn = SecurityProviderError("invalid 'in' specified for apiKey")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type SecurityProviderApiKey

type SecurityProviderApiKey struct {
	// contains filtered or unexported fields
}

SecurityProviderApiKey will attach an apiKey either to a cookie, header or query.

func NewSecurityProviderApiKey

func NewSecurityProviderApiKey(in, name, apiKey string) (*SecurityProviderApiKey, error)

NewSecurityProviderApiKey will attach a generic apiKey for a given name either to a cookie, header or as a query parameter.

func (*SecurityProviderApiKey) Intercept

func (s *SecurityProviderApiKey) Intercept(ctx context.Context, req *http.Request) error

Intercept will attach a cookie, header or query param for the configured name and apiKey.

type SecurityProviderBasicAuth

type SecurityProviderBasicAuth struct {
	// contains filtered or unexported fields
}

SecurityProviderBasicAuth sends a base64-encoded combination of username, password along with a request.

func NewSecurityProviderBasicAuth

func NewSecurityProviderBasicAuth(username, password string) (*SecurityProviderBasicAuth, error)

NewSecurityProviderBasicAuth provides a SecurityProvider, which can solve the BasicAuth challenge for api-calls.

func (*SecurityProviderBasicAuth) Intercept

func (s *SecurityProviderBasicAuth) Intercept(ctx context.Context, req *http.Request) error

Intercept will attach an Authorization header to the request and ensures that the username, password are base64 encoded and attached to the header.

type SecurityProviderBearerToken

type SecurityProviderBearerToken struct {
	// contains filtered or unexported fields
}

SecurityProviderBearerToken sends a token as part of an Authorization: Bearer header along with a request.

func NewSecurityProviderBearerToken

func NewSecurityProviderBearerToken(token string) (*SecurityProviderBearerToken, error)

NewSecurityProviderBearerToken provides a SecurityProvider, which can solve the Bearer Auth challende for api-calls.

func (*SecurityProviderBearerToken) Intercept

func (s *SecurityProviderBearerToken) Intercept(ctx context.Context, req *http.Request) error

Intercept will attach an Authorization header to the request and ensures that the bearer token is attached to the header.

type SecurityProviderError

type SecurityProviderError string

SecurityProviderError defines error values of a security provider.

func (SecurityProviderError) Error

func (e SecurityProviderError) Error() string

Error implements the error interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL