GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Spanner - Need to enable credentials inject at call time · Issue #2091 · googleapis/google-cloud-java

Spanner - Need to enable credentials inject at call time #2091

New issue
Copy link
New issue
Copy link
Closed
Closed
Spanner - Need to enable credentials inject at call time#2091
Copy link
Assignees
vkedia
Labels
api: spannerIssues related to the Spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Description

@ykchen-g
ykchen-g
opened on May 26, 2017
Issue body actions

Currently for Cloud spanner java interfaces, the credential is contained in the DatabaseClient when the DatabaseClient is created. There is no way to have a databaseClient without credentials and call the method with credential context.

So if we are calling Cloud spanner via some service protocols, like gRPC, the gRPC server will have to create the databaseClient again and again whenever a new method call comes since when the server starts, it doesn't know the client's credential.

Activity

  1. vkedia commented on May 30, 2017

    @vkedia
    vkedia
    on May 30, 2017
    More actions

    Actually I thought more about this. I don't think it is feasible to do this. Cloud spanner client makes some background rpcs such as CreateSession. Those rpcs also need credentials so the credentials do need to be specified while creating the client. I think the usual model is that your server will use a single service account to talk to cloud spanner (or any other backend for that matter) irrespective fo the client that is accessing the server. But if you want to allow different level of accesses based on who the client is you will have to implement some sort of access control in your server and use that to allow/disallow requests.
    @tomayles might have more suggestions here.

  2. vam-google
    added
    api: spannerIssues related to the Spanner API.
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on May 30, 2017
  3. ykchen-g commented on May 30, 2017

    @ykchen-g
    ykchen-g
    on May 30, 2017
    Author
    More actions

    I am not quite sure, is it possible to lazy call the methods like CreateSession? Only when the add/remove operations methods are called? The client constructor just do some prep work without credentials?

  4. vkedia commented on May 31, 2017

    @vkedia
    vkedia
    on May 31, 2017
    More actions

    In theory we can set it up so that the when the first request comes in to the client for a given database, we use the credentials specified in that from that point onwards. But how does that help you? You still will not be able to use the same client with different credentials?

  5. tomayles commented on May 31, 2017

    @tomayles
    tomayles
    on May 31, 2017
    More actions

    Is the use case here that you are writing a mid-layer gRPC server that you want to make Cloud Spanner calls with the credentials of the caller to your server? As Vikas mentioned, the typical case is that the server would use its own credentials - just trying to understand your needs better :)

  6. ykchen-g commented on May 31, 2017

    @ykchen-g
    ykchen-g
    on May 31, 2017
    Author
    More actions

    This is exactly our use case. We have a gRPC server that will call the Cloud Spanner. We want to have the databaseClient exist when the server starts.

    As we are here, a related question, if we simply construct the databaseClient everytime our server is called and destroy the databaseClient, will that cause a huge overhead? I would suppose so since it means we will need to create sessions and connections again and again.

  7. garrettjonesgoogle commented on Aug 10, 2017

    @garrettjonesgoogle
    garrettjonesgoogle
    on Aug 10, 2017
    Contributor
    More actions

    @ykchen-g will you have an unbounded number of clients, or a more limited set of clients? If it's unbounded, I don't know if there's much you can do. If it's limited, couldn't you create a mapping of caller -> spanner client and keep them around?

  8. garrettjonesgoogle
    assigned
    vkedia
    on Aug 11, 2017
  9. vkedia commented on Aug 22, 2017

    @vkedia
    vkedia
    on Aug 22, 2017
    More actions

    @ykchen-g For your question about creating/destroying database client on every request, yes it will add a significant overhead which would include connection setup time, session creation time and then the actual work that you need to do.
    I guess you can have some sort of cache keyed on called and whose value would be DatabaseClient.
    I am not sure if there is much that can be done here in the client itself. Thus I am closing. Please reopen if you disagree.

  10. vkedia
    closed this as completedon Aug 22, 2017
  11. chingor13
    added a commit that references this issue on Feb 20, 2026

    chore(main): release 2.36.1 (#2091)

    7dab0ff
  12. meltsufin
    added 5 commits that reference this issue on Apr 29, 2026

    deps: update dependency com.google.protobuf:protobuf-java-util to v4.…

    9859f11

    chore(main): release 1.133.0 (#2206)

    a3b6539

    deps: update dependency com.google.protobuf:protobuf-java-util to v4.…

    9bce765

    chore(main): release 1.133.0 (#2206)

    1180af9

    chore: Update generation configuration at Tue Apr 29 02:31:48 UTC 2025 (

    19056a6
  13. benjaminp
    added 2 commits that reference this issue on Jul 13, 2026

    deps: update dependency org.graalvm.buildtools:junit-platform-native …

    3193eec

    chore(main): release 2.33.0 (googleapis#2090)

    667fc0b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @vkedia
    vkedia

Labels

api: spannerIssues related to the Spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.