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

@@ -125,7 +125,7 @@ pub async fn get_authorize_accept_flow_id(response: ServiceResponse) -> String {
}
pub async fn get_auth_code_from_redirect_params(response: &ServiceResponse) -> String {
assert_status(response, StatusCode::FOUND);
assert_status(response, StatusCode::OK);
let query_params = get_redirect_location_query_params(response);
query_params.get("code").unwrap().to_string()
}
@@ -140,7 +140,13 @@ pub async fn get_access_token(response: ServiceResponse) -> String {
pub fn get_redirect_location_query_params(
response: &ServiceResponse,
) -> actix_web::web::Query<HashMap<String, String>> {
let redirect_location = response.headers().get(LOCATION).unwrap().to_str().unwrap();
let redirect_location = response
.headers()
.get(LOCATION)
.unwrap()
.to_str()
.unwrap()
.to_string();
actix_web::web::Query::<HashMap<String, String>>::from_query(
redirect_location.split_once('?').unwrap().1,
)