securityprovider package - github.com/oapi-codegen/oapi-codegen/v2/pkg/securityprovider - Go Packages

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

View Source

const (
	
	
	ErrSecurityProviderApiKeyInvalidIn = SecurityProviderError("invalid 'in' specified for apiKey")
)

This section is empty.

This section is empty.

type SecurityProviderApiKey struct {
	
}

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

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.

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

type SecurityProviderBasicAuth struct {
	
}

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

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

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

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 struct {
	
}

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

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

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

type SecurityProviderError string

SecurityProviderError defines error values of a security provider.

Error implements the error interface.