-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Fetch project roles from introspection (#550)
Allows fetching the project roles from the returned JWT token when using the introspection endpoint. Is generic over a type for the roles so that users can do something like: ```rust #[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Hash, Clone, Copy)] #[serde(rename_all = "kebab-case")] enum MyRole { Admin, User, } fn my_endpoint(user: Introspected<MyRole>) -> Result<impl IntoResponse> { if !user.project_roles.get(MyRole::Admin).is_some_and(|r| r.contains(ORG_ID)) { return StatusCode::FORBIDDEN; } } ```
- Loading branch information
1 parent
2084e0e
commit 5ad8613
Showing
3 changed files
with
49 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters