middleware

package
v0.80.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: BSD-3-Clause, AGPL-3.0 Imports: 18 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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(
	authManager serverauth.Manager,
	ensureAccount EnsureAccountFunc,
	syncUserJWTGroups SyncUserJWTGroupsFunc,
	getUserFromUserAuth GetUserFromUserAuthFunc,
	rateLimiter *ratelimit.APIRateLimiter,
	meter metric.Meter,
	isValidChildAccount IsValidChildAccountFunc,
) *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 EnsureAccountFunc added in v0.37.0

type EnsureAccountFunc func(ctx context.Context, userAuth auth.UserAuth) (string, string, error)

type GetUserFromUserAuthFunc added in v0.42.0

type GetUserFromUserAuthFunc func(ctx context.Context, userAuth auth.UserAuth) (*types.User, error)

type IsValidChildAccountFunc added in v0.72.0

type IsValidChildAccountFunc func(ctx context.Context, userID, accountID, childAccountID string) bool

type PATUsageTracker added in v0.60.5

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

PATUsageTracker tracks PAT usage metrics

func NewPATUsageTracker added in v0.60.5

func NewPATUsageTracker(ctx context.Context, meter metric.Meter) (*PATUsageTracker, error)

NewPATUsageTracker creates a new PAT usage tracker with metrics

func (*PATUsageTracker) IncrementUsage added in v0.60.5

func (t *PATUsageTracker) IncrementUsage(token string)

IncrementUsage increments the usage counter for a given token

func (*PATUsageTracker) Stop added in v0.60.5

func (t *PATUsageTracker) Stop()

Stop stops the reporting goroutine

type SyncUserJWTGroupsFunc added in v0.37.0

type SyncUserJWTGroupsFunc func(ctx context.Context, userAuth auth.UserAuth) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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