middleware

package
v0.0.0-...-823d357 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2021 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionName       = "session"
	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 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.

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)

Jump to

Keyboard shortcuts

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