-
Notifications
You must be signed in to change notification settings - Fork 702
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
Deprecate the GoogleCredential and CloudShellCredential classes #1258
Conversation
Hello @chingor13 I don't understand how to correctly replace |
|
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-java This commit switches to using the new `com.google.auth.oauth2.ServiceAccountCredentials` class from the `google-auth-library-oauth2-http` artifact. Given this new class, our custom `com.gu.googleauth.GoogleServiceAccount` Scala case class is no longer necessary, so has been removed, in favour of the user passing us an instance of `ServiceAccountCredentials` - which is actually easier for a user to generate! Here's an example of how you make and use an instance of the new credentials: ``` import org.apache.commons.io.Charsets.UTF_8 import org.apache.commons.io.IOUtils import com.google.auth.oauth2.ServiceAccountCredentials import com.gu.googleauth.GoogleGroupChecker val impersonatedUser: String = ... // email address of the 'impersonated' account val serviceAccountCert: String = ... // from Google Developers Console val credentials = ServiceAccountCredentials.fromStream(IOUtils.toInputStream(serviceAccountCert, UTF_8)) val groupChecker = new GoogleGroupChecker(impersonatedUser, credentials) ```
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-java This commit switches to using the new `com.google.auth.oauth2.ServiceAccountCredentials` class from the `google-auth-library-oauth2-http` artifact. Given this new class, our custom `com.gu.googleauth.GoogleServiceAccount` Scala case class is no longer necessary, so has been deprecated, in favour of the user passing us an instance of `ServiceAccountCredentials` - which is actually easier for a user to generate! Here's an example of how you make and use an instance of the new credentials: ``` import org.apache.commons.io.Charsets.UTF_8 import org.apache.commons.io.IOUtils import com.google.auth.oauth2.ServiceAccountCredentials import com.gu.googleauth.GoogleGroupChecker val impersonatedUser: String = ... // email address of the 'impersonated' account val serviceAccountCert: String = ... // from Google Developers Console val credentials = ServiceAccountCredentials.fromStream(IOUtils.toInputStream(serviceAccountCert, UTF_8)) val groupChecker = new GoogleGroupChecker(impersonatedUser, credentials) ```
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-java This commit switches to using the new `com.google.auth.oauth2.ServiceAccountCredentials` class from the `google-auth-library-oauth2-http` artifact. Given this new class, our custom `com.gu.googleauth.GoogleServiceAccount` Scala case class is no longer necessary, so has been deprecated, in favour of the user passing us an instance of `ServiceAccountCredentials` - which is actually easier for a user to generate! Here's an example of how you make and use an instance of the new credentials: ``` import org.apache.commons.io.Charsets.UTF_8 import org.apache.commons.io.IOUtils import com.google.auth.oauth2.ServiceAccountCredentials import com.gu.googleauth.GoogleGroupChecker val impersonatedUser: String = ... // email address of the 'impersonated' account val serviceAccountCert: String = ... // from Google Developers Console val credentials = ServiceAccountCredentials.fromStream(IOUtils.toInputStream(serviceAccountCert, UTF_8)) val groupChecker = new GoogleGroupChecker(impersonatedUser, credentials) ```
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-java This commit switches to using the new `com.google.auth.oauth2.ServiceAccountCredentials` class from the `google-auth-library-oauth2-http` artifact. Given this new class, our custom `com.gu.googleauth.GoogleServiceAccount` Scala case class is no longer necessary, so has been deprecated, in favour of the user passing us an instance of `ServiceAccountCredentials` - which is actually easier for a user to generate! Here's an example of how you make and use an instance of the new credentials: ``` import org.apache.commons.io.Charsets.UTF_8 import org.apache.commons.io.IOUtils import com.google.auth.oauth2.ServiceAccountCredentials import com.gu.googleauth.GoogleGroupChecker val impersonatedUser: String = ... // email address of the 'impersonated' account val serviceAccountCert: String = ... // from Google Developers Console val credentials = ServiceAccountCredentials.fromStream(IOUtils.toInputStream(serviceAccountCert, UTF_8)) val groupChecker = new GoogleGroupChecker(impersonatedUser, credentials) ```
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-java This commit switches to using the new `com.google.auth.oauth2.ServiceAccountCredentials` class from the `google-auth-library-oauth2-http` artifact. Given this new class, our custom `com.gu.googleauth.GoogleServiceAccount` Scala case class is no longer necessary, so has been deprecated, in favour of the user passing us an instance of `ServiceAccountCredentials` - which is actually easier for a user to generate! Here's an example of how you make and use an instance of the new credentials: ``` import org.apache.commons.io.Charsets.UTF_8 import org.apache.commons.io.IOUtils import com.google.auth.oauth2.ServiceAccountCredentials import com.gu.googleauth.GoogleGroupChecker val impersonatedUser: String = ... // email address of the 'impersonated' account val serviceAccountCert: String = ... // from Google Developers Console val credentials = ServiceAccountCredentials.fromStream(IOUtils.toInputStream(serviceAccountCert, UTF_8)) val groupChecker = new GoogleGroupChecker(impersonatedUser, credentials) ```
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-java This commit switches to using the new `com.google.auth.oauth2.ServiceAccountCredentials` class from the `google-auth-library-oauth2-http` artifact. Given this new class, our custom `com.gu.googleauth.GoogleServiceAccount` Scala case class is no longer necessary, so has been deprecated, in favour of the user passing us an instance of `ServiceAccountCredentials` - which is actually easier for a user to generate! Here's an example of how you make and use an instance of the new credentials: ``` import org.apache.commons.io.Charsets.UTF_8 import org.apache.commons.io.IOUtils import com.google.auth.oauth2.ServiceAccountCredentials import com.gu.googleauth.GoogleGroupChecker val impersonatedUser: String = ... // email address of the 'impersonated' account val serviceAccountCert: String = ... // from Google Developers Console val credentials = ServiceAccountCredentials.fromStream(IOUtils.toInputStream(serviceAccountCert, UTF_8)) val groupChecker = new GoogleGroupChecker(impersonatedUser, credentials) ```
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-java This commit switches to using the new `com.google.auth.oauth2.ServiceAccountCredentials` class from the `google-auth-library-oauth2-http` artifact. Given this new class, our custom `com.gu.googleauth.GoogleServiceAccount` Scala case class is no longer necessary, so has been deprecated, in favour of the user passing us an instance of `ServiceAccountCredentials` - which is actually easier for a user to generate! Here's an example of how you make and use an instance of the new credentials: ``` import org.apache.commons.io.Charsets.UTF_8 import org.apache.commons.io.IOUtils import com.google.auth.oauth2.ServiceAccountCredentials import com.gu.googleauth.GoogleGroupChecker val impersonatedUser: String = ... // email address of the 'impersonated' account val serviceAccountCert: String = ... // from Google Developers Console val credentials = ServiceAccountCredentials.fromStream(IOUtils.toInputStream(serviceAccountCert, UTF_8)) val groupChecker = new GoogleGroupChecker(impersonatedUser, credentials) ```
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-java This commit switches to using the new `com.google.auth.oauth2.ServiceAccountCredentials` class from the `google-auth-library-oauth2-http` artifact. Given this new class, our custom `com.gu.googleauth.GoogleServiceAccount` Scala case class is no longer necessary, so has been deprecated, in favour of the user passing us an instance of `ServiceAccountCredentials` - which is actually easier for a user to generate! Here's an example of how you make and use an instance of the new credentials: ``` import org.apache.commons.io.Charsets.UTF_8 import org.apache.commons.io.IOUtils import com.google.auth.oauth2.ServiceAccountCredentials import com.gu.googleauth.GoogleGroupChecker val impersonatedUser: String = ... // email address of the 'impersonated' account val serviceAccountCert: String = ... // from Google Developers Console val credentials = ServiceAccountCredentials.fromStream(IOUtils.toInputStream(serviceAccountCert, UTF_8)) val groupChecker = new GoogleGroupChecker(impersonatedUser, credentials) ```
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-java This commit switches to using the new `com.google.auth.oauth2.ServiceAccountCredentials` class from the `google-auth-library-oauth2-http` artifact. Given this new class, our custom `com.gu.googleauth.GoogleServiceAccount` Scala case class is no longer necessary, so has been deprecated, in favour of the user passing us an instance of `ServiceAccountCredentials` - which is actually easier for a user to generate! Here's an example of how you make and use an instance of the new credentials: ``` import org.apache.commons.io.Charsets.UTF_8 import org.apache.commons.io.IOUtils import com.google.auth.oauth2.ServiceAccountCredentials import com.gu.googleauth.GoogleGroupChecker val impersonatedUser: String = ... // email address of the 'impersonated' account val serviceAccountCert: String = ... // from Google Developers Console val credentials = ServiceAccountCredentials.fromStream(IOUtils.toInputStream(serviceAccountCert, UTF_8)) val groupChecker = new GoogleGroupChecker(impersonatedUser, credentials) ```
Hi, we're using this class like so:
Wondering if this Also any suggestions on what we move the above to? |
The fancy automatic credentials for Application Default Credentials and CloudShell should be handled by google-auth-library. That library provides an adapter that can be used with google-http-client.
Note that this still provides the oauth2 helpers for handling 3-legged OAuth2.