pub struct AuthManager {
http_client: Arc<HttpClient>,
current_session: Arc<RwLock<Option<Session>>>,
connectivity_monitor: Option<Arc<Mutex<ConnectivityMonitor>>>,
}Expand description
Authentication manager
Fields§
§http_client: Arc<HttpClient>§current_session: Arc<RwLock<Option<Session>>>§connectivity_monitor: Option<Arc<Mutex<ConnectivityMonitor>>>Implementations§
Source§impl AuthManager
impl AuthManager
Sourcepub fn new(http_client: HttpClient) -> Self
pub fn new(http_client: HttpClient) -> Self
Create a new auth manager
Sourcepub fn set_connectivity_monitor(
&mut self,
monitor: Arc<Mutex<ConnectivityMonitor>>,
)
pub fn set_connectivity_monitor( &mut self, monitor: Arc<Mutex<ConnectivityMonitor>>, )
Set the connectivity monitor (for marking server reachability)
Sourcepub fn normalize_url(url: &str) -> Result<String, String>
pub fn normalize_url(url: &str) -> Result<String, String>
Normalize and validate server URL. Enforces HTTPS — plain HTTP is rejected for security.
Sourcepub fn normalize_username(username: &str) -> String
pub fn normalize_username(username: &str) -> String
Normalize a username before it goes to the server.
Only surrounding whitespace is stripped — interior spaces are legal in Jellyfin usernames. Without this, a trailing space from a soft keyboard’s autocorrect makes the server report an unknown user, which surfaces as a 401 that looks exactly like a wrong password.
TRACES: UR-042 | DR-054
Sourcepub async fn connect_to_server(
&self,
server_url: &str,
) -> Result<ServerInfo, String>
pub async fn connect_to_server( &self, server_url: &str, ) -> Result<ServerInfo, String>
Connect to server and get server info
Sourcepub async fn login(
&self,
server_url: &str,
username: &str,
password: &str,
device_id: &str,
) -> Result<AuthResult, String>
pub async fn login( &self, server_url: &str, username: &str, password: &str, device_id: &str, ) -> Result<AuthResult, String>
Authenticate by username and password
Sourcepub async fn verify_session(
&self,
server_url: &str,
user_id: &str,
access_token: &str,
device_id: &str,
) -> Result<User, String>
pub async fn verify_session( &self, server_url: &str, user_id: &str, access_token: &str, device_id: &str, ) -> Result<User, String>
Verify current session by fetching user info
Sourcepub async fn logout(
&self,
server_url: &str,
access_token: &str,
device_id: &str,
) -> Result<(), String>
pub async fn logout( &self, server_url: &str, access_token: &str, device_id: &str, ) -> Result<(), String>
Logout (call Jellyfin logout endpoint)
Sourcepub async fn get_session(&self) -> Option<Session>
pub async fn get_session(&self) -> Option<Session>
Get current session
Sourcepub async fn set_session(&self, session: Option<Session>)
pub async fn set_session(&self, session: Option<Session>)
Set current session
Auto Trait Implementations§
impl Freeze for AuthManager
impl !RefUnwindSafe for AuthManager
impl Send for AuthManager
impl Sync for AuthManager
impl Unpin for AuthManager
impl UnsafeUnpin for AuthManager
impl !UnwindSafe for AuthManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more