authorization

package
v0.0.0-...-7d69bf5 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicAuth

type BasicAuth struct {
	// Username to use for authentication
	Username string
	// Password to use for authentication
	Password string
}

BasicAuth contains details of BasicAuth Auth configuration

type CertificateGen

type CertificateGen struct {
	// CommonName of the certificate
	// Deprecated: This field is only used for old implementation of fetching credentials from Application and Secrets
	// It should be removed when it is no longer supported
	CommonName string
	// Certificate generated by Application Registry
	Certificate []byte
	// PrivateKey generated by Application Registry
	PrivateKey []byte
}

CertificateGen details of CertificateGen configuration

type Credentials

type Credentials struct {
	// OAuth is OAuth configuration.
	OAuth *OAuth
	// BasicAuth is BasicAuth configuration.
	BasicAuth *BasicAuth
	// CertificateGen is CertificateGen configuration.
	CertificateGen *CertificateGen
	// CSRFTokenEndpointURL (optional) to fetch CSRF token
	// Deprecated: This field is only used for old implementation of fetching credentials from Application and Secrets. It is not used by authorization package.
	// It should be removed when it is no longer supported
	CSRFTokenEndpointURL string
}

Credentials contains OAuth or BasicAuth configuration.

type FactoryConfiguration

type FactoryConfiguration struct {
	OAuthClientTimeout int
}

FactoryConfiguration holds factory configuration options

type OAuth

type OAuth struct {
	// URL to OAuth token provider.
	URL string
	// ClientID to use for authorization.
	ClientID string
	// ClientSecret to use for authorization.
	ClientSecret string
	// RequestParameters will be used with request send by the Application Gateway.
	RequestParameters *RequestParameters
}

OAuth contains details of OAuth configuration

type OAuthClient

type OAuthClient interface {
	// GetToken obtains OAuth token
	GetToken(clientID string, clientSecret string, authURL string, headers, queryParameters *map[string][]string) (string, apperrors.AppError)
	// InvalidateTokenCache resets internal token cache
	InvalidateTokenCache(clientID string)
}

type RequestParameters

type RequestParameters struct {
	Headers         *map[string][]string `json:"headers,omitempty"`
	QueryParameters *map[string][]string `json:"queryParameters,omitempty"`
}

RequestParameters contains Headers and QueryParameters

type Strategy

type Strategy interface {
	// Adds Authorization header to the request
	AddAuthorization(r *http.Request, setter TransportSetter) apperrors.AppError
	// Invalidates internal state
	Invalidate()
}

type StrategyFactory

type StrategyFactory interface {
	// Creates strategy for credentials provided
	Create(credentials *Credentials) Strategy
}

func NewStrategyFactory

func NewStrategyFactory(config FactoryConfiguration) StrategyFactory

NewStrategyFactory creates factory for instantiating Strategy implementations

type TransportSetter

type TransportSetter func(transport *http.Transport)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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