middleware

package
v1.1.23 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRequestLogging added in v1.1.14

func AddRequestLogging(next http.Handler) http.Handler

func AddViewerToLogs added in v1.1.14

func AddViewerToLogs(next http.Handler, fromContext func(context.Context) any) http.Handler

func AuthenticateWithClerk

func AuthenticateWithClerk(
	loggedOutVC func(ctx context.Context) context.Context,
	newContextFromBase func(ctx context.Context, base *viewer.Context) context.Context,
) func(http.Handler) http.Handler

func Chain

func Chain(middlewares ...func(http.Handler) http.Handler) func(http.Handler) http.Handler

func CookieAuth

func CookieAuth(next http.Handler) http.Handler

func EnableCORS

func EnableCORS(clientURL string) func(http.Handler) http.Handler

func IsViewerOverrideSet

func IsViewerOverrideSet(r *http.Request) bool

func SetManualViewer

func SetManualViewer(
	newContextFromBase func(ctx context.Context, base *viewer.Context) context.Context,
) func(http.Handler) http.Handler

func SkipIf

func SkipIf(
	shouldSkip func(r *http.Request) bool,
	mw func(http.Handler) http.Handler,
) func(http.Handler) http.Handler

func UseIf

func UseIf(
	shouldRun func(r *http.Request) bool,
	mw func(http.Handler) http.Handler,
) func(http.Handler) http.Handler

func WebsocketInit

func WebsocketInit(
	loggedOutVC func(ctx context.Context) context.Context,
	newContextFromBase func(ctx context.Context, base *viewer.Context) context.Context,
) transport.WebsocketInitFunc

func WithCustomClaims

func WithCustomClaims() clerkhttp.AuthorizationOption

func WriteClerkSessionClaimsFromLocalDB added in v1.1.3

func WriteClerkSessionClaimsFromLocalDB(
	hook *clerkhooks.ClerkHook,
	toApCtx func(ctx context.Context) context.Context,
) func(http.Handler) http.Handler

Types

type CustomClaims

type CustomClaims struct {
	UserID        string `json:"app_user_id"`
	Role          string `json:"app_user_role"`
	OrgID         string `json:"app_org_id"`
	PersonalOrgID string `json:"app_personal_org_id"`
}

Jump to

Keyboard shortcuts

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