Skip to content

Commit

Permalink
Revert "Pass all properties from idp provider to jitsi"
Browse files Browse the repository at this point in the history
This reverts commit 799d445.
  • Loading branch information
MarcelCoding committed Dec 11, 2023
1 parent 799d445 commit 5befab9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 22 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ struct Session {

#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
struct MyClaims {
#[serde(flatten)]
other: HashMap<String, String>,
affiliation: Option<String>,
}

impl AdditionalClaims for MyClaims {}
Expand Down
21 changes: 9 additions & 12 deletions src/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use openidconnect::{
};
use serde::{self, Serializer};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use time::{Duration, OffsetDateTime};
use tracing::{error, warn};
use uuid::Uuid;
Expand Down Expand Up @@ -241,12 +240,12 @@ fn id_token_claims(
Ok(Some(JitsiUser {
id: uid,
email: claims.email().map(|email| email.to_string()),
affiliation: claims.additional_claims().affiliation.clone(),
name: get_display_name_id_token(claims),
avatar: claims
.picture()
.and_then(|x| x.get(None))
.map(|x| x.to_string()),
other: claims.additional_claims().other.clone(),
}))
}

Expand All @@ -271,12 +270,12 @@ async fn user_info_claims(
None => claims.subject().to_string(),
},
email: claims.email().map(|email| email.to_string()),
affiliation: claims.additional_claims().affiliation.clone(),
name: get_display_name(&claims),
avatar: claims
.picture()
.and_then(|x| x.get(None))
.map(|x| x.to_string()),
other: claims.additional_claims().other.clone(),
}))
}
Err(ConfigurationError::MissingUrl(_)) => Ok(None),
Expand All @@ -300,8 +299,6 @@ struct JitsiClaims {
iat: OffsetDateTime,
#[serde(serialize_with = "jwt_numeric_date")]
exp: OffsetDateTime,
#[serde(flatten)]
other: HashMap<String, String>,
}

#[derive(Serialize)]
Expand All @@ -314,10 +311,9 @@ struct JitsiContext {
struct JitsiUser {
id: String,
email: Option<String>,
affiliation: Option<String>,
name: Option<String>,
avatar: Option<String>,
#[serde(flatten)]
other: HashMap<String, String>,
}

fn create_jitsi_jwt(
Expand All @@ -332,12 +328,13 @@ fn create_jitsi_jwt(
let iat = OffsetDateTime::now_utc();
let exp = iat + Duration::days(1);

let context = JitsiContext {
user,
group: Some(group),
};

let claims = JitsiClaims {
other: user.other.clone(),
context: JitsiContext {
user,
group: Some(group),
},
context,
aud,
iss,
sub,
Expand Down

0 comments on commit 5befab9

Please sign in to comment.