Skip to main content

authenticate

Function authenticate 

Source
pub fn authenticate(
    keys: &Tenants,
    authorization: Option<&str>,
) -> Result<Caller, AuthError>
Expand description

The caller a request’s Authorization header names. The key is looked up on every call, with no cache, so a revoked key fails on its next request.

A failed check is counted in the audit (Tenants::count_auth_failure), except when the key table could not be read.

§Errors

AuthError::Missing with no header, AuthError::Malformed when it is not Bearer and a token, AuthError::Unknown for a key id no key has or a wrong secret, AuthError::Revoked for a revoked key, and AuthError::Io when the key table cannot be read.