mirror of
https://github.com/stoatchat/stoatchat.git
synced 2026-07-14 13:36:59 +00:00
fix: add more oauth2 checks
This commit is contained in:
@@ -49,6 +49,7 @@ auto_derived_partial!(
|
||||
|
||||
auto_derived!(
|
||||
#[derive(Copy, Hash)]
|
||||
#[serde(rename = "lowercase")]
|
||||
pub enum OAuth2Scope {
|
||||
Identify,
|
||||
Full,
|
||||
|
||||
@@ -123,4 +123,14 @@ pub async fn add_code_challange(token: &str, code_challenge: &str) -> Result<()>
|
||||
.map_err(|_| create_error!(InternalError))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn get_code_challange(token: &str) -> Result<Option<String>> {
|
||||
let mut conn = redis_kiss::get_connection()
|
||||
.await
|
||||
.map_err(|_| create_error!(InternalError))?;
|
||||
|
||||
conn.get(format!("oauth2:{token}:code_challenge"))
|
||||
.await
|
||||
.map_err(|_| create_error!(InternalError))
|
||||
}
|
||||
Reference in New Issue
Block a user