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

Service account credentials (key) #183

Merged
merged 24 commits into from
Apr 2, 2024

Conversation

MikhailNazarov
Copy link
Contributor

@MikhailNazarov MikhailNazarov commented Apr 1, 2024

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe): add dependency to jsonwebtoken for jwt and chrono for parsing token expiration

What is the current behavior?

There is no credential provider for service account key json file.
reqwest not allow https requests saying that only http is allowed

What is the new behavior?

Implemented ServiceAccountCredentials
Also exampl auth-ycloud-serviceaccount was provided for usage demonstation and debugging.

changed reqwest feature from rustls to rustls-tls fixed issue of sending https requests.

Other information

Example:

use ydb::ServiceAccountCredentials;
let cred = ServiceAccountCredentials::from_env()?;

or

let json = "....";
let cred = ServiceAccountCredentials::from_json(json)?;

or

let cred = ServiceAccountCredentials::new("service_account_id", "key_id", "private_key");

or

let cred = ServiceAccountCredentials::from_file("/path/to/file")?;

Copy link
Member

@rekby rekby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @MikhailNazarov.

Thanks for great work!

I have few comments, for do the PR even better.

ydb/Cargo.toml Outdated Show resolved Hide resolved
ydb/Cargo.toml Outdated Show resolved Hide resolved
ydb/examples/auth-ycloud-serviceaccount.rs Outdated Show resolved Hide resolved
ydb-grpc/src/generated/google.protobuf.rs Outdated Show resolved Hide resolved
ydb/src/credentials.rs Outdated Show resolved Hide resolved
ydb/src/credentials.rs Outdated Show resolved Hide resolved
.vscode/settings.json Outdated Show resolved Hide resolved
Cargo.lock Outdated Show resolved Hide resolved
@rekby rekby merged commit 404e848 into ydb-platform:master Apr 2, 2024
2 checks passed
@MikhailNazarov MikhailNazarov deleted the service_account branch April 2, 2024 17:15
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.

2 participants