(ctx context.Context, _ ...string)
| 157 | } |
| 158 | |
| 159 | func (s *serviceAccount) GetRequestMetadata(ctx context.Context, _ ...string) (map[string]string, error) { |
| 160 | s.mu.Lock() |
| 161 | defer s.mu.Unlock() |
| 162 | if !s.t.Valid() { |
| 163 | var err error |
| 164 | s.t, err = s.config.TokenSource(ctx).Token() |
| 165 | if err != nil { |
| 166 | return nil, err |
| 167 | } |
| 168 | } |
| 169 | ri, _ := credentials.RequestInfoFromContext(ctx) |
| 170 | if err := credentials.CheckSecurityLevel(ri.AuthInfo, credentials.PrivacyAndIntegrity); err != nil { |
| 171 | return nil, fmt.Errorf("unable to transfer serviceAccount PerRPCCredentials: %v", err) |
| 172 | } |
| 173 | return map[string]string{ |
| 174 | "authorization": s.t.Type() + " " + s.t.AccessToken, |
| 175 | }, nil |
| 176 | } |
| 177 | |
| 178 | func (s *serviceAccount) RequireTransportSecurity() bool { |
| 179 | return true |
nothing calls this directly
no test coverage detected