-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove AuthCredentials and related classes, use google-auth-library-java instead #1375
Conversation
e4e1baa
to
c3d396d
Compare
@lesv @garrettjonesgoogle care to have a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - but give folks a few hours to respond to my question on the README.
|
||
To access Google Cloud services, you first need to ensure that the necessary Google Cloud APIs are | ||
enabled for your project. To do this, follow the instructions on the | ||
[authentication document](https://github.com/GoogleCloudPlatform/gcloud-common/blob/master/authentication/readme.md#authentication) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
First, ensure that the necessary Google Cloud APIs are enabled for your project. To do this, follow the instructions on the [authentication document](https://github.com/GoogleCloudPlatform/gcloud-common/blob/master/authentication/readme.md#authentication) shared by all the gcloud language libraries. | ||
`google-cloud-java` uses | ||
[https://github.com/google/google-auth-library-java](https://github.com/google/google-auth-library-java) | ||
to authenticate requests. `google-auth-library-java` supports a wide range of authentication types, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
* If you already have an OAuth2 access token, you can use it to authenticate (notice that in this case the access token will not be automatically refreshed): | ||
* If running locally for development/testing, you can use the | ||
[Google Cloud SDK](https://cloud.google.com/sdk/). Create Application Default Credentials with | ||
`gcloud auth application-default login`, `google-cloud` will automatically detect such |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
`gcloud auth application-default login`, `google-cloud` will automatically detect such | ||
credentials. | ||
* If you already have an OAuth2 access token, you can use it to authenticate (notice that in this | ||
case the access token will not be automatically refreshed): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
3. Key file pointed to by the GOOGLE_APPLICATION_CREDENTIALS environment variable | ||
4. Google Cloud SDK credentials | ||
5. Compute Engine credentials | ||
1. Credentials file pointed to by the `GOOGLE_APPLICATION_CREDENTIALS` environment variable |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -102,7 +102,7 @@ You can test against a remote Datastore emulator as well. To do this, set the ` | |||
DatastoreOptions options = DatastoreOptions.newBuilder() | |||
.setProjectId("my-project-id") // must match project ID specified on remote machine | |||
.setHost("http://<hostname of machine>:<port>") | |||
.setAuthCredentials(AuthCredentials.noAuth()) | |||
.setNoCredentials() |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
.build(); | ||
BigQueryOptions otherOptions = options.toBuilder() | ||
.setProjectId("p2") | ||
.setAuthCredentials(null) | ||
.setCredentials(null) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -28,7 +28,7 @@ | |||
|
|||
private static final String BIGQUERY_SCOPE = "https://www.googleapis.com/auth/bigquery"; | |||
private static final Set<String> SCOPES = ImmutableSet.of(BIGQUERY_SCOPE); | |||
private static final long serialVersionUID = -8592198255032667206L; | |||
private static final long serialVersionUID = -2437598817433266049L; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
* @return the builder | ||
* @throws NullPointerException if {@code credentials} is {@code null}. To disable | ||
* authentication use {@link Builder#setNoCredentials()} |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
85e06c2
to
e8f9f6e
Compare
LGTM |
This PR gets rid of our
AuthCredentials
classes and uses google-auth-library-java instead.