Support offline validation of JWTs and RBAC #602
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Provide
ZitadelClaims
in the library that exposes APIs to also do RBAC authorization.The main motivation was to provide a higher-level API towards the claims returned and reduce duplication across the web frameworks, since it's not specific to the framework but rather a Zitadel implementation detail.
Note that it needs testing first.
Overview
ZitadelTokenClaims
with flattened fields for direct accessBreaking Changes
1.
introspect()
Return Type ChangedThe
introspect()
function now returnsZitadelTokenClaims
instead ofZitadelIntrospectionResponse
.Before:
After:
2. Framework Integration Types
All framework integrations now use
ZitadelTokenClaims
directly.Before:
After:
Migration Scenarios
Scenario 1: Basic Token Introspection
Before:
After:
Scenario 2: Role-Based Access Control
Before:
After:
Scenario 3: Accessing User Information
Before:
After:
Scenario 4: Custom Claims
Before:
After:
Scenario 5: Backwards Compatibility
If you need the full introspection response for advanced use cases:
New Features
1. Built-in RBAC Methods
2. Token Validation Helpers
3. JWT Validation with JWKS
Benefits of the New API
Quick Reference
response.active()
response.sub().unwrap()
claims.sub
response.extra_fields().email
claims.email
response.extra_fields().project_roles
claims.project_roles
claims.has_role()
,claims.has_role_in_project()
introspect()
returnsZitadelIntrospectionResponse
introspect()
returnsZitadelTokenClaims
introspect_raw()
for backwards compatibility