Documentation ¶
Index ¶
Constants ¶
View Source
const (
CtxUserInfo = "user"
)
View Source
const (
TokenTTLHours = time.Hour * 24
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AClaims ¶
type AClaims struct { jwt.StandardClaims UserID string `json:"user_id"` Role model.UserRole `json:"role"` }
type AuthInterceptor ¶
type AuthInterceptor struct {
// contains filtered or unexported fields
}
func NewAuthInterceptor ¶
func NewAuthInterceptor(tokenManager TokenManager, whiteList map[string]interface{}) AuthInterceptor
func (AuthInterceptor) Unary ¶
func (i AuthInterceptor) Unary() grpc.UnaryServerInterceptor
type TokenManager ¶
type TokenManager struct {
// contains filtered or unexported fields
}
func NewTokenManager ¶
func NewTokenManager(secret string) TokenManager
func (TokenManager) Sign ¶
func (m TokenManager) Sign(claims jwt.Claims) (string, error)
Click to show internal directories.
Click to hide internal directories.