PerRPCCredentials defines the common interface for the credentials which need to attach security information to every RPC (e.g., oauth2).
| 36 | // PerRPCCredentials defines the common interface for the credentials which need to |
| 37 | // attach security information to every RPC (e.g., oauth2). |
| 38 | type PerRPCCredentials interface { |
| 39 | // GetRequestMetadata gets the current request metadata, refreshing tokens |
| 40 | // if required. This should be called by the transport layer on each |
| 41 | // request, and the data should be populated in headers or other |
| 42 | // context. If a status code is returned, it will be used as the status for |
| 43 | // the RPC (restricted to an allowable set of codes as defined by gRFC |
| 44 | // A54). uri is the URI of the entry point for the request. When supported |
| 45 | // by the underlying implementation, ctx can be used for timeout and |
| 46 | // cancellation. Additionally, RequestInfo data will be available via ctx |
| 47 | // to this call. |
| 48 | GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) |
| 49 | // RequireTransportSecurity indicates whether the credentials requires |
| 50 | // transport security. |
| 51 | RequireTransportSecurity() bool |
| 52 | } |
| 53 | |
| 54 | // SecurityLevel defines the protection level on an established connection. |
| 55 | // |
no outgoing calls
no test coverage detected