Documentation ¶
Index ¶
- Variables
- type AuthenticationToken
- type Cipher
- type Handler
- func (h Handler) AdminMiddleware() gin.HandlerFunc
- func (h Handler) Authenticate(email, password string) (AuthenticationToken, error)
- func (h Handler) GenerateRefreshToken(email string) (RefreshToken, error)
- func (h Handler) Middleware() gin.HandlerFunc
- func (h Handler) Refresh(token string) (AuthenticationToken, error)
- func (h Handler) UserFromContext(c *gin.Context) (User, error)
- type JWTClaim
- type Params
- type RefreshToken
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrExpiredRefreshToken = errors.New("auth: can not refresh auth token, refresh token is expired")
View Source
var ErrInvalidCredentials = errors.New("auth: can not authenticate, invalid email or password")
Functions ¶
This section is empty.
Types ¶
type AuthenticationToken ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(userRepo user.Repository, cipher Cipher, params Params) *Handler
func (Handler) AdminMiddleware ¶
func (h Handler) AdminMiddleware() gin.HandlerFunc
func (Handler) Authenticate ¶
func (h Handler) Authenticate(email, password string) (AuthenticationToken, error)
func (Handler) GenerateRefreshToken ¶
func (h Handler) GenerateRefreshToken(email string) (RefreshToken, error)
func (Handler) Middleware ¶
func (h Handler) Middleware() gin.HandlerFunc
type RefreshToken ¶
type RefreshToken struct {
Token string
}
Click to show internal directories.
Click to hide internal directories.