mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-10 07:47:53 +00:00
feat(api): improve auth middleware
This commit is contained in:
parent
50900ee640
commit
c56fd36023
6 changed files with 87 additions and 75 deletions
22
crates/api/src/auth.rs
Normal file
22
crates/api/src/auth.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
pub const INTERNAL_SYSTEMID_HEADER: &'static str = "x-pluralkit-systemid";
|
||||
pub const INTERNAL_APPID_HEADER: &'static str = "x-pluralkit-appid";
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct AuthState {
|
||||
system_id: Option<i32>,
|
||||
app_id: Option<i32>,
|
||||
}
|
||||
|
||||
impl AuthState {
|
||||
pub fn new(system_id: Option<i32>, app_id: Option<i32>) -> Self {
|
||||
Self { system_id, app_id }
|
||||
}
|
||||
|
||||
pub fn system_id(&self) -> Option<i32> {
|
||||
self.system_id
|
||||
}
|
||||
|
||||
pub fn app_id(&self) -> Option<i32> {
|
||||
self.app_id
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue