Documentation ¶
Index ¶
Constants ¶
View Source
const APIPath = "/auth/"
APIPath is path prefix
Variables ¶
View Source
var ( // ErrInvalidPassword is occurred when invalid user password ErrInvalidPassword = errors.New("Invalid user password") // ErrInvalidRefreshToken is occurred when invalid refresh token ErrInvalidRefreshToken = errors.New("Invalid refresh token") )
Functions ¶
func RefreshTokenRedisStorageKey ¶
RefreshTokenRedisStorageKey return key that stored on redis
Types ¶
type AccessTokenByRefreshRequest ¶
type AccessTokenByRefreshRequest struct {
Token string `json:"token" example:"<refresh token>" binding:"required"`
}
AccessTokenByRefreshRequest is request model
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller is auth controller
func NewController ¶
func NewController(conf config.Configuration, service Service) *Controller
NewController return new auth controller instance.
func (*Controller) RegisterRoutes ¶
func (controller *Controller) RegisterRoutes(router gin.IRouter)
RegisterRoutes register handler routes.
type CreateAccessTokenRequest ¶
type CreateAccessTokenRequest struct { UserName string `json:"username" example:"<username>" binding:"required"` Password string `json:"password" example:"<password>" binding:"required"` }
CreateAccessTokenRequest is request model for creating todo
type Service ¶
type Service interface { VerifyAuthentication(username, password string) (user.User, error) GenerateAccessToken(userID int64) (string, error) IssueRefreshToken(userID int64) (string, error) VerifyRefreshToken(userID int64, refreshToken string) bool ExtractTokenClaims(token string) (jwt.MapClaims, error) }
Service is auth authService.
func NewService ¶
func NewService( conf config.Configuration, userRepo user.Repository, passport service.Passport, redisConn db.RedisConn) Service
NewService return new auth authService instance.
Click to show internal directories.
Click to hide internal directories.