iamcaller

package
v0.40.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: MIT Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(caller *iamv1.Caller, key string, metadata *iamv1.Caller_Metadata)

Add adds the metadata resolved from the provided key to the provider caller info.

func FromResolvedContext

func FromResolvedContext(ctx context.Context) (*iamv1.Caller, bool)

FromResolvedContext returns the resolved IAM members and metadata from the provided context.

func ResolveContextUnaryInterceptor

func ResolveContextUnaryInterceptor(resolver Resolver) grpc.UnaryServerInterceptor

ResolveContextUnaryInterceptor returns a gRPC server middleware that resolves IAM members with the provided resolver.

func Validate

func Validate(caller *iamv1.Caller) error

Validate checks that resolved caller info is valid.

func WithResolvedContext

func WithResolvedContext(ctx context.Context, resolveResult *iamv1.Caller) context.Context

WithResolvedContext returns a new context with cached IAM member resolve result.

Types

type Resolver

type Resolver interface {
	ResolveCaller(context.Context) (*iamv1.Caller, error)
}

Resolver resolves the IAM caller identity for the current context.

func ChainResolvers

func ChainResolvers(resolvers ...Resolver) Resolver

ChainResolvers creates a single resolver out of a chain of many resolvers.

The resulting resolved caller data will be the union of the caller data resolved by each resolver.

If any resolver returns an error, that error is immediately returned and no further resolvers are called.

If multiple resolvers resolve the same metadata key, the only last encountered metadata value will be kept.

func FromContextResolver

func FromContextResolver() Resolver

FromContextResolver returns a Resolver that resolves cached IAM members and metadata from the current context.

Jump to

Keyboard shortcuts

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