validate

Function validate 

Source
pub fn validate(hostname: &str, authorization_header: &str) -> bool
Expand description

Validates a token from an authorization header against a hostname.

This function checks if a given authorization header contains a valid token for the specified hostname. The token must be in the format “Bearer ” where is a 32-character MD5 hash of the hostname.

§Arguments

  • hostname - A string slice containing the hostname to validate against
  • authorization_header - A string slice containing the full authorization header value

§Returns

  • bool - Returns true if the token is valid for the hostname, false otherwise

§Examples

let hostname = "example.com";
let auth_header = "Bearer d41d8cd98f00b204e9800998ecf8427e";
let is_valid = edgee_sdk::token::validate(hostname, auth_header);