kubernetesk8s.io/kubernetes/pkg/auth/handlers Index | Files

package handlers

import "k8s.io/kubernetes/pkg/auth/handlers"

Index

Variables

var Unauthorized http.HandlerFunc = unauthorized

Functions

func NewRequestAuthenticator

func NewRequestAuthenticator(context RequestContext, auth authenticator.Request, failed http.Handler, handler http.Handler) http.Handler

NewRequestAuthenticator creates an http handler that tries to authenticate the given request as a user, and then stores any such user found onto the provided context for the request. If authentication fails or returns an error the failed handler is used. On success, handler is invoked to serve the request.

Types

type RequestContext

type RequestContext interface {
	Set(*http.Request, user.Info)
	Get(req *http.Request) (user.Info, bool)
	Remove(*http.Request)
}

RequestContext is the interface used to associate a user with an http Request.

type UserRequestContext

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

UserRequestContext allows different levels of a call stack to store/retrieve info about the current user associated with an http.Request.

func NewUserRequestContext

func NewUserRequestContext() *UserRequestContext

NewUserRequestContext provides a map for storing and retrieving users associated with requests. Be sure to pair each `context.Set(req, user)` call with a `defer context.Remove(req)` call or you will leak requests. It implements the RequestContext interface.

func (*UserRequestContext) Get

func (c *UserRequestContext) Get(req *http.Request) (user.Info, bool)

func (*UserRequestContext) Remove

func (c *UserRequestContext) Remove(req *http.Request)

func (*UserRequestContext) Set

func (c *UserRequestContext) Set(req *http.Request, user user.Info)

Source Files

handlers.go

Version
v0.7.3
Published
Jan 8, 2015
Platform
js/wasm
Imports
5 packages
Last checked
2 seconds ago

Tools for package owners.