Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthMiddleware ¶
type AuthMiddleware struct {
// contains filtered or unexported fields
}
Middleware that checks if the requests contains a valid (not expired, not recalled) session token. Session token is expected to be in the Authorization HTTP header. Expected HTTP authorization scheme is "Bearer". Token is expected to be in the following format: {{.TokenId}}:{{.TokenSecret}} If the token is valid, database.User object of the token owner is inserted into the context under "user" key and the request is passed to the next handler. If the token is not valid, the middleware returns 401 Unauthorized and the request is not passed to the next handler.
func CreateAuthMiddleware ¶
func CreateAuthMiddleware(logger *log.Logger, tokenService services.TokenService) *AuthMiddleware
func (*AuthMiddleware) Handle ¶
func (middleware *AuthMiddleware) Handle(c *gin.Context)
Gin handler function for the middleware
type RequireValidEmailMiddleware ¶
type RequireValidEmailMiddleware struct {
// contains filtered or unexported fields
}
func CreateRequireValidEmailMiddleware ¶
func CreateRequireValidEmailMiddleware(logger *log.Logger) *RequireValidEmailMiddleware
func (*RequireValidEmailMiddleware) Handle ¶
func (middleware *RequireValidEmailMiddleware) Handle(c *gin.Context)
Click to show internal directories.
Click to hide internal directories.