> +
> +   @Inject ClaimsToAssertion(@Named(JWS_ALG) String alg, @Authorization 
> Supplier<PrivateKey> privateKey, Json json) {
> +      this.alg = alg;
> +      checkArgument(SUPPORTED_ALGS.contains(alg), "%s %s not in supported 
> list", JWS_ALG, alg, SUPPORTED_ALGS);
> +      this.privateKey = privateKey;
> +      this.json = json;
> +   }
> +
> +   @Override public String apply(Object input) {
> +      String encodedHeader = 
> String.format("{\"alg\":\"%s\",\"typ\":\"JWT\"}", alg);
> +      String encodedClaimSet = json.toJson(input);
> +
> +      encodedHeader = 
> base64Url().omitPadding().encode(encodedHeader.getBytes(UTF_8));
> +      encodedClaimSet = 
> base64Url().omitPadding().encode(encodedClaimSet.getBytes(UTF_8));
> +
> +      byte[] signature = alg.equals("none")

much simpler than the weird `Function<byte[], byte[]>` indirection, right?

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

Reply via email to