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) ParseToken(tokenStr string) (*jwt.Token, error)
- type JwtDI
- type JwtToken
- type ReqUser
- 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, 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, 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 ¶
type JwtToken ¶
type JwtToken interface { GetToken(host string, data map[string]interface{}, exp uint8) (*string, error) ParseToken(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
func GetUserInfo ¶ added in v0.3.0
func NewGuestUser ¶ added in v0.6.0
func NewReqUser ¶ added in v0.3.0
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.