middleware

package
v0.0.0-...-5874fb6 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthWorkspaceID authKey = "middleware.auth.workspaceID"

	Issuer = "obsidian-rt"
)

Variables

This section is empty.

Functions

func Cors

func Cors(opt CorsOptions) func(next http.Handler) http.Handler

func CreateToken

func CreateToken(ao AuthOptions, workspaceID int64) (string, error)

func IsAuthenticated

func IsAuthenticated(ao AuthOptions) func(next http.Handler) http.Handler

func Logging

func Logging(next http.Handler) http.Handler

func VerifyToken

func VerifyToken(ao AuthOptions, tokenString string) (int64, error)

func WorkspaceIDFromCtx

func WorkspaceIDFromCtx(ctx context.Context) int64

Types

type AuthOptions

type AuthOptions struct {
	SecretKey []byte
}

type CorsOptions

type CorsOptions = cors.Options

type CustomClaims

type CustomClaims struct {
	jwt.RegisteredClaims
}

type Middleware

type Middleware func(http.Handler) http.Handler

func CreateStack

func CreateStack(xs ...Middleware) Middleware

Jump to

Keyboard shortcuts

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