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

support url-sourced external account #222

Closed

Conversation

Hakuyume
Copy link
Contributor

@Hakuyume Hakuyume force-pushed the external-account-url-sourced branch 2 times, most recently from 8ca11e5 to cecc05e Compare May 24, 2024 02:46
@Hakuyume Hakuyume marked this pull request as ready for review May 24, 2024 02:47
@Hakuyume Hakuyume force-pushed the external-account-url-sourced branch from cecc05e to 99cea66 Compare May 24, 2024 02:49
/// JSON schema of URL-sourced credentials' format.
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(tag = "type")]
pub enum UrlCredentialSourceFormat {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This enum represents the format of document that the url returns. I avoid UrlFormat since it sounds "the format of url". I don't think UrlCredentialSourceFormat is good. Suggestion welcome.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using modules is another option

pub mod credential_source {
    pub mod url {
        pub enum Format { ... }
    }
}

Copy link
Owner

Choose a reason for hiding this comment

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

no I think it's fine the way you've done it

@@ -47,10 +48,33 @@ pub enum CredentialSource {
/// file
file: String,
},
// TODO: Microsoft Azure and URL-sourced credentials
Copy link
Owner

Choose a reason for hiding this comment

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

nice!

/// JSON schema of URL-sourced credentials' format.
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(tag = "type")]
pub enum UrlCredentialSourceFormat {
Copy link
Owner

Choose a reason for hiding this comment

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

no I think it's fine the way you've done it

@@ -72,6 +101,39 @@ impl ExternalAccountFlow {
{
let subject_token = match &self.secret.credential_source {
CredentialSource::File { file } => tokio::fs::read_to_string(file).await?,
CredentialSource::Url {
Copy link
Owner

Choose a reason for hiding this comment

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

this looks good to me, have you tested it in a real deployment? Unfortunately I don't have the means to do it myself, lacking an appropriate cloud environment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I confirmed this code works for my case (workload identity federation in github actions).

dermesser added a commit that referenced this pull request Jun 8, 2024
dermesser added a commit that referenced this pull request Jun 8, 2024
@dermesser dermesser closed this Jun 8, 2024
dermesser added a commit that referenced this pull request Jun 8, 2024
@Hakuyume Hakuyume deleted the external-account-url-sourced branch June 9, 2024 18:14
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