Documentation ¶
Overview ¶
Package authentication provides implementation for authentication webhook and methods to implement authentication webhook handlers.
See examples/tokenreview/ for an example of authentication webhooks.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler interface { // Handle yields a response to an TokenReview. // // The supplied context is extracted from the received http.Request, allowing wrapping // http.Handlers to inject values into and control cancelation of downstream request processing. Handle(context.Context, Request) Response }
Handler can handle an TokenReview.
type HandlerFunc ¶
HandlerFunc implements Handler interface using a single function.
type Request ¶
type Request struct {
authenticationv1.TokenReview
}
Request defines the input for an authentication handler. It contains information to identify the object in question (group, version, kind, resource, subresource, name, namespace), as well as the operation in question (e.g. Get, Create, etc), and the object itself.
type Response ¶
type Response struct {
authenticationv1.TokenReview
}
Response is the output of an authentication handler. It contains a response indicating if a given operation is allowed
func Authenticated ¶
func Authenticated(reason string, user authenticationv1.UserInfo) Response
Authenticated constructs a response indicating that the given token is valid.
func ReviewResponse ¶
func ReviewResponse(authenticated bool, user authenticationv1.UserInfo, err string, audiences ...string) Response
ReviewResponse returns a response for admitting a request.
func Unauthenticated ¶
func Unauthenticated(reason string, user authenticationv1.UserInfo) Response
Unauthenticated constructs a response indicating that the given token is not valid.
type Webhook ¶
type Webhook struct { // Handler actually processes an authentication request returning whether it was authenticated or unauthenticated, // and potentially patches to apply to the handler. Handler Handler // WithContextFunc will allow you to take the http.Request.Context() and // add any additional information such as passing the request path or // headers thus allowing you to read them from within the handler WithContextFunc func(context.Context, *http.Request) context.Context // contains filtered or unexported fields }
Webhook represents each individual webhook.
func (*Webhook) InjectFunc ¶
InjectFunc injects the field setter into the webhook.
func (*Webhook) InjectLogger ¶
InjectLogger gets a handle to a logging instance, hopefully with more info about this particular webhook.