Documentation ¶
Overview ¶
Package iammember provides primitives for IAM member identifiers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveContextUnaryInterceptor ¶ added in v0.20.0
func ResolveContextUnaryInterceptor(resolver Resolver) grpc.UnaryServerInterceptor
ResolveContextUnaryInterceptor returns a gRPC server middleware that resolves IAM members with the provided resolver.
func WithResolvedContext ¶ added in v0.20.0
func WithResolvedContext(ctx context.Context, resolveResult ResolveResult) context.Context
WithResolvedContext returns a new context with cached IAM member resolve result.
Types ¶
type Metadata ¶ added in v0.20.0
type Metadata map[string]MetadataValue
Metadata is a map from metadata keys to IAM members resolved from the metadata values.
type MetadataValue ¶ added in v0.34.0
type MetadataValue struct { // JWT is the JWT token parsed from the metadata value, if any. JWT *iamjwt.Token // Members are the members resolved from the metadata value. Members []string }
MetadataValue is the resolve result from a single metatadata key.
type ResolveResult ¶ added in v0.20.0
type ResolveResult struct { // Metadata are the resolved IAM members partitioned by which metadata key they were resolved from. Metadata Metadata }
ResolveResult is the output from a Resolver.
func FromResolvedContext ¶ added in v0.20.0
func FromResolvedContext(ctx context.Context) (ResolveResult, bool)
FromResolvedContext returns the resolved IAM members and metadata from the provided context.
func (*ResolveResult) Add ¶ added in v0.20.0
func (r *ResolveResult) Add(key string, value MetadataValue)
Add a metadata key and resolved metadata value to the result.
func (*ResolveResult) Members ¶ added in v0.20.0
func (r *ResolveResult) Members() []string
Members returns the set of all unique members resolved from all metadata keys.
type Resolver ¶
type Resolver interface {
ResolveIAMMembers(context.Context) (ResolveResult, error)
}
Resolver resolves the IAM member identifiers for a caller context.
func ChainResolvers ¶ added in v0.8.0
ChainResolvers creates a single resolver out of a chain of many resolvers.
The resulting resolved members will be the union of the members 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 result will be kept.
func FromContextResolver ¶ added in v0.20.0
func FromContextResolver() Resolver
FromContextResolver returns a Resolver that resolves cached IAM members and metadata from the current context.