auth

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigParamType                  = "type"
	ConfigParamTypeClientCredentials = "client_credentials"
	ConfigParamIssuerURL             = "issuerUrl"
	ConfigParamAudience              = "audience"
	ConfigParamScope                 = "scope"
	ConfigParamKeyFile               = "privateKey"
	ConfigParamClientID              = "clientId"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPAuthProvider

type HTTPAuthProvider interface {
	RoundTrip(req *http.Request) (*http.Response, error)
	Transport() http.RoundTripper
	WithTransport(tripper http.RoundTripper) error
}

type HTTPTransport

type HTTPTransport struct {
	T http.RoundTripper
}

type Provider

type Provider interface {
	// Init the authentication provider.
	Init() error

	// Name func returns the identifier for this authentication method.
	Name() string

	// GetTLSCertificate returns a client certificate chain, or nil if the data are not available
	GetTLSCertificate() (*tls.Certificate, error)

	// GetData returns the authentication data identifying this client that will be sent to the broker.
	GetData() ([]byte, error)

	io.Closer

	HTTPAuthProvider
}

Provider is an interface of authentication providers.

func NewAuthDisabled

func NewAuthDisabled() Provider

NewAuthDisabled return a interface of Provider

func NewAuthenticationAthenz

func NewAuthenticationAthenz(
	providerDomain string,
	tenantDomain string,
	tenantService string,
	privateKey string,
	keyID string,
	x509CertChain string,
	caCert string,
	principalHeader string,
	roleHeader string,
	ztsURL string) Provider

func NewAuthenticationAthenzWithParams

func NewAuthenticationAthenzWithParams(params map[string]string) (Provider, error)

func NewAuthenticationBasic

func NewAuthenticationBasic(username, password string) (Provider, error)

func NewAuthenticationBasicWithParams

func NewAuthenticationBasicWithParams(params map[string]string) (Provider, error)

func NewAuthenticationFromTLSCertSupplier

func NewAuthenticationFromTLSCertSupplier(tlsCertSupplier func() (*tls.Certificate, error)) Provider

func NewAuthenticationOAuth2

func NewAuthenticationOAuth2(
	issuer oauth2.Issuer,
	store store.Store) Provider

func NewAuthenticationOAuth2WithParams

func NewAuthenticationOAuth2WithParams(params map[string]string) (Provider, error)

NewAuthenticationOAuth2WithParams return a interface of Provider with string map.

func NewAuthenticationTLS

func NewAuthenticationTLS(certificatePath string, privateKeyPath string) Provider

NewAuthenticationTLS initialize the authentication provider

func NewAuthenticationTLSWithParams

func NewAuthenticationTLSWithParams(params map[string]string) Provider

NewAuthenticationTLSWithParams initialize the authentication provider with map param.

func NewAuthenticationToken

func NewAuthenticationToken(token string) Provider

NewAuthenticationToken returns a token auth provider that will use the specified token to talk with Pulsar brokers

func NewAuthenticationTokenFromFile

func NewAuthenticationTokenFromFile(tokenFilePath string) Provider

NewAuthenticationTokenFromFile return a interface of a Provider with a string token file path.

func NewAuthenticationTokenFromSupplier

func NewAuthenticationTokenFromSupplier(tokenSupplier func() (string, error)) Provider

NewAuthenticationTokenFromSupplier returns a token auth provider that get the token data from a user supplied function. The function is invoked each time the client library needs to use a token in talking with Pulsar brokers

func NewAuthenticationTokenWithParams

func NewAuthenticationTokenWithParams(params map[string]string) (Provider, error)

NewAuthenticationTokenWithParams return a interface of Provider with string map.

func NewProvider

func NewProvider(name string, params string) (Provider, error)

NewProvider get/create an authentication data provider which provides the data that this client will be sent to the broker. Some authentication method need to auth between each client channel. So it need the broker, who it will talk to.

Jump to

Keyboard shortcuts

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