service

package
v0.0.0-...-c8f3ee7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthInterceptor

type AuthInterceptor struct {
	// contains filtered or unexported fields
}

func NewAuthInterceptor

func NewAuthInterceptor(jwtManager *JWTManager, accessibleRoles map[string][]string) *AuthInterceptor

func (*AuthInterceptor) Stream

func (interceptor *AuthInterceptor) Stream() grpc.StreamServerInterceptor

func (*AuthInterceptor) Unary

func (interceptor *AuthInterceptor) Unary() grpc.UnaryServerInterceptor

type JWTManager

type JWTManager struct {
	// contains filtered or unexported fields
}

func NewJWTManager

func NewJWTManager(secretKey string, tokenDuration time.Duration) *JWTManager

func (*JWTManager) Generate

func (manager *JWTManager) Generate(user *model2.User) (string, error)

func (*JWTManager) Verify

func (manager *JWTManager) Verify(accessToken string) (*UserClaims, error)

type UserClaims

type UserClaims struct {
	jwt.StandardClaims
	Username string `json:"username"`
	Role     string `json:"role"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL