Skip to content

Commit

Permalink
fix: error code for token validation
Browse files Browse the repository at this point in the history
  • Loading branch information
apoorvdixit88 committed Nov 8, 2024
1 parent f40fd4a commit de8d3bd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/router/src/services/authorization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ pub fn check_permission(
pub fn check_tenant(token_tenant_id: Option<String>, header_tenant_id: &str) -> RouterResult<()> {
if let Some(tenant_id) = token_tenant_id {
if tenant_id != header_tenant_id {
return Err(ApiErrorResponse::InvalidTenant { tenant_id }.into());
return Err(ApiErrorResponse::InvalidJwtToken).attach_printable(format!(
"Token tenant ID: '{}' does not match Header tenant ID: '{}'",
tenant_id, header_tenant_id
));
}
}
Ok(())
Expand Down

0 comments on commit de8d3bd

Please sign in to comment.