Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ForgotPWApi ¶
ForgotPWApi API struct.
func NewForgotPWApi ¶
func NewForgotPWApi() *ForgotPWApi
NewForgotPWApi As a constructor to get forgot password API. Related with NewResetPWApi
func (*ForgotPWApi) Handle ¶
func (h *ForgotPWApi) Handle(c *core.Ctx) error
Handle method to forget password. @Summary Forgot password @Description Forgot password. @Tags Password @Accept json @Produce json @Param data body request.ForgotPassword true "Forgot password payload" @Success 204 @Failure 400 {object} http.Error @Router /password/forgot [post]
type RefreshTokenApi ¶
func NewRefreshTokenApi ¶
func NewRefreshTokenApi() *RefreshTokenApi
NewRefreshTokenApi As a constructor to create new API.
func (*RefreshTokenApi) Handle ¶
func (h *RefreshTokenApi) Handle(c *core.Ctx) error
Handle method to refresh user token. @Description Refresh user token @Summary refresh user token @Tags Auth @Accept json @Produce json @Param data body request.RefreshToken true "RefreshToken payload" @Failure 400 {object} http.Error @Failure 401 {object} http.Error @Success 200 {object} response.SignIn @Security ApiKeyAuth @Router /auth/refresh [put]
type ResetPWApi ¶
ResetPWApi API struct.
func NewResetPWApi ¶
func NewResetPWApi() *ResetPWApi
NewResetPWApi As a constructor to get reset password API. Related with NewForgotPWApi
func (*ResetPWApi) Handle ¶
func (h *ResetPWApi) Handle(c *core.Ctx) error
Handle method to reset password. @Summary Reset password @Description Reset password. @Tags Password @Accept json @Produce json @Param data body request.ResetPassword true "Reset password payload" @Success 204 @Failure 400 {object} http.Error @Router /password/reset [post]
type SignInApi ¶
func (*SignInApi) Handle ¶
Handle func handle sign in user then returns access token and refresh token @Description Authenticating user's credentials then return access and refresh token if valid. Otherwise, return an error message. @Summary authenticating user's credentials @Tags Auth @Accept json @Produce json @Param data body request.SignIn true "Signin payload" @Success 200 {object} response.SignIn @Failure 400 {object} http.Error @Router /auth/signin [post]
type SignOutApi ¶
func NewSignOutApi ¶
func NewSignOutApi(authType auth.Type) *SignOutApi
NewSignOutApi As a constructor to create new API.
func (*SignOutApi) Handle ¶
func (h *SignOutApi) Handle(c *core.Ctx) error
Handle method to invalidate users access token by adding them to a blacklist in Redis and delete refresh token from the Redis @Description De-authorize user and delete refresh token from Redis. @Summary de-authorize user and delete refresh token from Redis @Tags Auth @Accept json @Produce json @Failure 400 {object} http.Error @Failure 401 {object} http.Error @Success 204 @Security ApiKeyAuth @Router /auth/signout [delete]
type SignUp ¶
func NewSignUpApi ¶
func NewSignUpApi() *SignUp
func (*SignUp) Handle ¶
Handle function handle sign up user includes create user, create user's role. @Description Create a new user with `request.SignUp` body then add `role id` to table `user_roles` with current `user id` @Summary Sign up a new user @Tags Auth @Accept json @Produce json @Param data body request.SignUp true "Signup payload" @Failure 400 {object} http.Error @Success 200 {object} response.SignUp @Router /auth/signup [post]