Documentation ¶
Index ¶
Constants ¶
View Source
const ( TOKEN_COOKIE_NAME = "access_token" TOKEN_GIN_KEY_NAME = "access_token" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LoginOutRequst ¶
type LoginOutRequst struct {
AccessToken string `json:"access_token"` //颁发给用户的访问令牌(需要用户携带token来访问接口)
}
万一的Token滋露,不知道refresh_token,也没法推出
type LoginRequst ¶
type Service ¶
type Service interface { Login(context.Context, *LoginRequst) (*Token, error) //登灵接口(额发Token) Logout(context.Context, *LoginOutRequst) error //登灵接口(销毁Token) ValiateToken(context.Context, *ValiateTokenRequst) (*Token, error) //校验Token 是给內部中间层使用 身份校验层 }
type Token ¶
type Token struct { UserID int64 `json:"user_id" gorm:"column:user_id"` //该token是颁发给谁的 UserName string `json:"username" gorm:"column:username"` //人的名字 AccessToken string `json:"access_token" gorm:"column:access_token"` //颁发给用户的访问令牌(需要用户携带token来访问接口) AccessTokenExpiredAt int `json:"access_token_expired_at" gorm:"column:access_token_expired_at"` //过期时间 RefreshToken string `json:"refresh_token" gorm:"column:refresh_token"` //刷新令牌 RefreshTokenExpiredAt int `json:"refresh_token_expired_at" gorm:"column:refresh_token_expired_at"` //刷新令牌过期时间 CreatedAt int64 `json:"created_at" gorm:"column:created_at"` //创建时间 UpdatedAt int64 `json:"updated_at" gorm:"column:updated_at"` //刷新时间 // AccessTokens string `json:"access_tokens"` //颁发给用户的访问令牌(需要用户携带token来访问接口) Role user.Roles `gorm:"-"` // 额外补充信息, gorm忽略处理,这样就不需要存在数据库中了 Access_token_expired_at_seconds string `gorm:"-"` // 额外补充信息, gorm忽略处理,这样就不需要存在数据库中了 }
type ValiateTokenRequst ¶
type ValiateTokenRequst struct {
AccessToken string `json:"access_token"`
}
func NewValiateTokenRequst ¶
func NewValiateTokenRequst(access_token_web string) *ValiateTokenRequst
让api调用使用的
Click to show internal directories.
Click to hide internal directories.