Re: [jclouds-labs-google] Support reading key from file (#84)
Thanks. Looking forward to the bearer change, as I can use it myself! --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-google/pull/84#issuecomment-62230789
Re: [jclouds-labs-google] Support reading key from file (#84)
Closed #84. --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-google/pull/84#event-190228524
Re: [jclouds-labs-google] Support reading key from file (#84)
You are right about the file io. Part of this is still necessary to use oauth bearer tokens outside of the google providers so I will kill this and start another PR with this code whittled down. --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-google/pull/84#issuecomment-62230551
Re: [jclouds-labs-google] Support reading key from file (#84)
In general, we've hesitated about adding main code to do things that are only needed in tests. Ex. reading from a file is probably most helpful during writing tests as users can load that property from whereever. What if instead of changing the guice code to now have file i/o, we change whatever test base class is to use bearer token, or read the file there? --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-google/pull/84#issuecomment-62225856
Re: [jclouds-labs-google] Support reading key from file (#84)
> @@ -34,6 +34,6 @@ > } > > @Override public HttpRequest filter(HttpRequest request) throws > HttpException { > - return request.toBuilder().addHeader("Authorization", format("%s %s", > "Bearer ", creds.get().credential)).build(); heh --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-google/pull/84/files#r20042242
Re: [jclouds-labs-google] Support reading key from file (#84)
[jclouds ยป jclouds-labs-google #1656](https://buildhive.cloudbees.com/job/jclouds/job/jclouds-labs-google/1656/) UNSTABLE Looks like there's a problem with this pull request [(what's this?)](https://www.cloudbees.com/what-is-buildhive) --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-google/pull/84#issuecomment-62225158
Re: [jclouds-labs-google] Support reading key from file (#84)
> @@ -46,7 +47,7 @@ public static OAuthCredentials loadOAuthCredentials() > throws IOException, NoSuch > CertificateException, InvalidKeySpecException { >OAuthCredentialsSupplier loader = new > OAuthCredentialsSupplier(ofInstance(new Credentials("foo", > Files.asCharSource(new File("src/test/resources/testpk.pem"), > Charsets.UTF_8).read())), > -new OAuthCredentialsForCredentials("RS256"), "RS256"); > +new OAuthCredentialsForCredentials("RS256", > CredentialType.SERVICE_ACCOUNT_CREDENTIALS), "RS256"); static import for SERVICE_ACCOUNT_CREDENTIALS --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-google/pull/84/files#r20041881
Re: [jclouds-labs-google] Support reading key from file (#84)
use some static imports here and there, makes it easier to read, looks great otherwise --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-google/pull/84#issuecomment-62225056
Re: [jclouds-labs-google] Support reading key from file (#84)
> @@ -33,14 +34,14 @@ > @Test(expectedExceptions = AuthorizationException.class) > public void testAuthorizationExceptionIsThrownOnBadKeys() { >OAuthCredentialsSupplier supplier = new > OAuthCredentialsSupplier(Suppliers.ofInstance(new Credentials("MOMMA", > - "MIA")), new OAuthCredentialsForCredentials("RS256"), "RS256"); > + "FileNotFoundCredential")), new > OAuthCredentialsForCredentials("RS256", > CredentialType.SERVICE_ACCOUNT_CREDENTIALS), "RS256"); static imports --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-google/pull/84/files#r20041898
Re: [jclouds-labs-google] Support reading key from file (#84)
> String privateKeyInPemFormat = in.credential; > +String identity = in.identity; > + > +// If passing Bearer tokens, simply create and pass it along > +if (credentialType == CredentialType.BEARER_TOKEN_CREDENTIALS) { static import --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-google/pull/84/files#r20041916
Re: [jclouds-labs-google] Support reading key from file (#84)
[jclouds-labs-google-pull-requests #244](https://jclouds.ci.cloudbees.com/job/jclouds-labs-google-pull-requests/244/) UNSTABLE Looks like there's a problem with this pull request --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-google/pull/84#issuecomment-62224637
[jclouds-labs-google] Support reading key from file (#84)
You can merge this Pull Request by running: git pull https://github.com/ccustine/jclouds-labs-google features/fixes Or you can view, comment on it, or merge it online at: https://github.com/jclouds/jclouds-labs-google/pull/84 -- Commit Summary -- * Misc fixes to support file based key and bearer tokens -- File Changes -- M google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/internal/BaseGoogleCloudStorageApiExpectTest.java (1) M google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/internal/BaseGoogleComputeEngineApiExpectTest.java (1) M oauth/src/main/java/org/jclouds/oauth/v2/OAuthApiMetadata.java (3) M oauth/src/main/java/org/jclouds/oauth/v2/filters/BearerTokenAuthenticator.java (2) M oauth/src/main/java/org/jclouds/oauth/v2/functions/OAuthCredentialsSupplier.java (33) M oauth/src/test/java/org/jclouds/oauth/v2/OAuthTestUtils.java (4) M oauth/src/test/java/org/jclouds/oauth/v2/functions/OAuthCredentialsFromPKTest.java (3) M oauth/src/test/java/org/jclouds/oauth/v2/functions/OAuthCredentialsSupplierTest.java (7) -- Patch Links -- https://github.com/jclouds/jclouds-labs-google/pull/84.patch https://github.com/jclouds/jclouds-labs-google/pull/84.diff --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs-google/pull/84