Documentation
¶
Index ¶
- Constants
- type AccessGuest
- type CompanyUser
- type JwtConf
- func (j *JwtConf) GetCompanyToken(host, compID, compName, userID, acc, userName string, perm UserPerm) (*string, error)
- func (j *JwtConf) GetJwtAccessToken(host string, source string, id interface{}, db string, perm UserPerm) (*string, error)
- func (j *JwtConf) GetKid() string
- func (j *JwtConf) GetToken(host string, data map[string]interface{}, exp uint8) (*string, error)
- func (j *JwtConf) GetTokenWithoutExpired(host string, data map[string]interface{}) (*string, error)
- func (j *JwtConf) NewJwt() JwtToken
- func (j *JwtConf) ParseToken(tokenStr string) (*jwt.Token, error)
- func (j *JwtConf) ParseTokenUnValidate(tokenStr string) (*jwt.Token, error)
- type JwtDI
- type JwtToken
- type Perms
- type ReqUser
- type TargetReqUser
- type Totp
- type TransmitSecurity
- type TransmitSecurityConf
- type UserPerm
Constants ¶
View Source
const ( // 管理者 PermAdmin = UserPerm("admin") // 會員 PermMember = UserPerm("member") // 擁有 PermOwner = UserPerm("owner") // 編輯 PermEditor = UserPerm("editor") // 檢視 PermViewer = UserPerm("viewer") // 訪客 PermGuest = UserPerm("guest") )
View Source
const (
CtxUserInfoKey = util.CtxKey("userInfo")
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessGuest ¶ added in v0.3.0
func NewAccessGuest ¶ added in v0.3.0
func NewAccessGuest(host, source, sid, acc, name, db string, perm []string) AccessGuest
type CompanyUser ¶ added in v0.3.0
func GetCompUserInfo ¶ added in v0.3.0
func GetCompUserInfo(req *http.Request) CompanyUser
func NewCompUser ¶ added in v0.3.0
func NewCompUser(host, uid, acc, name, compID, comp string, perm []string) CompanyUser
type JwtConf ¶
type JwtConf struct {
PrivateKeyFile string `yaml:"privatekey"`
PublicKeyFile string `yaml:"publickey"`
Header struct {
Alg string `yaml:"alg"`
Typ string `yaml:"typ"`
Kid string `yaml:"kid"`
} `yaml:"header"`
Claims struct {
ExpDuration time.Duration `yaml:"exp"`
} `yaml:"claims"`
// contains filtered or unexported fields
}
func (*JwtConf) GetCompanyToken ¶
func (*JwtConf) GetJwtAccessToken ¶
func (*JwtConf) GetTokenWithoutExpired ¶ added in v1.1.0
type JwtToken ¶
type JwtToken interface {
GetTokenWithoutExpired(host string, data map[string]interface{}) (*string, error)
GetToken(host string, data map[string]interface{}, exp uint8) (*string, error)
ParseToken(tokenStr string) (*jwt.Token, error)
ParseTokenUnValidate(tokenStr string) (*jwt.Token, error)
// 對特定資源存取金鑰
GetJwtAccessToken(host string, source string, id interface{}, db string, perm UserPerm) (*string, error)
GetCompanyToken(host, compID, compName, userID, acc, userName string, perm UserPerm) (*string, error)
}
type ReqUser ¶ added in v0.3.0
type ReqUser interface {
dao.LogUser
Host() string
GetId() string
GetPerm() []string
GetDB() string
Encode() string
Decode(data string) error
}
func GetUserByGin ¶ added in v1.4.0
func GetUserInfo ¶ added in v0.3.0
func GetUserInfoByCtx ¶ added in v1.0.0
func NewEmptyReqUser ¶ added in v1.0.0
func NewEmptyReqUser() ReqUser
func NewGuestUser ¶ added in v0.6.0
func NewReqUser ¶ added in v0.3.0
type TargetReqUser ¶ added in v1.0.0
func GetTargetUserInfo ¶ added in v1.0.0
func GetTargetUserInfo(req *http.Request) TargetReqUser
func NewTargetReqUser ¶ added in v1.0.0
func NewTargetReqUser(target string, u ReqUser) TargetReqUser
type Totp ¶
type TransmitSecurity ¶
type TransmitSecurityConf ¶
type TransmitSecurityConf struct {
Host string
ClientId string `yaml:"clientId"`
Secret string `yaml:"clientSecret"`
}
func (*TransmitSecurityConf) GetAccessToken ¶
func (c *TransmitSecurityConf) GetAccessToken(code, redirect string) (string, error)
func (*TransmitSecurityConf) GetAuthUrl ¶
func (c *TransmitSecurityConf) GetAuthUrl(redirect string) string
func (*TransmitSecurityConf) GetUserInfo ¶
func (c *TransmitSecurityConf) GetUserInfo(accessToken string) (string, error)
Click to show internal directories.
Click to hide internal directories.