Skip to content
Snippets Groups Projects
Verified Commit b74fde27 authored by Andrej Ramašeuski's avatar Andrej Ramašeuski
Browse files

Pridano generovani tokenu pro jitsi

parent 53741ee7
No related branches found
No related tags found
No related merge requests found
{
secrets => ['04283d549647774b17d10e1d75bcf16c2969673d'],
secrets => ['14283d549647774b17d10e1d75bcf16c2969673d'],
oauth_url => 'https://auth.pirati.cz/auth/realms/pirati',
groups_url => 'https://iapi.pirati.cz/v1/groups',
piratar_base_url => 'https://a.pirati.cz/piratar/200/',
jitsi_token_secret => 'UtfkxQEpudmCh2MKLXrRmHAXoQwg5twF',
jitsi_token_lifetime => 300,
}
......@@ -101,6 +101,31 @@ sub register ( $class, $self, $conf) {
return $c->stash->{user_roles};
});
$self->helper( jitsi_token => sub ( $c, $room='*' ) {
my $claims = $c->oauth_claims // return undef;
my $jwt = Mojo::JWT->new(
secret => $c->cfg->{jitsi_token_secret},
claims => {
aud => 'jitsi',
iss => 'cf-online',
sub => 'meet.jitsi',
room => $room,
exp => time + $c->cfg->{jitsi_token_lifetime},
context => {
user => {
avatar => join ('',
$c->cfg->{piratar_base_url},
$claims->{preferred_username},
'.jpg',
),
name => $claims->{name},
email => $claims->{mail},
}
},
}
)->encode;
});
}
1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment