Documentation
¶
Index ¶
- Constants
- func Cors(opt CorsOptions) func(next http.Handler) http.Handler
- func CreateToken(ao AuthOptions, workspaceID int64) (string, error)
- func IsAuthenticated(ao AuthOptions) func(next http.Handler) http.Handler
- func Logging(next http.Handler) http.Handler
- func VerifyToken(ao AuthOptions, tokenString string) (int64, error)
- func WorkspaceIDFromCtx(ctx context.Context) int64
- type AuthOptions
- type CorsOptions
- type CustomClaims
- type Middleware
Constants ¶
View Source
const ( AuthWorkspaceID authKey = "middleware.auth.workspaceID" Issuer = "obsidian-rt" )
Variables ¶
This section is empty.
Functions ¶
func CreateToken ¶
func CreateToken(ao AuthOptions, workspaceID int64) (string, error)
func IsAuthenticated ¶
func IsAuthenticated(ao AuthOptions) func(next http.Handler) http.Handler
func VerifyToken ¶
func VerifyToken(ao AuthOptions, tokenString string) (int64, error)
func WorkspaceIDFromCtx ¶
Types ¶
type AuthOptions ¶
type AuthOptions struct {
SecretKey []byte
}
type CorsOptions ¶
type CustomClaims ¶
type CustomClaims struct {
jwt.RegisteredClaims
}
type Middleware ¶
func CreateStack ¶
func CreateStack(xs ...Middleware) Middleware
Click to show internal directories.
Click to hide internal directories.