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
Allow external GoogleCredentials authentication #66
Comments
This would also be useful for Cloud Partners engineering applications. We too have pre-existing |
I would also really like this option, messing with environment variables doesn't seem like a smart thing to do. And I don't really understand while virtually every google system has the option to use in-memory credentials but not the SQL service. |
I'm also trying to understand how we can configure CloudSQL auth connections without using an env var, any examples? |
I was wondering if there is any update about this issue? We also would like to use our own credential instead of ADC to initialize the client, but realized that we have to use the deprecated |
So this is a bit tricky to do, but I think it could be done by adding a static method to SocketFactory class. This method would essentially take an instance connection name and a credential, and could be used create the CloudSQLInstance class with the correct credentials set on the SQLAdmin API. We would need to be careful to cleanup any previous CloudSQLInstance objects and refresh threads if a new one is set overtop. |
Simplest workaround should be extending a factory class and use it to create HttpRequestInitializer
I am using scala so the test code will be like
|
googleapis/google-auth-library-java#658 exposed a getter that returns a |
Going to mark this as closed. I think this current journey is already possible with the current interface. |
new SQLAdmin.Builder()
requires aHttpRequestInitializer
as its third argument, not necessarilyCredential
whichcreateAdminApiClient()
requests.This would be useful because, for example, on our Spring integrations, we want to pass in-memory credentials from a pre-existing
GoogleCredentials
object (from the newergoogle-auth-library-java
library).As I understand, the recommended way to use them is to use a
HttpCredentialsAdapter
, which is aHttpRequestInitializer
but notCredential
.I also haven't found any way to conveniently generate a
Credential
from aHttpCredentialsAdapter
.We would also need to pass in a
HttpRequestInitializer
instead of aCredentialFactory
in theCredentialFactory.CREDENTIAL_FACTORY_PROPERTY
property.The text was updated successfully, but these errors were encountered: