Documentation ¶
Index ¶
- type Credentials
- type Router
- func (rt *Router) AuthMiddleware(next http.Handler) http.Handler
- func (rt *Router) Info(w http.ResponseWriter, r *http.Request)
- func (rt *Router) Login(w http.ResponseWriter, r *http.Request)
- func (rt *Router) Logout(w http.ResponseWriter, r *http.Request)
- func (rt *Router) PostmanAuthMW(next http.Handler) http.Handler
- func (rt *Router) PostmanLogin(w http.ResponseWriter, r *http.Request)
- func (rt *Router) PostmanLogout(w http.ResponseWriter, r *http.Request)
- func (rt *Router) ProfilerOff(w http.ResponseWriter, r *http.Request)
- func (rt *Router) ProfilerOn(w http.ResponseWriter, r *http.Request)
- func (rt *Router) TokenMW(next http.Handler) http.Handler
- type TokenPair
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Credentials ¶
Credentials is a struct to read the username and password from the request body
type Router ¶
Router ...
func New ¶
func New(stor storage.UserStorage, jwtSecretKey string, slog *zap.SugaredLogger) *Router
New creates a new router
func (*Router) AuthMiddleware ¶
AuthMiddleware implements password check middleware
func (*Router) Info ¶
func (rt *Router) Info(w http.ResponseWriter, r *http.Request)
Info checks token and sends username as response
func (*Router) Login ¶
func (rt *Router) Login(w http.ResponseWriter, r *http.Request)
Login handle func produces JWT and refresh token
func (*Router) Logout ¶
func (rt *Router) Logout(w http.ResponseWriter, r *http.Request)
Logout clears users tokens
func (*Router) PostmanAuthMW ¶
PostmanAuthMW ...
func (*Router) PostmanLogin ¶
func (rt *Router) PostmanLogin(w http.ResponseWriter, r *http.Request)
PostmanLogin handle func produces JWT and refresh token
func (*Router) PostmanLogout ¶
func (rt *Router) PostmanLogout(w http.ResponseWriter, r *http.Request)
PostmanLogout clears users tokens
func (*Router) ProfilerOff ¶
func (rt *Router) ProfilerOff(w http.ResponseWriter, r *http.Request)
ProfilerOff makes it impossible to use /debug/pprof/* endpoints
func (*Router) ProfilerOn ¶
func (rt *Router) ProfilerOn(w http.ResponseWriter, r *http.Request)
ProfilerOn makes it possible to use /debug/pprof/* endpoints to get application profile
Click to show internal directories.
Click to hide internal directories.