token_credential.go 356 B

1234567891011121314151617
  1. package credentials
  2. import "golang.org/x/net/context"
  3. type TokenCredential struct {
  4. Token string
  5. }
  6. func (cred *TokenCredential) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) {
  7. return map[string]string{
  8. "token": cred.Token,
  9. }, nil
  10. }
  11. func (cred *TokenCredential) RequireTransportSecurity() bool {
  12. return false
  13. }