Documentation ¶
Index ¶
- Variables
- func AuthorizationServerInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (interface{}, error)
- func GetGlobalService(k GlobalServiceKey) interface{}
- func LoggingServerInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (interface{}, error)
- func RegisterGlobalService(ctx context.Context, service interface{}) context.Context
- type AuthService
- type AuthServiceOpts
- type GlobalServiceKey
- type TokenHandler
- type TokenHandlerOpts
- type UserClaims
- type UserInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var ( AuthServiceKey = GlobalServiceKey("authService") GrpcMethodsServiceKey = GlobalServiceKey("grpcMethodsService") )
Functions ¶
func AuthorizationServerInterceptor ¶
func AuthorizationServerInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
func GetGlobalService ¶
func GetGlobalService(k GlobalServiceKey) interface{}
func LoggingServerInterceptor ¶
func LoggingServerInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
Types ¶
type AuthService ¶
type AuthService struct {
// contains filtered or unexported fields
}
func NewAuthService ¶
func NewAuthService(opts *AuthServiceOpts) *AuthService
func (*AuthService) ValidateToken ¶
func (s *AuthService) ValidateToken(ctx context.Context) (*UserClaims, error)
type AuthServiceOpts ¶
type AuthServiceOpts struct {
TokenHandler *TokenHandler
}
type GlobalServiceKey ¶
type GlobalServiceKey string
type TokenHandler ¶
type TokenHandler struct {
// contains filtered or unexported fields
}
func NewTokenHandler ¶
func NewTokenHandler(opts TokenHandlerOpts) *TokenHandler
func (*TokenHandler) CreateToken ¶
func (t *TokenHandler) CreateToken(user *model.User) (string, error)
func (*TokenHandler) ParseToken ¶
func (t *TokenHandler) ParseToken(tokenString string) (*UserClaims, error)
type TokenHandlerOpts ¶
type UserClaims ¶
type UserClaims struct { *jwt.StandardClaims UserInfo }
Click to show internal directories.
Click to hide internal directories.