openzeppelin_relayer::utils

Function check_authorization_header

Source
pub fn check_authorization_header(
    req: &ServiceRequest,
    expected_key: &SecretString,
) -> bool
Expand description

Checks if the authorization header in the request matches the expected API key.

This function extracts the authorization header from the request, verifies that it starts with the expected prefix (e.g., “Bearer “), and then compares the remaining part of the header value with the expected API key.