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:
Carter
2023-11-11 09:42:01 -08:00
committed by GitHub
parent a818199b5a
commit 97ccb7df94
7 changed files with 50 additions and 29 deletions

View File

@@ -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)]

View File

@@ -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)
}