auth

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingAuthHeader          = fmt.Errorf("auth: missing Authorization header")
	ErrInvalidAuthorizationHeader = fmt.Errorf("auth: invalid Authorization header format")
	ErrUnauthorized               = fmt.Errorf("auth: unauthorized")
	ErrLoginRequired              = fmt.Errorf("auth: login required")
)

Common errors.

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	// Authenticate authenticates the request. If the request is authenticated, it
	// returns a cluster ID and a path.
	Authenticate(r *http.Request) (string, string, error)
}

Authenticator authenticates an inbound http.Request.

type ExternalAuthenticator

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

ExternalAuthenticator authenticates external requests with RBAC server.

func NewExternalAuthenticator

func NewExternalAuthenticator(
	ctx context.Context,
	rbacServerAddr string,
	tex *TokenExchanger,
	cacheExpiration, cacheCleanup time.Duration,
) (*ExternalAuthenticator, error)

NewExternalAuthenticator returns a new ExternalAuthenticator.

func (*ExternalAuthenticator) Authenticate

func (a *ExternalAuthenticator) Authenticate(r *http.Request) (string, string, error)

Authenticate implements Authenticator by authenticating the request with the

func (*ExternalAuthenticator) HandleLogin

func (a *ExternalAuthenticator) HandleLogin(w http.ResponseWriter, r *http.Request)

HandleLogin handles the login request.

func (*ExternalAuthenticator) HandleLoginCallback

func (a *ExternalAuthenticator) HandleLoginCallback(w http.ResponseWriter, r *http.Request)

HandleLoginCallback handles the login callback.

type TokenExchanger

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

TokenExchanger exchanges the code for a token.

func NewTokenExchanger

func NewTokenExchanger(ctx context.Context, opts TokenExchangerOptions) (*TokenExchanger, error)

NewTokenExchanger returns a new TokenExchanger.

type TokenExchangerOptions

type TokenExchangerOptions struct {
	ClientID     string
	ClientSecret string
	IssuerURL    string
	RedirectURI  string

	DexServerAddr string
}

TokenExchangerOptions is the options for TokenExchanger.

type WorkerAuthenticator

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

WorkerAuthenticator authenticates external requests with RBAC server.

func NewWorkerAuthenticator

func NewWorkerAuthenticator(ctx context.Context, addr string) (*WorkerAuthenticator, error)

NewWorkerAuthenticator returns a new WorkerAuthenticator.q

func (*WorkerAuthenticator) Authenticate

func (a *WorkerAuthenticator) Authenticate(r *http.Request) (string, string, error)

Authenticate implements Authenticator by authenticating the request with the

Jump to

Keyboard shortcuts

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