axum feature, you can automatically extract these claims from validated requests using the RequireAuth extractor.
Claim Extraction Example
The easiest way to work with token claims is to use theRequireAuth extractor in your Axum route handlers. This guarantees the token is valid, unexpired, and properly signed.
Available Claims
By default, the SDK parses the following standard Wacht claims:Identity & Session
The Subject identifier. In Wacht, this is the user’s stable and globally unique
user_id. (Available on extractor as auth.user_id).The unique identifier for the specific authentication session. If the user revokes this session remotely, this token becomes invalid regardless of expiration.
Tenancy & Permissions
If the user has selected an active organization context, this claim will contain the
org_id.A list of permission strings (e.g.,
["users:read", "billing:manage"]) the user holds within the current organization_id.If the user has selected an active workspace context within an organization, this claim will contain the
workspace_id.A list of permission strings the user holds within the current
workspace_id.Standard JWT Claims
The SDK also strictly verifies standard JWT claims:exp: Expiration Time (enforced automatically, with a 5-second default clock skew allowance).iat: Issued At Time.iss: Issuer (should match your deployment’s Frontend API URL).
Permission Checks
Rather than parsing the permissions vectors manually, theRequireAuth extractor provides convenient methods for permission validation:
