1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- package model
- import (
- "github.com/golang-jwt/jwt"
- "iot_manager_service/app/system/dao"
- )
- type JwtToken struct {
- jwt.StandardClaims
- TenantId string `json:"tenant_id"`
- UserId int64 `json:"user_id"`
- TokenType string `json:"token_type"`
- ClientId string `json:"client_id"`
- RoleId string `json:"role_id"`
- RoleName string `json:"role_name"`
- DeptId string `json:"dept_id"`
- PostId string `json:"post_id"`
- OauthId string `json:"oauth_id"`
- Account string `json:"account"`
- UserName string `json:"user_name"`
- NickName string `json:"nick_name"`
- Random string `json:"random"`
- }
- type Token struct {
- TenantId string
- UserName string
- Password string
- GrantType string
- RefreshToken string
- UserType string
- }
- type UserInfo struct {
- dao.User //用户基础信息
- Permissions []string //权限标识集合
- Roles []string //角色集合
- OauthId string //第三方授权id
- }
- type RspToken struct {
- TenantId string `json:"tenant_id"`
- UserId string `json:"user_id"`
- DeptId string `json:"dept_id"`
- PostId string `json:"post_id"`
- RoleId string `json:"role_id"`
- OauthId string `json:"oauth_id"`
- Account string `json:"account"`
- UserName string `json:"user_name"`
- NickName string `json:"nick_name"`
- RoleName string `json:"role_name"`
- Avatar string `json:"avatar"`
- AccessToken string `json:"access_token"`
- RefreshToken string `json:"refresh_token"`
- TokenType string `json:"token_type"`
- ExpiresIn int `json:"expires_in"`
- License string `json:"license"`
- }
- type RspCaptcha struct {
- Key string `json:"key"`
- Image string `json:"image"`
- }
- // JWT
- const (
- Iss = "iss"
- Aud = "aud"
- TenantId = "tenant_id"
- RoleName = "role_name"
- PostId = "post_id"
- UserId = "user_id"
- RoleId = "role_id"
- UserName = "user_name"
- OauthID = "oauth_id"
- NickName = "nick_name"
- TokenType = "token_type"
- DeptId = "dept_id"
- Account = "account"
- ClientId = "client_id"
- Exp = "exp"
- Nbf = "nbf"
- BEARER = "bearer"
- )
- const (
- CaptchaHeaderKey = "Captcha-Key"
- CaptchaHeaderCode = "Captcha-Code"
- CaptchaNotCorrect = "验证码不正确"
- UserTypeHeaderKey = "User-Type"
- UserNotFound = "用户名或密码错误"
- UserHasNoRole = "未获得用户的角色信息"
- USER_HAS_NO_TENANT = "未获得用户的租户信息"
- USER_HAS_NO_TENANT_PERMISSION = "租户授权已过期,请联系管理员"
- HEADER_KEY = "Authorization"
- HEADER_PREFIX = "Basic "
- DEFAULT_AVATAR = "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png"
- )
|