interceptor

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGetUserID    = errors.New("failed to get uid from context")
	ErrGetRequestID = errors.New("failed to get rid from context")
	ErrGetClaims    = errors.New("failed to get claims from context")
)

Functions

func AuthMatcher

func AuthMatcher(ctx context.Context, c interceptors.CallMeta) bool

func GetClaims

func GetClaims(ctx context.Context) (jwt.Claims, error)

func GetRequestID

func GetRequestID(ctx context.Context) (string, error)

GetRequestID from context, only throws ErrGetRequestID if uid not found in context

func GetUserID

func GetUserID(ctx context.Context) (string, error)

GetUserID from context, only throws ErrGetUserID if uid not found in context

Types

type Auth

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

func NewAuth

func NewAuth(opts Opts) *Auth

func (*Auth) Stream

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

func (*Auth) Unary

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

type Method

type Method string

type Opts

type Opts struct {
	fx.In
	JwtManager *jwt.Manager
	Scopers    []Scoper `group:"scopers"`
}

type Scope

type Scope string

type Scoper

type Scoper interface {
	Scope() map[Method]Scope
}

Jump to

Keyboard shortcuts

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