Skip to main content

validate_jwt

Function validate_jwt 

Source
pub fn validate_jwt(policy: &AuthPolicy, token: &str) -> Result<(), ServerError>
Available on crate feature enterprise only.
Expand description

JWT validation helper (HS256).

§Examples

use http_handle::enterprise::{AuthPolicy, validate_jwt};
let p = AuthPolicy::default();
let _ = validate_jwt(&p, "a.b.c");
assert_eq!(1, 1);

§Errors

Returns an error when token shape is invalid or configured secret env var is missing.

§Panics

This function does not panic.