Skip to content
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

Encoded-key based authentication #486

Closed
sesigl opened this issue May 25, 2021 · 2 comments · Fixed by googleapis/java-spanner#1223
Closed

Encoded-key based authentication #486

sesigl opened this issue May 25, 2021 · 2 comments · Fixed by googleapis/java-spanner#1223
Assignees
Labels
api: spanner Issues related to the googleapis/java-spanner-jdbc API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@sesigl
Copy link

sesigl commented May 25, 2021

It is a common and suggested use case to use spring data cloud spanner and spanner-jdbc for liquibase for application based database migrations. When you use spring data spanner, one recommended way is to set spring.cloud.gcp.spanner.credentials.encoded-key that contains a base64 encoded service account json to setup authentication.

It would be very beneficial if spring jdbc uses and supports this way of credential providing too. Right now, I workaround by defining a conditional initializer that creates a credentials file on application startup and reference the created file via connection url jdbc:cloudspanner:/projects/my-project/instances/my-instance/databases/my-db;credentials=/path/to/credentials.json.

does it make sense that you also accept the encoded-key via a Connection property, or via some other mechanism that behaves similar to the concept of spring data spanner?

thanks in advance!

@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/java-spanner-jdbc API. label May 25, 2021
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label May 26, 2021
@olavloite olavloite assigned olavloite and unassigned thiagotnunes May 27, 2021
@olavloite olavloite added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed triage me I really want to be triaged. labels May 27, 2021
olavloite added a commit to googleapis/java-spanner that referenced this issue May 27, 2021
This enables a user to specify a base64 encoded JSON string that contains the credentials
that should be used for the connection. This removes the requirement to write the JSON
string to a file before it can be used for a connection.

Fixes googleapis/java-spanner-jdbc#486
@sesigl
Copy link
Author

sesigl commented May 31, 2021

Awesome, thank you! Will give it a try ASAP.

@olavloite
Copy link
Collaborator

Awesome, thank you! Will give it a try ASAP.

Oh, I'm afraid I should have phrased my 'Fixes' comment a little bit differently. The change in googleapis/java-spanner#1223 will implement this feature, but only once the JDBC driver picks up the latest version of the Spanner client library. So even if you pull the main branch of the JDBC driver now, you will not automatically get this feature. If you really want to test it out today, you would need to clone both the Java client library and the JDBC driver, and update the reference in the JDBC driver to the client library to use your local version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/java-spanner-jdbc API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants