Expand description
Tesseral SDK for axum.
Typically, you will construct an Authenticator, and then add
require_auth to your router. From there, you can extract the Auth
object from the request extensions.
use axum::{Router, routing::get};
use tesseral_axum::{Auth, Authenticator, require_auth};
let authenticator = Authenticator::new("publishable_key_...".into());
let app: Router = Router::new()
.route("/", get(handler))
.layer(require_auth(authenticator));
async fn handler(auth: Auth) -> String {
format!("You work for {}", auth.organization_id())
}Documentation: https://tesseral.com/docs/sdks/serverside-sdks/tesseral-sdk-axum
Re-exports§
pub use crate::auth::Auth;pub use crate::auth::CredentialsType;
Modules§
Structs§
- Authenticator
- Authenticates access tokens and API keys. Must be used with
require_auth. - Require
Auth - A middleware service that requires authentication for all requests.
- Require
Auth Layer - A middleware layer that requires authentication for all requests.
Functions§
- require_
auth - Middleware layer that requires requests be authenticated.