@@ -13,7 +13,6 @@ use openidconnect::{
1313} ;
1414use serde:: { self , Serializer } ;
1515use serde:: { Deserialize , Serialize } ;
16- use std:: collections:: HashMap ;
1716use time:: { Duration , OffsetDateTime } ;
1817use tracing:: { error, warn} ;
1918use uuid:: Uuid ;
@@ -241,12 +240,12 @@ fn id_token_claims(
241240 Ok ( Some ( JitsiUser {
242241 id : uid,
243242 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 ( ) ,
250249 } ) )
251250}
252251
@@ -271,12 +270,12 @@ async fn user_info_claims(
271270 None => claims. subject ( ) . to_string ( ) ,
272271 } ,
273272 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 ( ) ,
280279 } ) )
281280 }
282281 Err ( ConfigurationError :: MissingUrl ( _) ) => Ok ( None ) ,
@@ -300,8 +299,6 @@ struct JitsiClaims {
300299 iat : OffsetDateTime ,
301300 #[ serde( serialize_with = "jwt_numeric_date" ) ]
302301 exp : OffsetDateTime ,
303- #[ serde( flatten) ]
304- other : HashMap < String , String > ,
305302}
306303
307304#[ derive( Serialize ) ]
@@ -314,10 +311,9 @@ struct JitsiContext {
314311struct JitsiUser {
315312 id : String ,
316313 email : Option < String > ,
314+ affiliation : Option < String > ,
317315 name : Option < String > ,
318316 avatar : Option < String > ,
319- #[ serde( flatten) ]
320- other : HashMap < String , String > ,
321317}
322318
323319fn create_jitsi_jwt (
@@ -332,12 +328,13 @@ fn create_jitsi_jwt(
332328 let iat = OffsetDateTime :: now_utc ( ) ;
333329 let exp = iat + Duration :: days ( 1 ) ;
334330
331+ let context = JitsiContext {
332+ user,
333+ group : Some ( group) ,
334+ } ;
335+
335336 let claims = JitsiClaims {
336- other : user. other . clone ( ) ,
337- context : JitsiContext {
338- user,
339- group : Some ( group) ,
340- } ,
337+ context,
341338 aud,
342339 iss,
343340 sub,
0 commit comments