Skip to content

SRE-2330 cleanup references to auth-email #286

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

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ impl AccessTokenRequest {
&self,
configurations: &ApiConfigurations,
) -> Result<IdentityTokenResponse, LoginError> {
super::send_identity_connect_request(configurations, None, &self).await
super::send_identity_connect_request(configurations, &self).await
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ impl ApiTokenRequest {
&self,
configurations: &ApiConfigurations,
) -> Result<IdentityTokenResponse, LoginError> {
super::send_identity_connect_request(configurations, None, &self).await
super::send_identity_connect_request(configurations, &self).await
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ impl AuthRequestTokenRequest {
&self,
configurations: &ApiConfigurations,
) -> Result<IdentityTokenResponse, LoginError> {
super::send_identity_connect_request(configurations, Some(&self.email), &self).await
super::send_identity_connect_request(configurations, &self).await
}
}
6 changes: 0 additions & 6 deletions crates/bitwarden-core/src/auth/api/request/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ mod password_token_request;
pub(crate) use password_token_request::*;

mod renew_token_request;
use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine};
pub(crate) use renew_token_request::*;

mod auth_request_token_request;
Expand All @@ -30,7 +29,6 @@ use crate::{

async fn send_identity_connect_request(
configurations: &ApiConfigurations,
email: Option<&str>,
body: impl serde::Serialize,
) -> Result<IdentityTokenResponse, LoginError> {
let mut request = configurations
Expand All @@ -51,10 +49,6 @@ async fn send_identity_connect_request(
request = request.header(reqwest::header::USER_AGENT, user_agent.clone());
}

if let Some(email) = email {
request = request.header("Auth-Email", URL_SAFE_NO_PAD.encode(email.as_bytes()));
}

let response = request
.body(serde_qs::to_string(&body).expect("Serialize should be infallible"))
.send()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ impl PasswordTokenRequest {
&self,
configurations: &ApiConfigurations,
) -> Result<IdentityTokenResponse, LoginError> {
super::send_identity_connect_request(configurations, Some(&self.email), &self).await
super::send_identity_connect_request(configurations, &self).await
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ impl RenewTokenRequest {
&self,
configurations: &ApiConfigurations,
) -> Result<IdentityTokenResponse, LoginError> {
super::send_identity_connect_request(configurations, None, &self).await
super::send_identity_connect_request(configurations, &self).await
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ class MainActivity : FragmentActivity() {

val loginBody = http.post(IDENTITY_URL + "connect/token") {
contentType(ContentType.Application.Json)
header("Auth-Email", Base64.getEncoder().encodeToString(EMAIL.toByteArray()))
setBody(FormDataContent(Parameters.build {
append("scope", "api offline_access")
append("client_id", "web")
Expand Down
6 changes: 1 addition & 5 deletions crates/bitwarden-uniffi/swift/iOS/App/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,9 @@ struct ContentView: View {
let (loginDataJson, _) = try await http.data(
for: request(
method: "POST", url: IDENTITY_URL + "connect/token",
fn: { r in
r.setValue(
EMAIL.data(using: .utf8)?.base64EncodedString(),
forHTTPHeaderField: "Auth-Email")
fn: { r in
r.setValue(
"application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")

var comp = URLComponents()
comp.queryItems = [
URLQueryItem(name: "scope", value: "api offline_access"),
Expand Down
Loading