Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Handler ErrInternal = httperror.NewInternalHttpError(errors.New(""), "") ErrRequestBodyEmpty = httperror.NewExternalHttpError(errors.New("request body empty"), http.StatusBadRequest) ErrBadJsonBody = httperror.NewExternalHttpError(errors.New("bad request json body"), http.StatusBadRequest) ErrFailedReadBody = httperror.NewInternalHttpError(errors.New("failed read request body"), "") // Use WithDesc() and WithFuncName() to write response // Middleware ErrGetJWTClaims = httperror.NewInternalHttpError(errors.New("failed get jwt claims"), "AuthMiddleware.WithAuth") ErrUserNotAuthorized = httperror.NewExternalHttpError(errors.New("user not authorized"), http.StatusUnauthorized) ErrBadJWTToken = httperror.NewExternalHttpError(errors.New("bad jwt token"), http.StatusBadRequest) ErrJwtSignatureInvalid = httperror.NewExternalHttpError(errors.New("jwt signature is invalid"), http.StatusBadRequest) ErrAuthorizationExpired = httperror.NewExternalHttpError(errors.New("authorization expired"), http.StatusUnauthorized) )
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewAuthHandler ¶
func NewAuthHandler(cfg authconfig.AuthHandlerConfig) Handler
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
func NewAuthMiddleware ¶
func NewAuthMiddleware(cfg authconfig.AuthMiddlewareConfig) Middleware
func (Middleware) WithAuth ¶
func (mid Middleware) WithAuth(handler http.HandlerFunc) http.HandlerFunc
Extract username from jwt and put him in request context
Click to show internal directories.
Click to hide internal directories.