Actually verify user credentials

This commit is contained in:
NGnius (Graham) committed 2025-04-01 19:38:03 -04:00
1 parent a540cf6d8f
commit 69d1bfaee0
14 files changed
+319 -63

No files matched your search

+23
View File
@@ -6,10 +6,33 @@ pub struct UserToken {
pub refresh_token: String,
}
pub struct UserInfo {
pub payload: libfj::robocraft::TokenPayload,
pub extra: ExtraUserInfo,
}
pub enum ExtraUserInfo {
Steam {
id: u64,
},
Standalone {
password: String,
}
}
pub struct UserLoginInfo {
pub response: libfj::robocraft::AuthenticationResponseInfo,
pub is_new: bool,
}
pub trait UserProvider<C> {
fn authenticate(&self, user: UserToken) -> Result<Box<dyn User<C> + Send + Sync>, String>;
}
pub trait UserAuthenticator {
fn login(&self, info: UserInfo) -> Result<UserLoginInfo, String>;
}
pub trait User<C> {
fn token(&self) -> &'_ super::UserToken;
fn is_mod(&self) -> bool;