Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/auth/src/credentials.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ pub mod api_key_credentials;
pub mod external_account;
pub(crate) mod external_account_sources;
#[cfg(feature = "idtoken")]
pub(crate) mod gdch_service_account;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think the gdch_service_account should be behind the idtoken feature. Probably a typo or copy/paste error.

#[cfg(feature = "idtoken")]
pub mod idtoken;
pub mod impersonated;
pub(crate) mod internal;
Expand Down Expand Up @@ -780,6 +782,9 @@ fn build_credentials(
universe_domain.clone(),
|b: external_account::Builder, s: Vec<String>| b.with_scopes(s)
),
"gdch_service_account" => Err(BuilderError::not_supported(
"gdch_service_account is supported by credentials::idtoken::Builder::new(audience)",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this looks wrong. This macro builds AccessTokenCredentials and it seems like it can be supported by this credential type. And the error mentions idtoken.

)),
_ => Err(BuilderError::unknown_type(cred_type)),
}
}
Expand Down Expand Up @@ -826,6 +831,9 @@ fn build_signer(
"external_account" => Err(BuilderError::not_supported(
"external_account signer is not supported",
)),
"gdch_service_account" => Err(BuilderError::not_supported(
"gdch_service_account signer is not supported",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is this flow not supported or not implemented yet ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So looking through the Go impl a bit closer, I think this is not quite right. But also really annoying 🙂

Here is my understanding:

  • GDCH has an "identity token" concept but its not really a typical idtoken. It is not a JWT idtoken.
  • This is fetched via STS using the private_key from the credential json, with a required audience to be set
  • In the go library, this is not supported on the idtoken flow; only on the standard credential flow (NewCredentialsFromFile). This requires a custom audience option to be used or it errors.

I was getting these mixed up a bit and made it so you can only use the idtoken path for gdch_service_account; it should probably match the Go impl where there is no idtoken support and instead you use the credentials apth but with a audience pass in somewhere

)),
_ => Err(BuilderError::unknown_type(cred_type)),
}
}
Expand Down
Loading
Loading