stateauthenticator

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: 33 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AgentTags = []string{
	names.MachineTagKind,
	names.ControllerAgentTagKind,
	names.UnitTagKind,
	names.ApplicationTagKind,
	names.ModelTagKind,
}

AgentTags are those used by any Juju agent.

Functions

func LoginRequest

func LoginRequest(req *http.Request) (params.LoginRequest, error)

LoginRequest extracts basic auth login details from an http.Request.

TODO(axw) we shouldn't be using params types here.

Types

type Authenticator

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

Authenticator is an implementation of httpcontext.Authenticator, using *state.State for authentication.

This Authenticator only works with requests that have been handled by one of the httpcontext.*ModelHandler handlers.

func NewAuthenticator

func NewAuthenticator(statePool *state.StatePool, clock clock.Clock) (*Authenticator, error)

NewAuthenticator returns a new Authenticator using the given StatePool.

func (*Authenticator) AddHandlers

func (a *Authenticator) AddHandlers(mux *apiserverhttp.Mux) error

AddHandlers adds the handlers to the given mux for handling local macaroon logins.

func (*Authenticator) Authenticate

func (a *Authenticator) Authenticate(req *http.Request) (authentication.AuthInfo, error)

Authenticate is part of the httpcontext.Authenticator interface.

func (*Authenticator) AuthenticateLoginRequest

func (a *Authenticator) AuthenticateLoginRequest(
	ctx context.Context,
	serverHost string,
	modelUUID string,
	authParams authentication.AuthParams,
) (_ authentication.AuthInfo, err error)

AuthenticateLoginRequest authenticates a LoginRequest.

func (*Authenticator) CreateLocalLoginMacaroon

func (a *Authenticator) CreateLocalLoginMacaroon(ctx context.Context, tag names.UserTag, version bakery.Version) (*macaroon.Macaroon, error)

CreateLocalLoginMacaroon is part of the httpcontext.LocalMacaroonAuthenticator interface.

func (*Authenticator) Maintain

func (a *Authenticator) Maintain(done <-chan struct{})

Maintain periodically expires local login interactions.

type OpenLoginAuthorizer

type OpenLoginAuthorizer struct{}

OpenLoginAuthorizer authorises any login operation presented to it.

func (OpenLoginAuthorizer) AuthorizeOps

func (OpenLoginAuthorizer) AuthorizeOps(ctx context.Context, authorizedOp bakery.Op, queryOps []bakery.Op) ([]bool, []checkers.Caveat, error)

AuthorizeOps implements OpsAuthorizer.AuthorizeOps.

type PermissionDelegator

type PermissionDelegator struct {
	State *state.State
}

func (*PermissionDelegator) PermissionError

func (p *PermissionDelegator) PermissionError(
	_ names.Tag,
	_ permission.Access,
) error

func (*PermissionDelegator) SubjectPermissions

func (p *PermissionDelegator) SubjectPermissions(
	e authentication.Entity,
	s names.Tag,
) (permission.Access, error)

SubjectPermissions implements PermissionDelegator

Jump to

Keyboard shortcuts

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