Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrMissingAuthHeader = fmt.Errorf("auth: missing Authorization header") ErrInvalidAuthorizationHeader = fmt.Errorf("auth: invalid Authorization header format") 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 ¶
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 ¶
Authenticate implements Authenticator by authenticating the request with the