refactor: clients now have a single websocket that handles all rooms the user is in
This commit is contained in:
@@ -67,11 +67,15 @@ pub fn verify_jwt(headers: HeaderMap) -> Result<Claims, (StatusCode, String)> {
|
||||
.and_then(|s| s.strip_prefix("Bearer "))
|
||||
.ok_or((StatusCode::UNAUTHORIZED, "Missing token".to_string()))?;
|
||||
|
||||
verify_jwt_string(&token.to_string())
|
||||
}
|
||||
|
||||
pub fn verify_jwt_string(token: &String) -> Result<Claims, (StatusCode, String)> {
|
||||
let secret =
|
||||
std::env::var("FRANGIPANE_JWT_SECRET").unwrap_or_else(|_| DEFAULT_SECRET_KEY.to_string());
|
||||
|
||||
decode::<Claims>(
|
||||
token,
|
||||
token.as_str(),
|
||||
&DecodingKey::from_secret(secret.as_ref()),
|
||||
&Validation::default(),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user