Skip to content

Commit 293b6fa

Browse files
authored
feat(jwt): New option to control user info check. (#16115)
* feat(jwt): New option to control user info check. * squash: Rename.
1 parent 34da0ff commit 293b6fa

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,6 +1576,9 @@ var config = {
15761576
// tokenAuthUrlAutoRedirect: false
15771577
// An option to respect the context.tenant jwt field compared to the current tenant from the url
15781578
// tokenRespectTenant: false,
1579+
// An option to get for user info (name, picture, email) in the token outside the user context.
1580+
// Can be used with Firebase tokens.
1581+
// tokenGetUserInfoOutOfContext: false,
15791582

15801583
// You can put an array of values to target different entity types in the invite dialog.
15811584
// Valid values are "phone", "room", "sip", "user", "videosipgw" and "email"

react/features/base/config/configType.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,8 +603,9 @@ export interface IConfig {
603603
};
604604
tokenAuthUrl?: string;
605605
tokenAuthUrlAutoRedirect?: string;
606+
tokenGetUserInfoOutOfContext?: boolean;
606607
tokenLogoutUrl?: string;
607-
tokenRespectTenant?: string;
608+
tokenRespectTenant?: boolean;
608609
toolbarButtons?: Array<ToolbarButton>;
609610
toolbarConfig?: {
610611
alwaysVisible?: boolean;

react/features/base/jwt/middleware.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ function _setJWT(store: IStore, next: Function, action: AnyAction) {
165165

166166
if (jwtPayload) {
167167
const { context, iss, sub } = jwtPayload;
168+
const { tokenGetUserInfoOutOfContext, tokenRespectTenant } = state['features/base/config'];
168169

169170
action.jwt = jwt;
170171
action.issuer = iss;
@@ -180,7 +181,6 @@ function _setJWT(store: IStore, next: Function, action: AnyAction) {
180181
const newUser = user ? { ...user } : {};
181182

182183
let features = context.features;
183-
const { tokenRespectTenant } = state['features/base/config'];
184184

185185
// eslint-disable-next-line max-depth
186186
if (!isVpaasMeeting(state) && tokenRespectTenant && context.tenant) {
@@ -210,7 +210,8 @@ function _setJWT(store: IStore, next: Function, action: AnyAction) {
210210
if (context.user && context.user.role === 'visitor') {
211211
action.preferVisitor = true;
212212
}
213-
} else if (jwtPayload.name || jwtPayload.picture || jwtPayload.email) {
213+
} else if (tokenGetUserInfoOutOfContext
214+
&& (jwtPayload.name || jwtPayload.picture || jwtPayload.email)) {
214215
// there are some tokens (firebase) having picture and name on the main level.
215216
_overwriteLocalParticipant(store, {
216217
avatarURL: jwtPayload.picture,

0 commit comments

Comments
 (0)