Documentation ¶
Index ¶
- func ClearRefreshInContext(c *gin.Context)
- func Login(c *gin.Context)
- func Logout(c *gin.Context)
- func Refresh(c *gin.Context)
- func Registration(c *gin.Context)
- func Router(route *gin.RouterGroup)
- func SetRefreshToContext(c *gin.Context, refreshToken string) error
- type AuthResponse
- type AuthSerializer
- type LoginValidator
- type RefreshValidator
- type RegisterValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearRefreshInContext ¶
func Login ¶
Login godoc
@Summary User login @Schemes @Tags Auth @Accept json @Produce json @Success 200 {object} AuthResponse @Failure 400 {object} utils.CommonError @Failure 422 {object} utils.CommonValidationError @Param request body LoginValidator true "Request Body" @Router /auth/login [post]
func Logout ¶
Logout godoc
@Summary Logout (clear refresh token from cookies) @Schemes @Tags Auth @Accept json @Produce json @Success 204 "Empty response" @Param cookie header string false "Required Cookie" default(refresh_token="...") @Router /auth/logout [delete]
func Refresh ¶
Refresh godoc
@Summary Refresh token pair @Schemes @Tags Auth @Accept json @Produce json @Success 200 {object} AuthResponse @Failure 401 {object} utils.CommonError @Param cookie header string true "Cookie" default(refresh_token="...") @Router /auth/refresh [get]
func Registration ¶
Registration godoc
@Summary User registration @Schemes @Tags Auth @Accept json @Produce json @Success 200 {object} AuthResponse @Failure 422 {object} utils.CommonValidationError @Param request body RegisterValidator true "Request Body" @Router /auth/registration [post]
func Router ¶
func Router(route *gin.RouterGroup)
Types ¶
type AuthResponse ¶
type AuthSerializer ¶
func (*AuthSerializer) Response ¶
func (self *AuthSerializer) Response() AuthResponse
type LoginValidator ¶
type LoginValidator struct { Email string `json:"email" binding:"required,email"` Password string `json:"password" binding:"required"` }
func NewLoginValidator ¶
func NewLoginValidator() LoginValidator
type RefreshValidator ¶ added in v0.7.2
type RefreshValidator struct {
Token string `json:"token" binding:""`
}
func NewRefreshValidator ¶ added in v0.7.2
func NewRefreshValidator() RefreshValidator
type RegisterValidator ¶
type RegisterValidator struct { Email string `json:"email" binding:"required,email"` Password string `json:"password" binding:"required,min=8,max=64"` UserModel models.UserModel `json:"-"` }
func NewRegisterValidator ¶
func NewRegisterValidator() RegisterValidator
Click to show internal directories.
Click to hide internal directories.