Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

1234567891011121314151617181920212223242526272829303132333435
  1. const AuthUtil = {
  2. /**
  3. * Creates the URL pointing to JWT token authentication service. It is
  4. * formatted from the 'urlPattern' argument which can contain the following
  5. * constants:
  6. * '{room}' - name of the conference room passed as <tt>roomName</tt>
  7. * argument to this method.
  8. * '{roleUpgrade}' - will contain 'true' if the URL will be used for
  9. * the role upgrade scenario, where user connects from anonymous domain and
  10. * then gets upgraded to the moderator by logging-in from the popup window.
  11. *
  12. * @param urlPattern a URL pattern pointing to the login service
  13. * @param roomName the name of the conference room for which the user will
  14. * be authenticated
  15. * @param {bool} roleUpgrade <tt>true</tt> if the URL will be used for role
  16. * upgrade scenario, where the user logs-in from the popup window in order
  17. * to have the moderator rights granted
  18. *
  19. * @returns {string|null} the URL pointing to JWT login service or
  20. * <tt>null</tt> if 'urlPattern' is not a string and the URL can not be
  21. * constructed.
  22. */
  23. getTokenAuthUrl(urlPattern, roomName, roleUpgrade) {
  24. const url = urlPattern;
  25. if (typeof url !== 'string') {
  26. return null;
  27. }
  28. return url.replace('{room}', roomName)
  29. .replace('{roleUpgrade}', roleUpgrade === true);
  30. }
  31. };
  32. module.exports = AuthUtil;