-
Notifications
You must be signed in to change notification settings - Fork 130
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
[DO NOT MERGE] [RFC] attempt to allow impersonation from service account #28
Conversation
@mistercrunch, take a look at betodealmeida/gsheets-db-api#3 Do you know if the service account you're using has delegation enabled? (See screenshot in the link above) |
@theacodes Do you have any experience with service account delegation and the google-auth library? |
@betodealmeida idk whether the service account I use has delegation enabled, how can I figure it out? Also would be good to have a more accurate error message if that's the issue. |
Some relevant docs: https://developers.google.com/admin-sdk/directory/v1/guides/delegation |
This is helpful, I will find someone with the master key and get them to check the magic box. |
hey @tswast . @mistercrunch and I tested the proposed solution and the |
@nishantrayan That error sounds like the client ID in the service account key file hasn't been added to the Google Admin console for the gSuite domain, yet. See: https://developers.google.com/admin-sdk/directory/v1/guides/delegation#delegate_domain-wide_authority_to_your_service_account Another option would be to have Superset guide users user through this flow: https://cloud.google.com/bigquery/docs/authentication/end-user-installed We'd have to modify pybigquery to accept a refresh token, client ID, and client secret for google-auth user-based credentials. Ideally Superset would be able to parameterize the connection string for the data source to provide a different refresh credential per user. |
Just wanted to add that:
|
I was just able to make impersonation work with BigQuery resources on my personal gsuite domain. The key is that the client ID associated with the service account must be allowed to access all the needed scopes. Code:
Results before configuring Google Admin:
After configuring Google Admin:
|
To get to the page to enter secrets, a domain admin must go to the security section of admin.google.com and click on the advanced section. If not enabled, you'll also need to check "Enable API Access" in the Google Admin security panel. Regarding which scopes to use, a list of all the Google scopes is at https://developers.google.com/identity/protocols/googlescopes Relevant ones you may want include:
|
What's the current status of this PR? Was impersonation decided to be too risky? As I said in #28 (comment), I think an end-user auth flow is probably the right way to do this. Originally I thought that meant Superset would need to store refresh tokens, but potentially those could be stored as session data or in |
FWIW, #35 adds scopes to credentials. |
@sumedhsakdeo I actually had an video conference meeting about this PR a while back. Think the issue at that time was the setting in the gSuite Admin I linked to in #28 (comment). You're right that the scopes issue can have a similar error when running queries to drive/sheets. |
Per #42 (comment), it sounds like Superset is pursuing OAuth, which will avoid the need for a superuser service account key that can impersonate anyone. |
@tswast we have big query instances where the access is maintained using google-groups, Is there any way via which we can impersonate user in Superset and users will be allowed to query only the dataset which they have access ? |
@Asturias-sam I proposed a new parameter to the connection string for Currently it involves several steps to make this work:
|
This is a request for comment. I'm working on impersonation in Apache Superset for Lyft.
Trying to find a way to impersonate a user from a service account. For context Superset exposes a hook allowing mutation of the connection object at runtime, where we can alter connection parameters at runtime while having a handle on the user information.
Found this
with_subject
method which seems promising. I feel like I'm almost there. When I call it prior to running a query though I getRequesting comments on people at Google that can point us in the right direction around impersonating users from services account.
@tswast @sumedhsakdeo @betodealmeida