Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TokenCredentials ¶
type TokenCredentials struct {
// contains filtered or unexported fields
}
func NewTokenCredentials ¶
func NewTokenCredentials(bearer string, tokenFile string) (*TokenCredentials, error)
NewTokenCredentials adds the provided bearer token to a request. If tokenFile is non-empty, it is periodically read, and the last successfully read content is used as the bearer token. If tokenFile is non-empty and bearer is empty, the tokenFile is read immediately to populate the initial bearer token.
func (*TokenCredentials) GetRequestMetadata ¶
func (k *TokenCredentials) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error)
GetRequestMetadata gets the current request metadata, refreshing tokens if required. This should be called by the transport layer on each request, and the data should be populated in headers or other context. If a status code is returned, it will be used as the status for the RPC (restricted to an allowable set of codes as defined by gRFC A54). uri is the URI of the entry point for the request. When supported by the underlying implementation, ctx can be used for timeout and cancellation. Additionally, RequestInfo data will be available via ctx to this call.
func (*TokenCredentials) RequireTransportSecurity ¶
func (k *TokenCredentials) RequireTransportSecurity() bool