middleware

package
v1.0.0-alpha.23 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AllowedConnections      int           = 256
	BacklogConnectionsLimit int           = 256
	BacklogWindow           time.Duration = 1 * time.Second
)

Variables

View Source
var (
	DefaultTimeout = 2 * time.Second
	MaximumTimeout = 5 * time.Second
)
View Source
var OutgoingHeaders = metadata.New(map[string]string{})
View Source
var (
	UserAgent = "tigris-forwarder/" + util.Version
)

Functions

func AuthFromMD

func AuthFromMD(ctx context.Context, expectedScheme string) (string, error)

func AuthFunction

func AuthFunction(ctx context.Context, jwtValidator *validator.Validator, config *config.Config) (ctxResult context.Context, err error)

func GetJWTValidator

func GetJWTValidator(config *config.Config) *validator.Validator

func GetNamespace

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

Types

type AccessToken

type AccessToken struct {
	Namespace string
	Sub       string
}

func GetAccessToken

func GetAccessToken(ctx context.Context) (*AccessToken, error)

type AccessTokenNamespaceExtractor

type AccessTokenNamespaceExtractor struct {
}

func (*AccessTokenNamespaceExtractor) Extract

func (tokenNamespaceExtractor *AccessTokenNamespaceExtractor) Extract(ctx context.Context) (string, error)

type CustomClaim

type CustomClaim struct {
	Namespace Namespace `json:"https://tigris-db-api/n"`
	User      User      `json:"https://tigris-db-api/u"`
}

func (CustomClaim) Validate

func (c CustomClaim) Validate(_ context.Context) error

type Forwarder

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

type Namespace

type Namespace struct {
	Code string `json:"code"`
}

type NamespaceExtractor

type NamespaceExtractor interface {
	Extract(ctx context.Context) (string, error)
}

NamespaceExtractor - extract the namespace from context

type NamespaceSetter

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

func (*NamespaceSetter) NamespaceSetterStreamServerInterceptor

func (r *NamespaceSetter) NamespaceSetterStreamServerInterceptor() grpc.StreamServerInterceptor

func (*NamespaceSetter) NamespaceSetterUnaryServerInterceptor

func (r *NamespaceSetter) NamespaceSetterUnaryServerInterceptor() func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

type RateLimiter

type RateLimiter struct {
}

func (*RateLimiter) Limit

func (r *RateLimiter) Limit(_ context.Context) error

type RequestMetadata

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

func GetRequestMetadata

func GetRequestMetadata(ctx context.Context) (*RequestMetadata, error)

type RequestMetadataCtxKey

type RequestMetadataCtxKey struct {
}

type TokenCtxkey

type TokenCtxkey struct{}

type User

type User struct {
	Email string `json:"email"`
}

Jump to

Keyboard shortcuts

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