Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthenticationRoute ¶
type AuthenticationRoute interface {
// IsPath returns true if the path is within the route that is
// authenticated.
IsPath(path string) bool
// HandleError handles the error to be returned to the client in the
// event of authentication failure.
HandleError(err error, w http.ResponseWriter, r *http.Request)
}
AuthenticationRoute is particular route that is authenticated, e.g. api, ui, etc.
type Authenticator ¶
type Authenticator interface {
Authenticate(w http.ResponseWriter, r *http.Request) (authz.Subject, error)
}
Authenticator authenticates a request; if successful it returns the authenticated subject; if invalid an error is returned; if there is no appropriate means of authentication found in the request then a nil subject is returned.
type Middleware ¶
type Middleware struct {
Authenticators []Authenticator
Route AuthenticationRoute
Logger logr.Logger
}
Middleware is HTTP middleware that authenticates requests.
func (*Middleware) Authenticate ¶
func (a *Middleware) Authenticate(next http.Handler) http.Handler
Authenticate authenticates inbound http requests. Where authentication succeeds, the authenticated subject is attached to the request context and the upstream handler is called.
Click to show internal directories.
Click to hide internal directories.