> +
> +      String payload = 
> "grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&" +
> +      // Base64 Encoded Header
> +               "assertion=" + 
> base64Url().omitPadding().encode(header.getBytes(UTF_8)) + "." +
> +               // Base64 Encoded Claims
> +               base64Url().omitPadding().encode(claims.getBytes(UTF_8)) + 
> ".";
> +
> +      return 
> HttpRequest.builder().method("POST").endpoint(URI.create("https://accounts.google.com/o/oauth2/token";))
> +               .addHeader("Accept", MediaType.APPLICATION_JSON)
> +               .payload(payloadFromStringWithContentType(payload, 
> "application/x-www-form-urlencoded")).build();
> +   }
> +
> +   protected static Payload staticPayloadFromResource(String resource) {
> +      try {
> +         return 
> payloadFromString(Strings2.toStringAndClose(BaseGoogleCloudStorageExpectTest.class
> +                  .getResourceAsStream(resource)));

This is kind of awkward, can you call `getClass` instead to get 
`BaseGoogleCloudStorageExpectTest.class`?  Similarly, 
`BaseRestApiExpectTest.payloadFromResource` implements similar functionality.  
The existing code is probably not a good guide; would the following work better:

```
return new 
ByteSourcePayload(Resources.asByteSource(Resources.getResource(getClass(), 
resource)));
```

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/29/files#r13942099

Reply via email to