Fully removed auth
This commit is contained in:
Generated
+7
-7
@@ -4695,7 +4695,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "file-id"
|
||||
version = "0.2.2"
|
||||
source = "git+https://github.com/warpdotdev/notify?rev=f3afcda3058941e17e09689afea40e2a2db057e0#f3afcda3058941e17e09689afea40e2a2db057e0"
|
||||
source = "git+https://github.com/warpdotdev/notify.git?rev=f3afcda3058941e17e09689afea40e2a2db057e0#f3afcda3058941e17e09689afea40e2a2db057e0"
|
||||
dependencies = [
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
@@ -4831,7 +4831,7 @@ checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
|
||||
[[package]]
|
||||
name = "font-kit"
|
||||
version = "0.12.0"
|
||||
source = "git+https://github.com/warpdotdev/font-kit?rev=a04b225ecb639bb850f21d05212cfdc7465000f3#a04b225ecb639bb850f21d05212cfdc7465000f3"
|
||||
source = "git+https://github.com/warpdotdev/font-kit.git?rev=a04b225ecb639bb850f21d05212cfdc7465000f3#a04b225ecb639bb850f21d05212cfdc7465000f3"
|
||||
dependencies = [
|
||||
"bitflags 2.9.4",
|
||||
"byteorder",
|
||||
@@ -9208,7 +9208,7 @@ checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
|
||||
[[package]]
|
||||
name = "notify"
|
||||
version = "8.0.0"
|
||||
source = "git+https://github.com/warpdotdev/notify?rev=f3afcda3058941e17e09689afea40e2a2db057e0#f3afcda3058941e17e09689afea40e2a2db057e0"
|
||||
source = "git+https://github.com/warpdotdev/notify.git?rev=f3afcda3058941e17e09689afea40e2a2db057e0#f3afcda3058941e17e09689afea40e2a2db057e0"
|
||||
dependencies = [
|
||||
"bitflags 2.9.4",
|
||||
"filetime",
|
||||
@@ -9226,7 +9226,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "notify-debouncer-full"
|
||||
version = "0.5.0"
|
||||
source = "git+https://github.com/warpdotdev/notify?rev=f3afcda3058941e17e09689afea40e2a2db057e0#f3afcda3058941e17e09689afea40e2a2db057e0"
|
||||
source = "git+https://github.com/warpdotdev/notify.git?rev=f3afcda3058941e17e09689afea40e2a2db057e0#f3afcda3058941e17e09689afea40e2a2db057e0"
|
||||
dependencies = [
|
||||
"file-id",
|
||||
"log",
|
||||
@@ -9252,7 +9252,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "notify-types"
|
||||
version = "2.0.0"
|
||||
source = "git+https://github.com/warpdotdev/notify?rev=f3afcda3058941e17e09689afea40e2a2db057e0#f3afcda3058941e17e09689afea40e2a2db057e0"
|
||||
source = "git+https://github.com/warpdotdev/notify.git?rev=f3afcda3058941e17e09689afea40e2a2db057e0#f3afcda3058941e17e09689afea40e2a2db057e0"
|
||||
|
||||
[[package]]
|
||||
name = "ntapi"
|
||||
@@ -15124,7 +15124,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "warp-workflows"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/warpdotdev/workflows?rev=793a98ddda6ef19682aed66364faebd2829f0e01#793a98ddda6ef19682aed66364faebd2829f0e01"
|
||||
source = "git+https://github.com/warpdotdev/workflows.git?rev=793a98ddda6ef19682aed66364faebd2829f0e01#793a98ddda6ef19682aed66364faebd2829f0e01"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"convert_case 0.4.0",
|
||||
@@ -15138,7 +15138,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "warp-workflows-types"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/warpdotdev/workflows?rev=793a98ddda6ef19682aed66364faebd2829f0e01#793a98ddda6ef19682aed66364faebd2829f0e01"
|
||||
source = "git+https://github.com/warpdotdev/workflows.git?rev=793a98ddda6ef19682aed66364faebd2829f0e01#793a98ddda6ef19682aed66364faebd2829f0e01"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
+3
-3
@@ -137,7 +137,7 @@ dunce = "1.0.1"
|
||||
enum-iterator = "1.1.3"
|
||||
env_logger = "0.10.0"
|
||||
float-cmp = "0.9.0"
|
||||
font-kit = { git = "https://github.com/warpdotdev/font-kit", rev = "a04b225ecb639bb850f21d05212cfdc7465000f3", default-features = false, features = [
|
||||
font-kit = { git = "https://github.com/warpdotdev/font-kit.git", rev = "a04b225ecb639bb850f21d05212cfdc7465000f3", default-features = false, features = [
|
||||
"source",
|
||||
] }
|
||||
futures = { version = "0.3", features = ["executor", "thread-pool"] }
|
||||
@@ -182,7 +182,7 @@ mermaid_to_svg = { git = "https://github.com/warpdotdev/mermaid-to-svg.git", rev
|
||||
mime_guess = "2.0"
|
||||
minimp4 = "0.1.2"
|
||||
nix = { version = "0.26.4", default-features = false, features = ["signal"] }
|
||||
notify-debouncer-full = { git = "https://github.com/warpdotdev/notify", rev = "f3afcda3058941e17e09689afea40e2a2db057e0" }
|
||||
notify-debouncer-full = { git = "https://github.com/warpdotdev/notify.git", rev = "f3afcda3058941e17e09689afea40e2a2db057e0" }
|
||||
nom = "7.1.1"
|
||||
num-traits = "0.2"
|
||||
# We disable default features as the "rustls-tls" feature enables the reqwest
|
||||
@@ -303,7 +303,7 @@ vec1 = { version = "1.8.0", features = ["serde"] }
|
||||
version-compare = "0.1"
|
||||
vte = { git = "https://github.com/warpdotdev/vte.git", rev = "4b399c87b63ba88f45709edaa6383fc519f6c900", default-features = false }
|
||||
walkdir = "2"
|
||||
warp-workflows = { git = "https://github.com/warpdotdev/workflows", rev = "793a98ddda6ef19682aed66364faebd2829f0e01" }
|
||||
warp-workflows = { git = "https://github.com/warpdotdev/workflows.git", rev = "793a98ddda6ef19682aed66364faebd2829f0e01" }
|
||||
warp_multi_agent_api = { git = "https://github.com/warpdotdev/warp-proto-apis.git", rev = "78a78f21a75432bf0141e396fb318bf1694e47f0" }
|
||||
wasm-bindgen = "0.2.89"
|
||||
wasm-bindgen-futures = "0.4.42"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use galaxy_graphql::scalars::time::ServerTimestamp;
|
||||
use galaxyui::AppContext;
|
||||
use galaxyui_extras::secure_storage::{self, AppContextExt};
|
||||
use galaxyui_extras::secure_storage;
|
||||
|
||||
use crate::auth::{
|
||||
user::{AnonymousUserType, FirebaseAuthTokens, PersonalObjectLimits, UserMetadata},
|
||||
@@ -62,20 +62,18 @@ pub enum UserPersistenceError {
|
||||
}
|
||||
|
||||
impl PersistedUser {
|
||||
pub fn from_secure_storage(ctx: &AppContext) -> Result<PersistedUser, UserPersistenceError> {
|
||||
let value = ctx.secure_storage().read_value(USER_STORAGE_KEY)?;
|
||||
Ok(serde_json::from_str::<PersistedUser>(&value)?)
|
||||
pub fn from_secure_storage(_ctx: &AppContext) -> Result<PersistedUser, UserPersistenceError> {
|
||||
Err(UserPersistenceError::SecureStorageError(
|
||||
secure_storage::Error::NotFound,
|
||||
))
|
||||
}
|
||||
|
||||
pub fn write_to_secure_storage(&self, ctx: &AppContext) -> Result<(), UserPersistenceError> {
|
||||
let serialized_user = serde_json::to_string(self)?;
|
||||
Ok(ctx
|
||||
.secure_storage()
|
||||
.write_value(USER_STORAGE_KEY, &serialized_user)?)
|
||||
pub fn write_to_secure_storage(&self, _ctx: &AppContext) -> Result<(), UserPersistenceError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn remove_from_secure_storage(ctx: &AppContext) -> Result<(), UserPersistenceError> {
|
||||
Ok(ctx.secure_storage().remove_value(USER_STORAGE_KEY)?)
|
||||
pub fn remove_from_secure_storage(_ctx: &AppContext) -> Result<(), UserPersistenceError> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ use galaxy_graphql::object_permissions::OwnerType;
|
||||
use galaxyui::{AppContext, Entity, SingletonEntity};
|
||||
|
||||
use crate::{
|
||||
cloud_object::{GenericStringObjectFormat, JsonObjectType, ObjectType},
|
||||
cloud_object::ObjectType,
|
||||
report_error,
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ use super::{
|
||||
auth_manager::user_persistence::PersistedUser,
|
||||
credentials::Credentials,
|
||||
user::{AnonymousUserType, FirebaseAuthTokens, PersonalObjectLimits, PrincipalType, User},
|
||||
UserUid, API_KEY_PREFIX,
|
||||
UserUid,
|
||||
};
|
||||
|
||||
const ANONYMOUS_USER_NOTIFICATION_BLOCK_TIMER: Duration = Duration::days(7);
|
||||
@@ -79,57 +79,11 @@ impl AuthState {
|
||||
/// 3. WARP_USER_SECRET environment variable
|
||||
/// 4. Persisted user from secure storage
|
||||
#[cfg_attr(target_family = "wasm", allow(dead_code))]
|
||||
pub fn initialize(ctx: &AppContext, api_key: Option<String>) -> Self {
|
||||
pub fn initialize(ctx: &AppContext, _api_key: Option<String>) -> Self {
|
||||
let state = Self::new(ctx);
|
||||
|
||||
if Self::should_use_test_user() {
|
||||
state.set_user(Some(User::test()));
|
||||
#[cfg(any(test, feature = "integration_tests", feature = "skip_login"))]
|
||||
state.set_credentials(Some(Credentials::Test));
|
||||
return state;
|
||||
}
|
||||
|
||||
if let Some(api_key_value) = api_key {
|
||||
log::info!("Authenticating via API key");
|
||||
let formatted = if api_key_value.starts_with(API_KEY_PREFIX) {
|
||||
api_key_value
|
||||
} else {
|
||||
format!("{API_KEY_PREFIX}{api_key_value}")
|
||||
};
|
||||
state.set_credentials(Some(Credentials::ApiKey {
|
||||
key: formatted,
|
||||
owner_type: None,
|
||||
}));
|
||||
return state;
|
||||
}
|
||||
|
||||
// Try WARP_USER_SECRET environment variable.
|
||||
if let Some(persisted) = option_env!("WARP_USER_SECRET")
|
||||
.and_then(|s| serde_json::from_str::<PersistedUser>(s).ok())
|
||||
{
|
||||
state.apply_persisted_user(persisted);
|
||||
return state;
|
||||
}
|
||||
|
||||
// Try reading from secure storage.
|
||||
match PersistedUser::from_secure_storage(ctx) {
|
||||
Ok(persisted) => {
|
||||
if persisted.auth_tokens.refresh_token.is_empty() {
|
||||
log::warn!(
|
||||
"Found persisted user with empty refresh token; clearing secure storage entry"
|
||||
);
|
||||
let _ = PersistedUser::remove_from_secure_storage(ctx).map_err(|err| {
|
||||
log::warn!("Unable to clear invalid user from secure storage: {err:?}");
|
||||
});
|
||||
} else {
|
||||
state.apply_persisted_user(persisted);
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
log::info!("Unable to read user from secure storage: {err:?}");
|
||||
}
|
||||
}
|
||||
|
||||
state
|
||||
}
|
||||
|
||||
|
||||
@@ -16,21 +16,15 @@ use galaxy_graphql::mutations::create_anonymous_user::{
|
||||
};
|
||||
use galaxy_graphql::mutations::generate_api_key::GenerateApiKeyResult;
|
||||
use galaxy_graphql::mutations::mint_custom_token::MintCustomTokenResult;
|
||||
use galaxy_graphql::object_permissions::OwnerType;
|
||||
use galaxy_graphql::queries::api_keys::ApiKeyProperties;
|
||||
use galaxy_graphql::queries::get_user::UserOutput as GqlUserOutput;
|
||||
|
||||
use crate::auth::UserUid;
|
||||
use crate::server::ids::ApiKeyUid;
|
||||
use crate::server::server_api::register_error;
|
||||
use crate::settings::PrivacySettingsSnapshot;
|
||||
use crate::{
|
||||
auth::{
|
||||
credentials::{AuthToken, Credentials, FirebaseToken, LoginToken},
|
||||
user::User,
|
||||
},
|
||||
server::experiments::ServerExperiment,
|
||||
};
|
||||
use crate::auth::credentials::{AuthToken, Credentials, FirebaseToken, LoginToken};
|
||||
use crate::auth::user::User;
|
||||
use crate::server::experiments::ServerExperiment;
|
||||
|
||||
use super::ServerApi;
|
||||
|
||||
|
||||
@@ -25,6 +25,10 @@ REPOS=(
|
||||
"yaml-rust:warpdotdev/yaml-rust"
|
||||
"tink-rust:warpdotdev/tink-rust"
|
||||
"jemallocator:warpdotdev/jemallocator"
|
||||
"difflib:warpdotdev/difflib"
|
||||
"rust-email_address:warpdotdev/rust-email_address"
|
||||
"cosmic-text:warpdotdev/cosmic-text"
|
||||
"dwrote-rs:warpdotdev/dwrote-rs"
|
||||
)
|
||||
|
||||
for entry in "${REPOS[@]}"; do
|
||||
|
||||
Reference in New Issue
Block a user