Documentation
¶
Index ¶
- func CORSMiddleware(config CORSConfig) func(http.Handler) http.Handler
- func GetOwnerSubjectFromContext(ctx context.Context) (string, bool)
- func NewCORSMiddleware(allowedOrigins string) func(http.Handler) http.Handler
- func WithOwnerSubject(ctx context.Context, subject string) context.Context
- type CORSConfig
- type JWTAuthMiddleware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CORSMiddleware ¶
func CORSMiddleware(config CORSConfig) func(http.Handler) http.Handler
CORSMiddleware creates a CORS middleware with the given configuration
func GetOwnerSubjectFromContext ¶
GetOwnerSubjectFromContext extracts the authenticated owner's subject (UID) from the request context
func NewCORSMiddleware ¶
NewCORSMiddleware creates a CORS middleware with default configuration
Types ¶
type CORSConfig ¶
type CORSConfig struct {
AllowedOrigins []string
AllowedMethods []string
AllowedHeaders []string
ExposedHeaders []string
AllowCredentials bool
MaxAge int
}
CORSConfig holds the CORS configuration
func DefaultCORSConfig ¶
func DefaultCORSConfig(allowedOrigins string) CORSConfig
DefaultCORSConfig returns the default CORS configuration. The allowed origins can be overridden by setting the CORS_ALLOWED_ORIGINS environment variable (comma-separated).
type JWTAuthMiddleware ¶
type JWTAuthMiddleware struct {
// contains filtered or unexported fields
}
JWTAuthMiddleware provides HTTP middleware for JWT authentication
func NewJWTAuthMiddleware ¶
func NewJWTAuthMiddleware(verifier *auth.JWTVerifier) *JWTAuthMiddleware
NewJWTAuthMiddleware creates a new JWT authentication middleware
func (*JWTAuthMiddleware) Authenticate ¶
func (m *JWTAuthMiddleware) Authenticate(next http.Handler) http.Handler
Authenticate is the middleware function that validates JWT tokens