Documentation
¶
Index ¶
- Constants
- Variables
- func Create(secretKey string, opts ...*CreateOptions) echo.MiddlewareFunc
- func GetToken(ctx echo.Context) (token string, err error)
- func GetUser(ctx echo.Context) (u *user.User, err error)
- func MustGetToken(ctx echo.Context) (token string)
- func MustGetUser(ctx echo.Context) (u *user.User)
- type CreateOptions
Constants ¶
View Source
const ContextUserKey = "zoox.connect::user"
ContextUserKey is the key for the user in the context.
Variables ¶
View Source
var Version = "1.2.0"
Version is the current version of the package.
Functions ¶
func Create ¶
func Create(secretKey string, opts ...*CreateOptions) echo.MiddlewareFunc
Create creates a connect middleware for gin.
func MustGetToken ¶ added in v1.2.0
func MustGetToken(ctx echo.Context) (token string)
MustGetToken get user from context.
func MustGetUser ¶ added in v1.2.0
MustGetUser get user from context.
Types ¶
type CreateOptions ¶
type CreateOptions struct {
RequireAuth bool
}
CreateOptions is the options for the Create middleware.
Click to show internal directories.
Click to hide internal directories.