Correctly get config when extracting tokens

This commit is contained in:
Jake Howard 2024-02-28 20:01:25 +00:00 committed by Helmut K. C. Tessarek
parent c7b4a9ef01
commit 97e919b1f4
No known key found for this signature in database
GPG Key ID: BE0985349D44DD00
1 changed files with 3 additions and 3 deletions

View File

@ -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.
///
@ -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);