1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Actually verify user credentials

This commit is contained in:
NGnius (Graham)
2025-04-01 19:38:03 -04:00
parent a540cf6d8f
commit 69d1bfaee0
14 changed files with 319 additions and 63 deletions

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;