Microservice to bring 2FA to self hosted PDSes

wip finally returning an okay error for the ui

Changed files
+3 -5
src
+2 -2
src/helpers.rs
··· 3 3 use anyhow::anyhow; 4 4 use axum::body::{Body, to_bytes}; 5 5 use axum::extract::Request; 6 - use axum::http::header::CONTENT_TYPE; 6 + use axum::http::header::{CONTENT_LENGTH, CONTENT_TYPE}; 7 7 use axum::http::{HeaderMap, StatusCode, Uri}; 8 8 use axum::response::{IntoResponse, Response}; 9 9 use axum_template::TemplateEngine; ··· 112 112 113 113 Response::builder() 114 114 .status(status) 115 - .header(CONTENT_TYPE, "application/json;charset=utf-8") 115 + .header(CONTENT_TYPE, "application/json") 116 116 .body(Body::from(body_str)) 117 117 .map_err(|_| StatusCode::BAD_REQUEST) 118 118 }
+1 -3
src/oauth_provider.rs
··· 2 2 use crate::helpers::{ 3 3 AuthResult, TokenCheckError, json_error_response, oauth_json_error_response, preauth_check, 4 4 }; 5 - use crate::xrpc::com_atproto_server::CreateSessionRequest; 6 5 use axum::body::Body; 7 6 use axum::extract::State; 8 7 use axum::http::{HeaderMap, StatusCode}; ··· 25 24 pub password: String, 26 25 pub remember: bool, 27 26 pub locale: String, 28 - #[serde(rename = "emailOtp")] 27 + #[serde(skip_serializing_if = "Option::is_none", rename = "emailOtp")] 29 28 pub email_otp: Option<String>, 30 29 } 31 30 ··· 37 36 let identifier = payload.username.clone(); 38 37 let password = payload.password.clone(); 39 38 let auth_factor_token = payload.email_otp.clone(); 40 - 41 39 //TODO need to pass in a flag to ignore app passwords for Oauth 42 40 43 41 // Run the shared pre-auth logic to validate and check 2FA requirement