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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user