feat: ✨ ice local and remote changes
This commit is contained in:
parent
4f874d8789
commit
3b122dc4f7
6 changed files with 88 additions and 27 deletions
|
@ -20,10 +20,9 @@ async fn extract_user_from_authorization_header(headers: &HeaderMap) -> Option<U
|
|||
dbg!(authorization_header);
|
||||
if let Ok(authorization_header) = authorization_header.to_str() {
|
||||
if let Some((bearer, authorization_token)) = authorization_header.split_once(' ') {
|
||||
dbg!(
|
||||
"Info: Verify | Http Header | {} || {}",
|
||||
bearer,
|
||||
authorization_token
|
||||
println!(
|
||||
"Info: Extraction | Authorization Header | {} || {}",
|
||||
bearer, authorization_token
|
||||
);
|
||||
if bearer.to_lowercase() == "bearer" {
|
||||
let user = User {
|
||||
|
@ -39,7 +38,7 @@ async fn extract_user_from_authorization_header(headers: &HeaderMap) -> Option<U
|
|||
|
||||
pub async fn verify_then_get_user(mut request: Request, next: Next) -> impl IntoResponse {
|
||||
let headers = request.headers();
|
||||
dbg!(headers);
|
||||
println!("Info: Verify | Headers| {:#?}", headers);
|
||||
if let Some(user) = extract_user_from_authorization_header(headers).await {
|
||||
let user = Arc::new(user);
|
||||
request.extensions_mut().insert(user);
|
||||
|
|
|
@ -57,13 +57,16 @@ async fn create_signal(
|
|||
StatusCode::OK
|
||||
}
|
||||
|
||||
#[debug_handler]
|
||||
async fn read_signal(
|
||||
Extension(user_and_expected_signal): Extension<Arc<UserAndExpectedSignal>>,
|
||||
) -> impl IntoResponse {
|
||||
let mut target_index = None;
|
||||
let mut json_body = serde_json::json!("");
|
||||
for (index, user_and_signal) in USERS_AND_SIGNALS.read().unwrap().iter().enumerate() {
|
||||
if user_and_signal.signal.get_signal_type() == user_and_expected_signal.expected_signal {
|
||||
if user_and_signal.signal.get_signal_type() == user_and_expected_signal.expected_signal
|
||||
&& user_and_signal.user != user_and_expected_signal.user
|
||||
{
|
||||
json_body = serde_json::json!(user_and_signal);
|
||||
target_index = Some(index);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue