Skip to content

Commit

Permalink
revert auth json (#6883)
Browse files Browse the repository at this point in the history
### Description

We're currently blocked from shipping due to issues found with the
`auth.json` code. We believe all of the issues have been addressed, but
we should do some due diligence and dogfood a canary for a bit before
cutting a release.

We have some fixes that we need to get out and want the release to be
solid without accidentally introducing some auth related regressions.

### Testing Instructions

I believe these are all the auth.json related PRs and gets us back to a
known good state.


Closes TURBO-1989
  • Loading branch information
chris-olszewski committed Jan 4, 2024
1 parent 06211a7 commit d965c4c
Show file tree
Hide file tree
Showing 39 changed files with 846 additions and 1,632 deletions.
6 changes: 0 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 1 addition & 22 deletions crates/turborepo-api-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ use serde::Deserialize;
use turborepo_ci::{is_ci, Vendor};
use turborepo_vercel_api::{
APIError, CachingStatus, CachingStatusResponse, PreflightResponse, SpacesResponse, Team,
TeamsResponse, TokenMetadata, TokenMetadataResponse, UserResponse, VerificationResponse,
VerifiedSsoUser,
TeamsResponse, UserResponse, VerificationResponse, VerifiedSsoUser,
};
use url::Url;

Expand All @@ -33,7 +32,6 @@ lazy_static! {

#[async_trait]
pub trait Client {
fn base_url(&self) -> &str;
async fn get_user(&self, token: &str) -> Result<UserResponse>;
async fn get_teams(&self, token: &str) -> Result<TeamsResponse>;
async fn get_team(&self, token: &str, team_id: &str) -> Result<Option<Team>>;
Expand All @@ -46,7 +44,6 @@ pub trait Client {
) -> Result<CachingStatusResponse>;
async fn get_spaces(&self, token: &str, team_id: Option<&str>) -> Result<SpacesResponse>;
async fn verify_sso_token(&self, token: &str, token_name: &str) -> Result<VerifiedSsoUser>;
async fn get_token_metadata(&self, token: &str) -> Result<TokenMetadata>;
#[allow(clippy::too_many_arguments)]
async fn put_artifact(
&self,
Expand Down Expand Up @@ -108,24 +105,6 @@ pub struct APIAuth {

#[async_trait]
impl Client for APIClient {
fn base_url(&self) -> &str {
&self.base_url
}
async fn get_token_metadata(&self, token: &str) -> Result<TokenMetadata> {
let url = self.make_url("/v5/user/tokens/current");
let request_builder = self
.client
.get(url)
.header("User-Agent", self.user_agent.clone())
.header("Authorization", format!("Bearer {}", token))
.header("Content-Type", "application/json");
let response = retry::make_retryable_request(request_builder)
.await?
.error_for_status()?;
let json: TokenMetadataResponse = response.json().await?;

Ok(json.token)
}
async fn get_user(&self, token: &str) -> Result<UserResponse> {
let url = self.make_url("/v2/user");
let request_builder = self
Expand Down
4 changes: 0 additions & 4 deletions crates/turborepo-auth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,13 @@ async-trait.workspace = true
axum-server = { workspace = true }
axum.workspace = true
chrono.workspace = true
dirs-next = "2.0.0"
hostname = "0.3.1"
lazy_static.workspace = true
reqwest.workspace = true
serde.workspace = true
serde_json.workspace = true
tempfile.workspace = true
thiserror = "1.0.38"
tokio.workspace = true
tracing.workspace = true
turbopath = { workspace = true }
turborepo-api-client = { workspace = true }
turborepo-ui.workspace = true
turborepo-vercel-api = { workspace = true }
Expand Down
Loading

0 comments on commit d965c4c

Please sign in to comment.