interceptors

package
v1.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TokenUnaryInterceptor

func TokenUnaryInterceptor(
	unauthorizedRequests []string,
	tokenValidator func(ctx context.Context, token string) (string, error),
) func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

TokenUnaryInterceptor returns a UnaryServerInterceptor that validates the access token and set the user id in the context. unauthorizedRequests is a list of requests that do not require authentication. tokenValidator is a function that validates the access token and returns the user id. This function is going to be used by all the services that need to validate the access token in a unary request.

Types

This section is empty.

Jump to

Keyboard shortcuts

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