Documentation ¶
Index ¶
- type AuthenticationService
- func (a *AuthenticationService) ChangePassword(user *model.SystemUser) (err error)
- func (a *AuthenticationService) ForgetPassword(fpgUser *request.ForgetPassword) (err error)
- func (a *AuthenticationService) Login(loginuser *request.Login) (userInfo *response.Jwt, err error)
- func (a *AuthenticationService) Register(regiUser *request.Register) (err error)
- type JwtService
- func (j JwtService) BearerTokenFromHeader(c *gin.Context) (string, error)
- func (j JwtService) CheckJwtFromRedis(c *gin.Context, jwt string) bool
- func (j JwtService) CreateRedisAccessKey(jwt string) string
- func (j JwtService) CreateTokenPair(user model.SystemUser) (*response.Jwt, error)
- func (j JwtService) DelRedisAccessToken(jwt string) error
- func (j JwtService) ParseAccessToken(token string) (jwtutils.Claims, error)
- func (j JwtService) ParseHs256Token(token string, sign string) (jwtutils.Claims, error)
- func (j JwtService) ParseRefreshToken(token string) (jwtutils.Claims, error)
- func (j JwtService) SetJwtToRedis(jwt string, val string) error
- func (j JwtService) TokenRefresh(token response.Jwt) (*response.Jwt, error)
- type System
- type UserService
- func (u UserService) DeleteUser(id uint) error
- func (u UserService) GetUserBasicInfo(id uint) (response.UserBasicInfo, error)
- func (u UserService) GetUserBasicInfoList(pageInfo request.PageInfo) ([]response.UserBasicInfo, error)
- func (u UserService) GetUserSimpleInfo(id uint) (response.UserSimpleInfo, error)
- func (u UserService) GetUserSimpleInfoList(pageInfo request.PageInfo) ([]response.UserSimpleInfo, error)
- func (u UserService) UpdateUserInfo(id uint, user request.UpdateUser) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthenticationService ¶
type AuthenticationService struct{}
func (*AuthenticationService) ChangePassword ¶
func (a *AuthenticationService) ChangePassword(user *model.SystemUser) (err error)
func (*AuthenticationService) ForgetPassword ¶
func (a *AuthenticationService) ForgetPassword(fpgUser *request.ForgetPassword) (err error)
ForgetPassword @Date 2023-02-08 21:29:46 @Param user *sysreq.ForgetPassword @Return err error @Method @Description: 忘记密码服务
type JwtService ¶
type JwtService struct { }
func (JwtService) BearerTokenFromHeader ¶
func (j JwtService) BearerTokenFromHeader(c *gin.Context) (string, error)
BearerTokenFromHeader @Date 2023-02-09 22:18:58 @Param c *gin.Context @Return string @Return error @Method @Description: 从请求头中获取Bearer token
func (JwtService) CheckJwtFromRedis ¶
func (j JwtService) CheckJwtFromRedis(c *gin.Context, jwt string) bool
CheckJwtFromRedis @Date 2023-02-09 22:20:37 @Param c gin.Context @Param jwt string @Return bool @Method @Description: 检查Redis中的jwt是否存在
func (JwtService) CreateRedisAccessKey ¶
func (j JwtService) CreateRedisAccessKey(jwt string) string
CreateRedisAccessKey @Date 2023-02-09 22:28:38 @Description: 创建AccessToken在Redis的key
func (JwtService) CreateTokenPair ¶
func (j JwtService) CreateTokenPair(user model.SystemUser) (*response.Jwt, error)
CreateTokenPair @Date 2023-02-10 15:48:13 @Param user sysrep.SystemUser @Return sysrep.Jwt @Return error @Method @Description: 根据用户信息创建一对token
func (JwtService) DelRedisAccessToken ¶
func (j JwtService) DelRedisAccessToken(jwt string) error
DelRedisAccessToken @Date 2023-02-10 18:01:19 @Param jwt string @Return error @Method @Description: 删除Redis中的AccessToken
func (JwtService) ParseAccessToken ¶
func (j JwtService) ParseAccessToken(token string) (jwtutils.Claims, error)
ParseAccessToken @Date 2023-02-09 22:51:06 @Param token string @Return jwtutils.Claims @Return error @Method @Description: 解析Access token
func (JwtService) ParseHs256Token ¶
ParseHs256Token @Date 2023-02-10 16:22:46 @Param token string @Param sign string @Return jwtutils.Claims @Return error @Description: 解析Hs256加密的token
func (JwtService) ParseRefreshToken ¶
func (j JwtService) ParseRefreshToken(token string) (jwtutils.Claims, error)
ParseRefreshToken @Date 2023-02-09 22:51:19 @Param token string @Return jwtutils.Claims @Return error @Method @Description: 解析Refresh Token
func (JwtService) SetJwtToRedis ¶
func (j JwtService) SetJwtToRedis(jwt string, val string) error
SetJwtToRedis @Date 2023-02-09 22:25:42 @Param c *gin.Context @Param jwt string @Method @Description: 将Jwt存入Redis中
func (JwtService) TokenRefresh ¶
TokenRefresh @Date 2023-02-10 15:32:28 @Return sysrep.Jwt @Return error @Description: Token刷新服务
type System ¶
type System struct { UserService AuthenticationService JwtService }
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func (UserService) DeleteUser ¶
func (u UserService) DeleteUser(id uint) error
DeleteUser @Date 2023-02-26 21:12:06 @Param id int @Return error @Description: 删除一个用户
func (UserService) GetUserBasicInfo ¶
func (u UserService) GetUserBasicInfo(id uint) (response.UserBasicInfo, error)
GetUserBasicInfo @Date 2023-02-26 21:12:21 @Param id int @Return response.UserBasicInfo @Return error @Description: 查询一个用户的基本信息
func (UserService) GetUserBasicInfoList ¶
func (u UserService) GetUserBasicInfoList(pageInfo request.PageInfo) ([]response.UserBasicInfo, error)
GetUserBasicInfoList @Date 2023-02-26 21:12:11 @Param pageInfo request.PageInfo @Return []response.UserBasicInfo @Return error @Description: 查询用户基本信息列表
func (UserService) GetUserSimpleInfo ¶
func (u UserService) GetUserSimpleInfo(id uint) (response.UserSimpleInfo, error)
GetUserSimpleInfo @Date 2023-02-26 21:12:26 @Param id int @Return response.UserSimpleInfo @Return error @Description: 查询一个用户的简单信息
func (UserService) GetUserSimpleInfoList ¶
func (u UserService) GetUserSimpleInfoList(pageInfo request.PageInfo) ([]response.UserSimpleInfo, error)
GetUserSimpleInfoList @Date 2023-02-26 21:12:17 @Param pageInfo request.PageInfo @Return []response.UserSimpleInfo @Return error @Description: 查询用户简单信息列表
func (UserService) UpdateUserInfo ¶
func (u UserService) UpdateUserInfo(id uint, user request.UpdateUser) error
UpdateUserInfo @Date 2023-02-26 21:11:58 @Param id int @Param user request.UpdateUser @Return error @Description: 更新一个用的基本信息