Documentation
¶
Index ¶
- Constants
- Variables
- func CORS(config CORSConfig) func(next husky.Handler) husky.Handler
- func CORSConfigured(config CORSConfig) func(next husky.Handler) husky.Handler
- func CORSError(ctx *husky.CTX) error
- func JWT() func(next husky.Handler) husky.Handler
- func JWTError(c husky.CTX) error
- type CORSConfig
- type JWTConfig
- type TokenParser
Constants ¶
View Source
const ( // AlgoHS256 is 256 bit encryption AlgoHS256 = "HS256" // AlgoHS512 is 512 bit encryption AlgoHS512 = "HS512" // AlgoHS1024 is 1024 bit encryptions AlgoHS1024 = "HS1024" )
Variables ¶
View Source
var DefaultCORSConfig = CORSConfig{ AllowedOrigins: []string{"*"}, AllowedMethods: []string{"GET", "POST", "PATCH", "PUT", "DELETE", "OPTIONS"}, AllowedHeaders: []string{"*"}, ExposedHeaders: []string{"*"}, }
DefaultCORSConfig handles the default CORS configuration for Huksy
View Source
var DefaultJWT = JWTConfig{ SigningKey: "secret", SigningMethod: AlgoHS256, }
DefaultJWT is the default settings for the JWT
Functions ¶
func CORS ¶
func CORS(config CORSConfig) func(next husky.Handler) husky.Handler
CORS middleware for Husky routes
func CORSConfigured ¶
func CORSConfigured(config CORSConfig) func(next husky.Handler) husky.Handler
CORSConfigured returns a configured CORS middleware func CORSConfigured(ctx husky.Context, handler husky.Handler, config CORSConfig) husky.Handler {
Types ¶
type CORSConfig ¶
type CORSConfig struct {
AllowedOrigins []string `json:"allowed_origins"`
AllowedMethods []string `json:"allowed_methods"`
AllowedHeaders []string `json:"allowed_headers"`
ExposedHeaders []string `json:"exposed_headers"`
}
CORSConfig configuration for CORS middleware
Click to show internal directories.
Click to hide internal directories.