Skip to main content

Module auth

Module auth 

Source
Expand description

Auth middleware + API-key helpers.

AuthMode, JwtConfig, and JwksCache are defined in crate::auth_mode (no crate-internal deps) and re-exported here so the public path assay_workflow::api::auth::AuthMode keeps working.

Re-exports§

pub use crate::auth_mode::AuthMode;
pub use crate::auth_mode::JwksCache;
pub use crate::auth_mode::JwtConfig;

Functions§

auth_middleware
Axum middleware that enforces authentication based on the configured mode.
generate_api_key
Generate a new random API key (32 bytes, hex-encoded).
hash_api_key
Hash an API key with SHA-256 for storage/lookup.
key_prefix
Extract the prefix (first 8 chars after “assay_”) for display.