Documentation ¶
Overview ¶
Package authserver implements types related to the communication of authentication via an auth proxy sidecar.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GinHeaderParserMiddleware ¶
GinHeaderParserMiddleware is a gin middleware that behaves like the middleware returned from NewHeaderParserMiddleware.
func MustGetContextAuthClaims ¶
MustGetContextAuthClaims is like MustGetContextAuthHeader but returns the claims from Header.
func NewHeaderParserMiddleware
deprecated
NewHeaderParserMiddleware returns a middleware that parses the auth headers into a Header object and adds it to the request context. Use GetContextAuthHeader to retrieve the parsed header from the context.
Deprecated: We generally want to use gin as our web framework. Maintaining both middlewares means more work. Please migrate towards GinHeaderParserMiddleware.
Types ¶
type AuthServer ¶
type AuthServer struct {
// contains filtered or unexported fields
}
AuthServer is a http.Handler that validates authentication information on http.Request objects.
Trusted requests are responded with a status 204 and additional headers containing decoded information about the request user, etc.
Untrusted requests are responded with a status 401.
func NewAuthServer ¶
func NewAuthServer(stack *authn.AuthStack) *AuthServer
func (*AuthServer) ServeHTTP ¶
func (server *AuthServer) ServeHTTP(writer http.ResponseWriter, request *http.Request)
type Header ¶
Header are the headers set by an AuthServer after a request has successfully been authenticated.
func GetContextAuthHeader ¶
GetContextAuthHeader tries to get a Header object from the given context.
Returns nil if no value is found.
func MustGetContextAuthHeader ¶
MustGetContextAuthHeader is like GetContextAuthHeader but panics if no value is found.
func ParseHeader ¶
ParseHeader takes a http.Header and tries to parse Header from it. Use this function if you receive requests that are being authenticated by an AuthServer.
This will return an error if any non-optional header are missing.
When parsing, Header.Claims will not be validated but only parsed.