Documentation
¶
Index ¶
Constants ¶
const ( RefreshTokenExpired = 24 * time.Hour * 3 AccessTokenExpired = 2 * time.Hour )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Auth ¶
type Auth struct {
*apputils.ServerUtils
}
func (*Auth) InitGlobalRoute ¶
func (a *Auth) InitGlobalRoute(g *gin.RouterGroup)
func (*Auth) InitRoute ¶
func (a *Auth) InitRoute(g *gin.RouterGroup)
func (*Auth) IsValidSession ¶
是否登录 godoc @Summary 是否登录 @Schemes @Description 是否登录 @Tags auth @Accept json @Produce json @Param token header string true "登录返回的Token" @Success 200 {object} model.CommonResponse[model.GetUserResponse] @Failure 400 {object} model.CommonResponse[any] @Router /isvalid [get]
func (*Auth) UserLogin ¶
登录 godoc @Summary 登录 @Schemes @Description 登录 @Tags auth @Accept json @Produce json @Param password query string true "密码" @Param userid query int false "用户ID" @Param name query string false "用户名" @Param email query string false "用户邮箱" @Success 200 {object} model.CommonResponse[model.TokenResponse] @Failure 400 {object} model.CommonResponse[any] @Router /login [post]
func (*Auth) UserLoginRefresh ¶
刷新登录令牌 godoc @Summary 刷新登录令牌 @Schemes @Description 刷新登录令牌 @Tags auth @Accept json @Produce json @Param refreshToken header int false "用户Refresh Token" @Success 200 {object} model.CommonResponse[model.TokenResponse] @Failure 400 {object} model.CommonResponse[any] @Router /refresh [post]