Documentation ¶
Index ¶
- Constants
- func SetReqUserToCtx(ctx context.Context, user ReqUser) context.Context
- func SetReqUserToGin(c *gin.Context, user ReqUser) *gin.Context
- type ApiPerm
- type GinAuthMidInter
- type JwtConf
- func (j *JwtConf) GetAccessToken(host string, source string, id interface{}, db string, perm ApiPerm) (*string, error)
- func (j *JwtConf) GetKid() string
- func (j *JwtConf) GetToken(host string, data map[string]interface{}, exp uint8) (*string, error)
- func (j *JwtConf) GetTokenWithRefresh(host string, data map[string]interface{}, exp uint8) (*token, error)
- func (j *JwtConf) NewJwt() JwtToken
- func (j *JwtConf) ParseToken(tokenStr string) (*jwt.Token, error)
- func (j *JwtConf) ParseTokenUnValidate(tokenStr string) (*jwt.Token, error)
- func (j *JwtConf) RefreshAccessToken(refreshToken string) (*string, error)
- type JwtDI
- type JwtToken
- type ReqUser
- type Totp
Constants ¶
View Source
const (
BearerAuthTokenKey = "Authorization"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GinAuthMidInter ¶
type GinAuthMidInter interface { mid.GinMiddle AddAuthPath(path string, method string, isAuth bool, group []ApiPerm) IsAuth(path string, method string) bool HasPerm(path, method string, perm []string) bool }
func NewGinBearAuthMid ¶
func NewGinBearAuthMid(isMatchHost bool) GinAuthMidInter
func NewMockAuthMid ¶
func NewMockAuthMid() GinAuthMidInter
type JwtConf ¶
type JwtConf struct { PrivateKeyFile string `yaml:"privatekey"` PublicKeyFile string `yaml:"publickey"` Header struct { Kid string `yaml:"kid"` } `yaml:"header"` Claims struct { ExpDuration time.Duration `yaml:"exp"` } `yaml:"claims"` RefreshSecret string `yaml:"refresh_secret"` // contains filtered or unexported fields }
func (*JwtConf) GetAccessToken ¶
func (*JwtConf) GetTokenWithRefresh ¶
func (*JwtConf) ParseTokenUnValidate ¶
type JwtToken ¶
type JwtToken interface { GetToken(host string, data map[string]interface{}, exp uint8) (*string, error) GetTokenWithRefresh(host string, data map[string]interface{}, exp uint8) (*token, error) ParseToken(tokenStr string) (*jwt.Token, error) ParseTokenUnValidate(tokenStr string) (*jwt.Token, error) // 對特定資源存取金鑰 GetAccessToken(host string, source string, id interface{}, db string, perm ApiPerm) (*string, error) RefreshAccessToken(refreshToken string) (*string, error) }
Click to show internal directories.
Click to hide internal directories.