diff --git a/client/client.go b/client/client.go index b8775d5a440..fa944cad909 100644 --- a/client/client.go +++ b/client/client.go @@ -98,15 +98,9 @@ type Info struct { Auth AuthData // Metadata is the request metadata from the client connecting to this connector. - // Experimental: *NOTE* this structure is subject to change or removal in the future. Metadata Metadata } -// Metadata is an immutable map, meant to contain request metadata. -type Metadata struct { - data map[string][]string -} - // AuthData represents the authentication data as seen by authenticators tied to // the receivers. type AuthData interface { @@ -116,8 +110,7 @@ type AuthData interface { // "membership" might return a list of strings. GetAttribute(string) any - // GetAttributes returns the names of all attributes in this authentication - // data. + // GetAttributeNames returns the names of all attributes in this authentication data. GetAttributeNames() []string } @@ -139,7 +132,12 @@ func FromContext(ctx context.Context) Info { return c } -// NewMetadata creates a new Metadata object to use in Info. md is used as-is. +// Metadata is an immutable map, meant to contain request metadata. +type Metadata struct { + data map[string][]string +} + +// NewMetadata creates a new Metadata object to use in Info. func NewMetadata(md map[string][]string) Metadata { c := make(map[string][]string, len(md)) for k, v := range md { @@ -151,6 +149,7 @@ func NewMetadata(md map[string][]string) Metadata { } // Get gets the value of the key from metadata, returning a copy. +// The key lookup is case-insensitive. func (m Metadata) Get(key string) []string { if len(m.data) == 0 { return nil