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

Add authorized user authenticator #170

Merged
merged 2 commits into from
Mar 22, 2022
Merged

Add authorized user authenticator #170

merged 2 commits into from
Mar 22, 2022

Conversation

FEC-bendingspoons
Copy link
Contributor

I took some ideas from #154 fixing the conflicts in hopes that this will get merged.

Thanks for providing the basis of this library!

@evgeny-yashin
Copy link

Can add that I use the original PR #154 and it works. An important missing part in the lib.

@dermesser
Copy link
Owner

Can add that I use the original PR #154 and it works. An important missing part in the lib.

Thank you for the feedback. It looks like this PR will implement the same features, can you confirm that it would work for your use case?

@dermesser
Copy link
Owner

Am I right in assuming that this new authenticator deals with application default credentials (as replacements for service account credentials), as described here? https://cloud.google.com/sdk/gcloud/reference/auth/application-default/login

If so, may I propose renaming the types from AuthorizedUser... to ApplicationDefault...? "Authorized User" sounds very generic and can easily cause confusion.

@FEC-bendingspoons
Copy link
Contributor Author

Am I right in assuming that this new authenticator deals with application default credentials

I am not sure, I read this and it appears to me that with Application Default Credentials is a different thing.

BTW currently inside the library there already are ApplicationDefaultCredentials* types that implement the behaviour I linked above. I chose AuthorizedUser* because in the JSON generated by gcloud there is a "type": "authorized_user" key.

@dermesser
Copy link
Owner

Am I right in assuming that this new authenticator deals with application default credentials

I am not sure, I read this and it appears to me that with Application Default Credentials is a different thing.

Ok, then I was wrong in assuming that :)

BTW currently inside the library there already are ApplicationDefaultCredentials* types that implement the behaviour I linked above. I chose AuthorizedUser* because in the JSON generated by gcloud there is a "type": "authorized_user" key.

Alright, then it's Google's fault for using such a generic name. I shall be fine with it.

@evgeny-yashin
Copy link

Thank you for the feedback. It looks like this PR will implement the same features, can you confirm that it would work for your use case?

Yes, this is the same PRs, this one is just friendly with latest version. I just checked it and was able to login using "authorized_user" key.

Am I right in assuming that this new authenticator deals with application default credentials (as replacements for service account credentials), as described here? https://cloud.google.com/sdk/gcloud/reference/auth/application-default/login

Google Cloud documentation on this part is a bit cloudy, here I think it's a bit clearer:
https://google.aip.dev/auth/4110
According to that, ADC is a strategy to discover authorization automatically, trying a group of authentication algos.

  1. GOOGLE_APPLICATION_CREDENTIALS env variable is checked, and if present it can point either to a service key OR authorized_user key (which is created via gcloud auth application-default login).
  2. Then it checks for Workflow identity (federation), by navigating to http://metainfo/... (in yup-oauth2 it is done as part of ADC only, not as a separate flow)
  3. Checking for the same keys as in 1, but in 'default' locations.

So, ADC is not a flow but a try-this, try-that until authorized. The authorized_user flow is a separate authentication algorithm and, eventually, it should be used as a part of ADC strategy.

@FEC-bendingspoons
Copy link
Contributor Author

Any update on this?

@dermesser dermesser merged commit 3c93bd1 into dermesser:master Mar 22, 2022
@dermesser
Copy link
Owner

Sorry for the delay, my life was a bit busy the last couple days :)

dermesser added a commit that referenced this pull request Mar 22, 2022
dermesser added a commit that referenced this pull request Mar 22, 2022
@evgeny-yashin
Copy link

Thanks!

What is the project schedule for releases to io.crates?

@dermesser
Copy link
Owner

As soon as I find the time - I will try to do it later today!

dermesser added a commit that referenced this pull request Apr 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants