middleware

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIKeyAuthStreamInterceptor

func APIKeyAuthStreamInterceptor(provider APIKeyAuthProvider) grpc.StreamServerInterceptor

APIKeyAuthStreamInterceptor returns a gRPC stream server interceptor that validates the API key.

func APIKeyAuthUnaryInterceptor

func APIKeyAuthUnaryInterceptor(provider APIKeyAuthProvider) grpc.UnaryServerInterceptor

APIKeyAuthUnaryInterceptor returns a gRPC unary server interceptor that validates the API key.

func BasicAuthStreamInterceptor

func BasicAuthStreamInterceptor(provider BasicAuthProvider) grpc.StreamServerInterceptor

BasicAuthStreamInterceptor returns a gRPC stream server interceptor that validates the Basic Auth credentials.

func BasicAuthUnaryInterceptor

func BasicAuthUnaryInterceptor(provider BasicAuthProvider) grpc.UnaryServerInterceptor

BasicAuthUnaryInterceptor returns a gRPC unary server interceptor that validates the Basic Auth credentials.

func NewAuthStreamInterceptor

func NewAuthStreamInterceptor(validator AuthValidator, method any) grpc.StreamServerInterceptor

NewAuthStreamInterceptor creates a stream interceptor using the provided validator and auth method.

func NewAuthUnaryInterceptor

func NewAuthUnaryInterceptor(validator AuthValidator, method any) grpc.UnaryServerInterceptor

NewAuthUnaryInterceptor creates a unary interceptor using the provided validator and auth method.

func OAuthStreamInterceptor

func OAuthStreamInterceptor(key auth.PublicKeyProvider, options ...jwt.ParserOption) grpc.StreamServerInterceptor

OAuthStreamInterceptor returns a gRPC stream server interceptor that validates the OAuth token.

func OAuthUnaryInterceptor

func OAuthUnaryInterceptor(key auth.PublicKeyProvider, options ...jwt.ParserOption) grpc.UnaryServerInterceptor

OAuthUnaryInterceptor returns a gRPC unary server interceptor that validates the OAuth token.

Types

type APIKeyAuthProvider

type APIKeyAuthProvider struct {
	APIKeys                     []string
	ValidateFunc                func(apiKey string) bool
	ValidateFuncWithDatasources func(c *infra.Container, apiKey string) bool
	Container                   *infra.Container
}

APIKeyAuthProvider holds the configuration for API key authentication.

type AuthValidator

type AuthValidator func(ctx context.Context) (any, error)

AuthValidator defines a function that validates credentials from context and returns the identity and auth method.

type BasicAuthProvider

type BasicAuthProvider struct {
	Users                       map[string]string
	ValidateFunc                func(username, password string) bool
	ValidateFuncWithDatasources func(c *infra.Container, username, password string) bool
	Container                   *infra.Container
}

BasicAuthProvider holds the configuration for basic authentication.

Jump to

Keyboard shortcuts

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