diff --git a/server/src/login_provider.rs b/server/src/login_provider.rs index f5236e1fc3..3111f6fa47 100644 --- a/server/src/login_provider.rs +++ b/server/src/login_provider.rs @@ -1,4 +1,4 @@ -use authc::{AuthClient, AuthToken, Uuid}; +use authc::{AuthClient, AuthToken, Uuid, AuthClientError}; use common::msg::RegisterError; use hashbrown::HashMap; use std::str::FromStr; @@ -103,4 +103,8 @@ impl LoginProvider { }, } } + + pub fn username_to_uuid(&self, username: &str) -> Result<Uuid, AuthClientError> { + self.auth_server.map_or_else(|| Ok(derive_uuid(username)), |username| auth.username_to_uuid(username)) + } }