Skip to content

Commit

Permalink
feat(rocket): Add project_roles and metadata to IntrospectedUser
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederik Terstappen committed Sep 5, 2024
1 parent 45fa9de commit ccdd7b5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/rocket/introspection/guard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use openidconnect::TokenIntrospectionResponse;
use rocket::http::Status;
use rocket::request::{FromRequest, Outcome};
use rocket::{async_trait, Request};
use std::collections::HashMap;

use crate::oidc::introspection::{introspect, IntrospectionError, ZitadelIntrospectionResponse};
use crate::rocket::introspection::IntrospectionConfig;
Expand Down Expand Up @@ -35,6 +36,8 @@ pub struct IntrospectedUser {
pub email: Option<String>,
pub email_verified: Option<bool>,
pub locale: Option<String>,
pub project_roles: Option<HashMap<String, HashMap<String, String>>>,
pub metadata: Option<HashMap<String, String>>,
}

impl From<ZitadelIntrospectionResponse> for IntrospectedUser {
Expand All @@ -49,6 +52,8 @@ impl From<ZitadelIntrospectionResponse> for IntrospectedUser {
email: response.extra_fields().email.clone(),
email_verified: response.extra_fields().email_verified,
locale: response.extra_fields().locale.clone(),
project_roles: response.extra_fields().project_roles.clone(),
metadata: response.extra_fields().metadata.clone(),
}
}
}
Expand Down

0 comments on commit ccdd7b5

Please sign in to comment.