Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthInterceptor ¶
type AuthInterceptor struct {
JwtManager JwtManager
// contains filtered or unexported fields
}
func NewAuthInterceptor ¶
func NewAuthInterceptor(jwtManager JwtManager, methodsRoles map[string][]string) *AuthInterceptor
func (*AuthInterceptor) Unary ¶
func (ai *AuthInterceptor) Unary() grpc.UnaryServerInterceptor
type JwtManager ¶
func NewJWTManager ¶
func NewJWTManager(secretKey string, tokenDuration time.Duration) *JwtManager
func (*JwtManager) GenerateKey ¶
func (m *JwtManager) GenerateKey(user *User) (string, error)
func (*JwtManager) Verify ¶
func (m *JwtManager) Verify(token string) (*UserClaims, error)
type User ¶
func (*User) CheckPassword ¶
type UserClaims ¶
type UserClaims struct {
jwt.StandardClaims
Username string `json:"username"`
Role string `json:"role"`
}
Click to show internal directories.
Click to hide internal directories.