middleware

package
v0.0.0-...-37f2402 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 25 Imported by: 4

Documentation

Index

Constants

View Source
const (
	SessionName = "session"
	// Expiration time in unix format
	SessionKeyExpires = "expires"

	SessionKeyUsername = "user_name"
	SessionKeyGroups   = "groups"
)
View Source
const (
	ContextKeyUsername contextKey = iota
	ContextKeyGroups
	ContextKeyPortalDoc
)

Variables

This section is empty.

Functions

func Bearer

func Bearer(dbPortal database.Portal) func(http.Handler) http.Handler

Bearer validates a Bearer token and adds the corresponding username to the context if it checks out. It lets the request through regardless (this is so that failures can be logged).

func GroupsIntersect

func GroupsIntersect(as, bs []string) (gs []string)

func Log

func Log(env env.Core, auditLog, baseLog *logrus.Entry) func(http.Handler) http.Handler

func NewAAD

func NewAAD(log *logrus.Entry,
	audit *logrus.Entry,
	env env.Core,
	baseAccessLog *logrus.Entry,
	hostname string,
	sessionKey []byte,
	clientID string,
	clientKey *rsa.PrivateKey,
	clientCerts []*x509.Certificate,
	allGroups []string,
	unauthenticatedRouter *mux.Router,
	verifier oidc.Verifier) (*aad, error)

func Panic

func Panic(log *logrus.Entry) func(http.Handler) http.Handler

Types

type AAD

type AAD interface {
	AAD(http.Handler) http.Handler
	CheckAuthentication(http.Handler) http.Handler
	Login(http.ResponseWriter, *http.Request)
	Logout(string) http.Handler
}

AAD is responsible for ensuring that we have a valid login session with AAD.

Jump to

Keyboard shortcuts

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