Skip to content
This repository was archived by the owner on May 25, 2025. It is now read-only.

Commit a3e7cee

Browse files
Allow setting group value in token via environment variable (#263)
1 parent 33fadd6 commit a3e7cee

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ services:
6363
# - 'VERIFY_ACCESS_TOKEN_HASH=false # <- explicitly disable access token hash verification (OPTIONAL),
6464
# default: true
6565
# - 'SKIP_PREJOIN_SCREEN=false' # <- skips the jitsi prejoin screen after login (default: true)
66+
# - 'GROUP=example' # <- Value for the 'group' field in the token
67+
# default: ''
6668
ports:
6769
- '3000:3000'
6870

src/cfg.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ pub(crate) struct Cfg {
2929
pub(crate) verify_access_token_hash: Option<bool>,
3030
#[serde(default)]
3131
pub(crate) skip_prejoin_screen: Option<bool>,
32+
#[serde(default)]
33+
pub(crate) group: String,
34+
3235
}
3336

3437
fn default_listen_addr() -> SocketAddr {

src/routes.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ async fn callback(
154154
config.jitsi_sub,
155155
"*".to_string(),
156156
config.jitsi_secret,
157+
config.group,
157158
)
158159
.map_err(|err| {
159160
error!("Unable to create jwt: {}", err);
@@ -316,11 +317,12 @@ fn create_jitsi_jwt(
316317
sub: String,
317318
room: String,
318319
secret: String,
320+
group: String,
319321
) -> anyhow::Result<String> {
320322
let iat = OffsetDateTime::now_utc();
321323
let exp = iat + Duration::days(1);
322324

323-
let context = JitsiContext { user, group: None };
325+
let context = JitsiContext { user, group: Some(group) };
324326
let claims = JitsiClaims {
325327
context,
326328
aud,

0 commit comments

Comments
 (0)