Skip to content

Commit

Permalink
Correctly get config when extracting tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
RealOrangeOne committed Feb 28, 2024
1 parent 07fb759 commit fc9e493
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use actix_web::http::Method;
use actix_web::middleware::ErrorHandlerResponse;
use actix_web::{error, web, Error};
use std::collections::HashSet;
use std::sync::RwLock;
use tokio::sync::RwLock;

/// Extracts the tokens from the authorization header by token type.
///
Expand All @@ -14,8 +14,8 @@ pub(crate) async fn extract_tokens(req: &ServiceRequest) -> Result<HashSet<Token
let config = req
.app_data::<web::Data<RwLock<Config>>>()
.map(|cfg| cfg.read())
.and_then(Result::ok)
.ok_or_else(|| error::ErrorInternalServerError("cannot acquire config"))?;
.ok_or_else(|| error::ErrorInternalServerError("cannot acquire config"))?
.await;

let mut user_tokens = HashSet::with_capacity(2);

Expand Down

0 comments on commit fc9e493

Please sign in to comment.