middleware

package
v0.36.2 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: BSD-3-Clause Imports: 15 Imported by: 4 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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) (*types.Account, *types.User, *types.PersonalAccessToken, error)

GetAccountFromPATFunc function

type GetUser added in v0.20.0

type GetUser func(ctx context.Context, claims jwtclaims.AuthorizationClaims) (*types.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