@@ -13,6 +13,7 @@ use openidconnect::{
1313} ;
1414use serde:: { self , Serializer } ;
1515use serde:: { Deserialize , Serialize } ;
16+ use std:: collections:: HashMap ;
1617use time:: { Duration , OffsetDateTime } ;
1718use tracing:: { error, warn} ;
1819use uuid:: Uuid ;
@@ -240,12 +241,12 @@ fn id_token_claims(
240241 Ok ( Some ( JitsiUser {
241242 id : uid,
242243 email : claims. email ( ) . map ( |email| email. to_string ( ) ) ,
243- affiliation : claims. additional_claims ( ) . affiliation . clone ( ) ,
244244 name : get_display_name_id_token ( claims) ,
245245 avatar : claims
246246 . picture ( )
247247 . and_then ( |x| x. get ( None ) )
248248 . map ( |x| x. to_string ( ) ) ,
249+ other : claims. additional_claims ( ) . other . clone ( ) ,
249250 } ) )
250251}
251252
@@ -270,12 +271,12 @@ async fn user_info_claims(
270271 None => claims. subject ( ) . to_string ( ) ,
271272 } ,
272273 email : claims. email ( ) . map ( |email| email. to_string ( ) ) ,
273- affiliation : claims. additional_claims ( ) . affiliation . clone ( ) ,
274274 name : get_display_name ( & claims) ,
275275 avatar : claims
276276 . picture ( )
277277 . and_then ( |x| x. get ( None ) )
278278 . map ( |x| x. to_string ( ) ) ,
279+ other : claims. additional_claims ( ) . other . clone ( ) ,
279280 } ) )
280281 }
281282 Err ( ConfigurationError :: MissingUrl ( _) ) => Ok ( None ) ,
@@ -299,6 +300,8 @@ struct JitsiClaims {
299300 iat : OffsetDateTime ,
300301 #[ serde( serialize_with = "jwt_numeric_date" ) ]
301302 exp : OffsetDateTime ,
303+ #[ serde( flatten) ]
304+ other : HashMap < String , String > ,
302305}
303306
304307#[ derive( Serialize ) ]
@@ -311,9 +314,10 @@ struct JitsiContext {
311314struct JitsiUser {
312315 id : String ,
313316 email : Option < String > ,
314- affiliation : Option < String > ,
315317 name : Option < String > ,
316318 avatar : Option < String > ,
319+ #[ serde( flatten) ]
320+ other : HashMap < String , String > ,
317321}
318322
319323fn create_jitsi_jwt (
@@ -328,13 +332,12 @@ fn create_jitsi_jwt(
328332 let iat = OffsetDateTime :: now_utc ( ) ;
329333 let exp = iat + Duration :: days ( 1 ) ;
330334
331- let context = JitsiContext {
332- user,
333- group : Some ( group) ,
334- } ;
335-
336335 let claims = JitsiClaims {
337- context,
336+ other : user. other . clone ( ) ,
337+ context : JitsiContext {
338+ user,
339+ group : Some ( group) ,
340+ } ,
338341 aud,
339342 iss,
340343 sub,
0 commit comments