authn

package
v0.28.2-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrRestricted refuses a principal while the environment is restricted.
	ErrRestricted = types2.NewErrHTTP(http.StatusPaymentRequired, "Only admins can use this environment right now, because it's over its plan or its subscription couldn't be confirmed. An admin can bring usage back within the plan, or an owner can check the subscription.")
)

Functions

This section is empty.

Types

type AdmissionCheck added in v0.27.0

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

AdmissionCheck denies requests made by or for users who may not access Obot: disabled, deleted, or missing users, and while the environment is restricted, users who aren't admins or owners. It wraps the complete authenticator chain, so it runs once per request, after authentication and before authorization, whichever credential authenticated the request.

func NewAdmissionCheck added in v0.27.0

func NewAdmissionCheck(next authenticator.Request, restriction Restriction) *AdmissionCheck

NewAdmissionCheck returns the check. A nil restriction never restricts.

func (*AdmissionCheck) AuthenticateRequest added in v0.27.0

func (a *AdmissionCheck) AuthenticateRequest(req *http.Request) (*authenticator.Response, bool, error)

type Anonymous

type Anonymous struct{}

func (Anonymous) AuthenticateRequest

func (Anonymous) AuthenticateRequest(*http.Request) (*authenticator.Response, bool, error)

type Authenticator

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

func NewAuthenticator

func NewAuthenticator(authenticator authenticator.Request) *Authenticator

func (*Authenticator) Authenticate

func (a *Authenticator) Authenticate(req *http.Request) (user.Info, error)

type NoAuth

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

func NewNoAuth added in v0.5.0

func NewNoAuth(client *client.Client) *NoAuth

func (*NoAuth) AuthenticateRequest

func (n *NoAuth) AuthenticateRequest(req *http.Request) (*authenticator.Response, bool, error)

type Restriction added in v0.28.2

type Restriction interface {
	Restricted(context.Context) (bool, error)
}

Restriction reports whether the environment is restricted.

type Token added in v0.8.0

type Token struct {
	Token, Username string
	Groups          []string
}

func NewToken added in v0.8.0

func NewToken(token, username string, groups ...string) *Token

func (*Token) AuthenticateRequest added in v0.8.0

func (t *Token) AuthenticateRequest(req *http.Request) (*authenticator.Response, bool, error)

Jump to

Keyboard shortcuts

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