httpcontext

package
v0.0.0-...-e653fdf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: AGPL-3.0 Imports: 8 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequestAuthInfo

func RequestAuthInfo(req *http.Request) (authentication.AuthInfo, bool)

RequestAuthInfo returns the AuthInfo associated with the request, if any, and a boolean indicating whether or not the request was authenticated.

func RequestModelUUID

func RequestModelUUID(req *http.Request) string

RequestModelUUID returns the model UUID associated with this request if there is one, or the empty string otherwise. No attempt is made to validate the model UUID; QueryModelHandler does this, and ImpliedModelHandler should always be supplied with a valid UUID.

Types

type AuthHandler

type AuthHandler struct {
	// NextHandler is the http handler to call after authentication has been
	// completed.
	NextHandler http.Handler

	// Authenticator is the Authenticator used for authenticating
	// the HTTP requests handled by this handler.
	Authenticator authentication.HTTPAuthenticator

	// Authorizer, if non-nil, will be called with the auth info
	// returned by the Authenticator, to validate it for the route.
	Authorizer authentication.Authorizer
}

AuthHandler is a http handler responsible for handling authz and authn for http requests coming into Juju. If a request both authenticates and authorizes then the authentication info is also padded into the http context and the next http handler is called.

func (*AuthHandler) ServeHTTP

func (h *AuthHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP is part of the http.Handler interface and is responsible for performing AuthN and AuthZ on the subsequent http request.

type BucketModelHandler

type BucketModelHandler struct {
	http.Handler
	Query string
}

BucketModelHandler is an http.Handler that associates requests that it handles with a model UUID extracted from a specified query parameter that must be the objects storage :bucket which is formatted 'model-{modelUUID}'. The model UUID can then be extracted using the RequestModel function in this package.

func (*BucketModelHandler) ServeHTTP

func (h *BucketModelHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP is part of the http.Handler interface.

type HTTPStrategicAuthenticator

type HTTPStrategicAuthenticator []authentication.HTTPAuthenticator

StrategicAuthenticator is responsible for trying multiple Authenticators until one succeeds or an error is returned that is not equal to NotFound.

type ImpliedModelHandler

type ImpliedModelHandler struct {
	http.Handler
	ModelUUID string
}

ImpliedModelHandler is an http.Handler that associates requests that it handles with a specified model UUID. The model UUID can then be extracted using the RequestModel function in this package.

func (*ImpliedModelHandler) ServeHTTP

func (h *ImpliedModelHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP is part of the http.Handler interface.

type QueryModelHandler

type QueryModelHandler struct {
	http.Handler
	Query string
}

QueryModelHandler is an http.Handler that associates requests that it handles with a model UUID extracted from a specified query parameter. The model UUID can then be extracted using the RequestModel function in this package.

func (*QueryModelHandler) ServeHTTP

func (h *QueryModelHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP is part of the http.Handler interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL