middleware

package
v0.29.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: BSD-3-Clause Imports: 15 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessControl added in v0.10.4

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

AccessControl middleware to restrict to make POST/PUT/DELETE requests by admin only

func NewAccessControl added in v0.10.4

func NewAccessControl(audience, userIDClaim string, getUser GetUser) *AccessControl

NewAccessControl instance constructor

func (*AccessControl) Handler added in v0.10.4

func (a *AccessControl) Handler(h http.Handler) http.Handler

Handler method of the middleware which forbids all modify requests for non admin users

type AuthMiddleware added in v0.15.0

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

AuthMiddleware middleware to verify personal access tokens (PAT) and JWT tokens

func NewAuthMiddleware added in v0.15.0

func NewAuthMiddleware(getAccountFromPAT GetAccountFromPATFunc, validateAndParseToken ValidateAndParseTokenFunc,
	markPATUsed MarkPATUsedFunc, checkUserAccessByJWTGroups CheckUserAccessByJWTGroupsFunc, claimsExtractor *jwtclaims.ClaimsExtractor,
	audience string, userIdClaim string) *AuthMiddleware

NewAuthMiddleware instance constructor

func (*AuthMiddleware) Handler added in v0.15.0

func (m *AuthMiddleware) Handler(h http.Handler) http.Handler

Handler method of the middleware which authenticates a user either by JWT claims or by PAT

type CheckUserAccessByJWTGroupsFunc added in v0.25.0

type CheckUserAccessByJWTGroupsFunc func(ctx context.Context, claims jwtclaims.AuthorizationClaims) error

CheckUserAccessByJWTGroupsFunc function

type GetAccountFromPATFunc added in v0.15.0

type GetAccountFromPATFunc func(ctx context.Context, token string) (*server.Account, *server.User, *server.PersonalAccessToken, error)

GetAccountFromPATFunc function

type GetUser added in v0.20.0

type GetUser func(ctx context.Context, claims jwtclaims.AuthorizationClaims) (*server.User, error)

GetUser function defines a function to fetch user from Account by jwtclaims.AuthorizationClaims

type MarkPATUsedFunc added in v0.15.0

type MarkPATUsedFunc func(ctx context.Context, token string) error

MarkPATUsedFunc function

type ValidateAndParseTokenFunc added in v0.15.0

type ValidateAndParseTokenFunc func(ctx context.Context, token string) (*jwt.Token, error)

ValidateAndParseTokenFunc function

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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