Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UserContext ¶
type UserContext struct {
UserID int
}
UserContext represents the user context.
func GetUserContext ¶
func GetUserContext(c echo.Context) (*UserContext, error)
GetUserContext gets the UserContext from the echo.Context. UserContext is created by the UserAuthentication middleware.
type UserMiddleware ¶
type UserMiddleware struct { UserMiddlewareConfig UserMiddlewareDeps }
UserMiddleware represents our user middleware.
func NewUserMiddleware ¶
func NewUserMiddleware(cfg UserMiddlewareConfig, deps UserMiddlewareDeps) *UserMiddleware
NewUserMiddleware creates a new UserMiddleware.
func (*UserMiddleware) JWT ¶
func (um *UserMiddleware) JWT() echo.MiddlewareFunc
JWT catches the access_token and verifies it. We also extract the UserContext information from the JWT and set it in the echo.Context.
type UserMiddlewareConfig ¶
UserMiddlewareConfig represents the UserMiddleware config.
type UserMiddlewareDeps ¶
type UserMiddlewareDeps struct { Logger zerolog.Logger UserStore providers.UserStorer }
UserMiddlewareDeps represents the UserMiddleware dependencies.
Click to show internal directories.
Click to hide internal directories.