auth

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 17 Imported by: 2

Documentation

Index

Constants

View Source
const (
	OAuth2PluginName      = "org.apache.pulsar.client.impl.auth.oauth2.AuthenticationOAuth2"
	OAuth2PluginShortName = "oauth2"
)
View Source
const (
	TLSPluginName      = "org.apache.pulsar.client.impl.auth.AuthenticationTls"
	TLSPluginShortName = "tls"
)
View Source
const (
	TokenPluginName     = "org.apache.pulsar.client.impl.auth.AuthenticationToken"
	TokePluginShortName = "token"
)

Variables

This section is empty.

Functions

func GetDefaultTransport

func GetDefaultTransport(config *config.Config) http.RoundTripper

GetDefaultTransport gets a default transport. Deprecated: Use NewDefaultTransport instead.

func MakeKeyringStore

func MakeKeyringStore() (store.Store, error)

func NewDefaultTransport

func NewDefaultTransport(config *config.Config) (http.RoundTripper, error)

Types

type DefaultProvider

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

func (*DefaultProvider) RoundTrip

func (dp *DefaultProvider) RoundTrip(req *http.Request) (*http.Response, error)

func (*DefaultProvider) Transport

func (dp *DefaultProvider) Transport() http.RoundTripper

func (*DefaultProvider) WithTransport

func (dp *DefaultProvider) WithTransport(t http.RoundTripper)

type OAuth2ClientCredentials

type OAuth2ClientCredentials struct {
	IssuerURL  string `json:"issuerUrl,omitempty"`
	Audience   string `json:"audience,omitempty"`
	Scope      string `json:"scope,omitempty"`
	PrivateKey string `json:"privateKey,omitempty"`
	ClientID   string `json:"clientId,omitempty"`
}

type OAuth2Provider

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

func NewAuthenticationOAuth2

func NewAuthenticationOAuth2(issuer oauth2.Issuer, store store.Store) (*OAuth2Provider, error)

func NewAuthenticationOAuth2FromAuthParams

func NewAuthenticationOAuth2FromAuthParams(encodedAuthParam string,
	transport http.RoundTripper) (*OAuth2Provider, error)

func NewAuthenticationOAuth2WithParams

func NewAuthenticationOAuth2WithParams(
	issuerEndpoint,
	clientID,
	audience string,
	scope string,
	transport http.RoundTripper) (*OAuth2Provider, error)

func (*OAuth2Provider) RoundTrip

func (o *OAuth2Provider) RoundTrip(req *http.Request) (*http.Response, error)

func (*OAuth2Provider) Transport

func (o *OAuth2Provider) Transport() http.RoundTripper

func (*OAuth2Provider) WithTransport

func (o *OAuth2Provider) WithTransport(tripper http.RoundTripper)

type Provider

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

Provider provide a general method to add auth message

func GetAuthProvider

func GetAuthProvider(config *config.Config) (Provider, error)

func NewAuthenticationOAuth2WithDefaultFlow

func NewAuthenticationOAuth2WithDefaultFlow(issuer oauth2.Issuer, keyFile string) (Provider, error)

NewAuthenticationOAuth2WithDefaultFlow uses memory to save the grant

func NewAuthenticationOAuth2WithFlow

func NewAuthenticationOAuth2WithFlow(
	issuer oauth2.Issuer, flowOptions oauth2.ClientCredentialsFlowOptions) (Provider, error)

func NewDefaultProvider

func NewDefaultProvider(t http.RoundTripper) Provider

type TLS

type TLS struct {
	TLSCertFile string `json:"tlsCertFile"`
	TLSKeyFile  string `json:"tlsKeyFile"`
}

type TLSAuthProvider

type TLSAuthProvider struct {
	T http.RoundTripper
	// contains filtered or unexported fields
}

func NewAuthenticationTLS

func NewAuthenticationTLS(certificatePath string, privateKeyPath string,
	transport http.RoundTripper) (*TLSAuthProvider, error)

NewAuthenticationTLS initialize the authentication provider

func NewAuthenticationTLSFromAuthParams

func NewAuthenticationTLSFromAuthParams(encodedAuthParams string,
	transport http.RoundTripper) (*TLSAuthProvider, error)

func (*TLSAuthProvider) GetTLSCertificate

func (p *TLSAuthProvider) GetTLSCertificate() (*tls.Certificate, error)

func (*TLSAuthProvider) RoundTrip

func (p *TLSAuthProvider) RoundTrip(req *http.Request) (*http.Response, error)

func (*TLSAuthProvider) Transport

func (p *TLSAuthProvider) Transport() http.RoundTripper

func (*TLSAuthProvider) WithTransport

func (p *TLSAuthProvider) WithTransport(tripper http.RoundTripper)

type Token

type Token struct {
	Token string `json:"token"`
}

type TokenAuthProvider

type TokenAuthProvider struct {
	T http.RoundTripper
	// contains filtered or unexported fields
}

func NewAuthenticationToken

func NewAuthenticationToken(token string, transport http.RoundTripper) (*TokenAuthProvider, error)

NewAuthenticationToken return a interface of Provider with a string token.

func NewAuthenticationTokenFromAuthParams

func NewAuthenticationTokenFromAuthParams(encodedAuthParam string,
	transport http.RoundTripper) (*TokenAuthProvider, error)

func NewAuthenticationTokenFromFile

func NewAuthenticationTokenFromFile(tokenFilePath string, transport http.RoundTripper) (*TokenAuthProvider, error)

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

func (*TokenAuthProvider) RoundTrip

func (p *TokenAuthProvider) RoundTrip(req *http.Request) (*http.Response, error)

func (*TokenAuthProvider) Transport

func (p *TokenAuthProvider) Transport() http.RoundTripper

func (*TokenAuthProvider) WithTransport

func (p *TokenAuthProvider) WithTransport(tripper http.RoundTripper)

type Transport

type Transport struct {
	T http.RoundTripper
}

Jump to

Keyboard shortcuts

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