authorization

package
v0.0.0-...-239afe9 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

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 {
	// 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
	// OAuthWithCert is OAuthWithCert configuration
	OAuthWithCert *OAuthWithCert
	// 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, skipTLSVerification bool) (string, apperrors.AppError)
	GetTokenMTLS(clientID, authURL string, certificate, privateKey []byte, headers, queryParameters *map[string][]string, skipVerify bool) (string, apperrors.AppError)
	// InvalidateTokenCache resets internal token cache
	InvalidateTokenCache(clientID string, clientSecret string, authURL string)
	InvalidateTokenCacheMTLS(clientID, authURL string, certificate, privateKey []byte)
}

type OAuthWithCert

type OAuthWithCert struct {
	URL               string
	ClientID          string
	ClientSecret      string
	Certificate       []byte
	PrivateKey        []byte
	RequestParameters *RequestParameters
}

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 clientcert.SetClientCertificateFunc, skipTLSVerification bool) 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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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