Skip to content

Commit

Permalink
Rename DefaultAuthorizedUser to ConfigDefaultCredentials
Browse files Browse the repository at this point in the history
I found it hard to intuitively tell the difference between
DefaultAuthorizedUser and DefaultServiceAccount.
  • Loading branch information
djc committed Jun 30, 2023
1 parent ce7c6c9 commit 166406b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/authentication_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use async_trait::async_trait;
use tokio::sync::Mutex;

use crate::custom_service_account::CustomServiceAccount;
use crate::default_authorized_user::DefaultAuthorizedUser;
use crate::default_authorized_user::ConfigDefaultCredentials;
use crate::default_service_account::DefaultServiceAccount;
use crate::error::Error;
use crate::gcloud_authorized_user::GCloudAuthorizedUser;
Expand Down Expand Up @@ -48,9 +48,9 @@ impl AuthenticationManager {
}

let client = types::client();
let default_user_error = match DefaultAuthorizedUser::new(&client).await {
let default_user_error = match ConfigDefaultCredentials::new(&client).await {
Ok(service_account) => {
tracing::debug!("Using DefaultAuthorizedUser");
tracing::debug!("Using ConfigDefaultCredentials");
return Ok(Self::build(client, service_account));
}
Err(e) => e,
Expand Down
6 changes: 3 additions & 3 deletions src/default_authorized_user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ use crate::types::{HyperClient, Token};
use crate::util::HyperExt;

#[derive(Debug)]
pub(crate) struct DefaultAuthorizedUser {
pub(crate) struct ConfigDefaultCredentials {
token: RwLock<Token>,
credentials: UserCredentials,
}

impl DefaultAuthorizedUser {
impl ConfigDefaultCredentials {
const DEFAULT_TOKEN_GCP_URI: &'static str = "https://accounts.google.com/o/oauth2/token";
const USER_CREDENTIALS_PATH: &'static str =
".config/gcloud/application_default_credentials.json";
Expand Down Expand Up @@ -77,7 +77,7 @@ impl DefaultAuthorizedUser {
}

#[async_trait]
impl ServiceAccount for DefaultAuthorizedUser {
impl ServiceAccount for ConfigDefaultCredentials {
async fn project_id(&self, _: &HyperClient) -> Result<String, Error> {
self.credentials
.quota_project_id
Expand Down

0 comments on commit 166406b

Please sign in to comment.