You've already forked AstralRinth
forked from didirus/AstralRinth
Knossos Oauth 2 Flow Changes (#752)
* adjust type and response format * Replace Found with Ok for handled redirects * scope parse fix * change apps query from body to query * adjust tests for new response type * remove unused imports * Clippy fixes
This commit is contained in:
@@ -4,6 +4,7 @@ use super::{
|
||||
};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::serde_as;
|
||||
|
||||
use crate::database::models::oauth_client_authorization_item::OAuthClientAuthorization as DBOAuthClientAuthorization;
|
||||
use crate::database::models::oauth_client_item::OAuthClient as DBOAuthClient;
|
||||
@@ -64,9 +65,13 @@ pub struct OAuthClientAuthorization {
|
||||
pub created: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[serde_as]
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub struct GetOAuthClientsRequest {
|
||||
pub ids: Vec<OAuthClientId>,
|
||||
#[serde_as(
|
||||
as = "serde_with::StringWithSeparator::<serde_with::formats::CommaSeparator, String>"
|
||||
)]
|
||||
pub ids: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
|
||||
@@ -132,7 +132,9 @@ impl Scopes {
|
||||
}
|
||||
|
||||
pub fn parse_from_oauth_scopes(scopes: &str) -> Result<Scopes, bitflags::parser::ParseError> {
|
||||
let scopes = scopes.replace(' ', "|").replace("%20", "|");
|
||||
let scopes = scopes
|
||||
.replace(['+', ' '], "|")
|
||||
.replace("%20", "|");
|
||||
bitflags::parser::from_str(&scopes)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user