rpc_middlewares

package
v0.9.9-rc5 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RateLimiterKeyContext string = "rate_limiter"
)

Functions

func HasOneOfRole

func HasOneOfRole(roles []string, apiKey *models.ApiKey) bool

HasOneOfRole checks if the user has permission to access the given method based on multiple roles

func HasRole

func HasRole(role string, apiKey *models.ApiKey) bool

HasRole checks if the user has permission to access the given method

func NewApiKeyContext

func NewApiKeyContext(ctx context.Context, apiKey *models.ApiKey) context.Context

func NewAuthorizationContext

func NewAuthorizationContext(ctx context.Context, apiKey string) context.Context

func NewRateLimiterContext

func NewRateLimiterContext(ctx context.Context, cache *cache.Redis, apiKey *models.ApiKey) context.Context

func SetRateLimiterHeaders added in v0.9.6

func SetRateLimiterHeaders(ctx context.Context, w http.ResponseWriter) bool

func ToApiKeyContext

func ToApiKeyContext(ctx context.Context) (*models.ApiKey, bool)

func ToRateLimiterContext

func ToRateLimiterContext(ctx context.Context) (*rate_limiter.RateLimiter, bool)

func WithAcl

func WithAcl(dbAdapter db.Adapter, cache *cache.Redis) zenrpc.MiddlewareFunc

WithAcl is a middleware that performs access control based on the provided db.Adapter

func WithHeaders

func WithHeaders() zenrpc.MiddlewareFunc

Types

This section is empty.

Jump to

Keyboard shortcuts

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