Skip to main content

check_admin_auth

Function check_admin_auth 

Source
pub fn check_admin_auth(
    req: &Request<Body>,
    admin_auth_required: bool,
    admin_username: &Option<String>,
    admin_password_hash: &Option<String>,
) -> Result<(), Response>
Expand description

Check if admin authentication is required and valid.

The admin_password_hash parameter should contain a SHA-256 hash produced by hash_admin_password. If a plain-text password is passed instead (i.e. it is not a valid 64-char hex string), it will be hashed on the fly for backward compatibility.