Remove use of deprecated GoogleCredential
class
#81
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this change?
This change is only related to the Google-Group-checking code in
play-googleauth
, which was using a deprecated class:The
com.google.api.client.googleapis.auth.oauth2.GoogleCredential
class in https://github.com/googleapis/google-api-java-client was deprecated in May 2019 by googleapis/google-api-java-client#1258 ...the deprecation advice recommends using the classes from the new library: https://github.com/googleapis/google-auth-library-javaThis commit switches to using the new
com.google.auth.oauth2.ServiceAccountCredentials
class from thegoogle-auth-library-oauth2-http
artifact. Given this new class, our customcom.gu.googleauth.GoogleServiceAccount
Scala case class is no longer necessary and I've removed it, in favour of the user passing us an instance ofServiceAccountCredentials
- which is actually easier for a user to generate! Here's an example of how you make and usean instance of the new credentials:
In Ophan, our old code to produce the custom
com.gu.googleauth.GoogleServiceAccount
instance actually invoked the now deprecatedcom.google.api.client.googleapis.auth.oauth2.GoogleCredential
class - we'd been stuck on an old version ofplay-googleauth
for some time because we have deprecation warnings set as fatal in our sbt build, and updating to later versions ofplay-googleauth
would have meant accepting the updatedgoogle-api-client
dependency where the class was fatally deprecated.How to test
Using the https://github.com/guardian/ophan/pull/3974, I've checked that I can still login using the new code in
play-googleauth
.