@edx/frontend-platform 3.5.0 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/analytics/MockAnalyticsService.js +6 -19
  2. package/analytics/MockAnalyticsService.js.map +1 -1
  3. package/analytics/SegmentAnalyticsService.js +53 -57
  4. package/analytics/SegmentAnalyticsService.js.map +1 -1
  5. package/analytics/index.js.map +1 -1
  6. package/analytics/interface.js +9 -9
  7. package/analytics/interface.js.map +1 -1
  8. package/auth/AxiosCsrfTokenService.js +36 -58
  9. package/auth/AxiosCsrfTokenService.js.map +1 -1
  10. package/auth/AxiosJwtAuthService.js +105 -150
  11. package/auth/AxiosJwtAuthService.js.map +1 -1
  12. package/auth/AxiosJwtTokenService.js +101 -148
  13. package/auth/AxiosJwtTokenService.js.map +1 -1
  14. package/auth/LocalForageCache.js +89 -108
  15. package/auth/LocalForageCache.js.map +1 -1
  16. package/auth/MockAuthService.js +10 -35
  17. package/auth/MockAuthService.js.map +1 -1
  18. package/auth/index.js.map +1 -1
  19. package/auth/interceptors/createCsrfTokenProviderInterceptor.js +35 -50
  20. package/auth/interceptors/createCsrfTokenProviderInterceptor.js.map +1 -1
  21. package/auth/interceptors/createJwtTokenProviderInterceptor.js +33 -47
  22. package/auth/interceptors/createJwtTokenProviderInterceptor.js.map +1 -1
  23. package/auth/interceptors/createProcessAxiosRequestErrorInterceptor.js +15 -27
  24. package/auth/interceptors/createProcessAxiosRequestErrorInterceptor.js.map +1 -1
  25. package/auth/interceptors/createRetryInterceptor.js +75 -105
  26. package/auth/interceptors/createRetryInterceptor.js.map +1 -1
  27. package/auth/interface.js +41 -58
  28. package/auth/interface.js.map +1 -1
  29. package/auth/utils.js +22 -40
  30. package/auth/utils.js.map +1 -1
  31. package/config.js +6 -7
  32. package/config.js.map +1 -1
  33. package/constants.js +8 -8
  34. package/constants.js.map +1 -1
  35. package/i18n/countries.js +9 -15
  36. package/i18n/countries.js.map +1 -1
  37. package/i18n/index.js +1 -0
  38. package/i18n/index.js.map +1 -1
  39. package/i18n/injectIntlWithShim.js +4 -28
  40. package/i18n/injectIntlWithShim.js.map +1 -1
  41. package/i18n/languages.js +11 -17
  42. package/i18n/languages.js.map +1 -1
  43. package/i18n/lib.js +64 -56
  44. package/i18n/lib.js.map +1 -1
  45. package/i18n/scripts/transifex-utils.js +5 -20
  46. package/i18n/scripts/transifex-utils.js.map +1 -1
  47. package/index.js.map +1 -1
  48. package/initialize.js +176 -228
  49. package/initialize.js.map +1 -1
  50. package/logging/MockLoggingService.js +5 -9
  51. package/logging/MockLoggingService.js.map +1 -1
  52. package/logging/NewRelicLoggingService.js +9 -33
  53. package/logging/NewRelicLoggingService.js.map +1 -1
  54. package/logging/index.js.map +1 -1
  55. package/logging/interface.js +7 -6
  56. package/logging/interface.js.map +1 -1
  57. package/package.json +4 -4
  58. package/pubSub.js +4 -3
  59. package/pubSub.js.map +1 -1
  60. package/react/AppContext.js +1 -1
  61. package/react/AppContext.js.map +1 -1
  62. package/react/AppProvider.js +13 -23
  63. package/react/AppProvider.js.map +1 -1
  64. package/react/AuthenticatedPageRoute.js +5 -13
  65. package/react/AuthenticatedPageRoute.js.map +1 -1
  66. package/react/ErrorBoundary.js +4 -21
  67. package/react/ErrorBoundary.js.map +1 -1
  68. package/react/ErrorPage.js +7 -17
  69. package/react/ErrorPage.js.map +1 -1
  70. package/react/LoginRedirect.js +1 -1
  71. package/react/LoginRedirect.js.map +1 -1
  72. package/react/OptionalReduxProvider.js +2 -4
  73. package/react/OptionalReduxProvider.js.map +1 -1
  74. package/react/PageRoute.js +3 -3
  75. package/react/PageRoute.js.map +1 -1
  76. package/react/hooks.js +2 -6
  77. package/react/hooks.js.map +1 -1
  78. package/react/index.js +1 -0
  79. package/react/index.js.map +1 -1
  80. package/testing/index.js +1 -0
  81. package/testing/index.js.map +1 -1
  82. package/testing/initializeMockApp.js +11 -11
  83. package/testing/initializeMockApp.js.map +1 -1
  84. package/testing/mockMessages.js.map +1 -1
  85. package/utils.js +15 -24
  86. package/utils.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"AxiosJwtAuthService.js","names":["axios","PropTypes","logFrontendAuthError","camelCaseObject","ensureDefinedConfig","createJwtTokenProviderInterceptor","createCsrfTokenProviderInterceptor","createProcessAxiosRequestErrorInterceptor","AxiosJwtTokenService","AxiosCsrfTokenService","configureCache","optionsPropTypes","config","shape","BASE_URL","string","isRequired","LMS_BASE_URL","LOGIN_URL","LOGOUT_URL","REFRESH_ACCESS_TOKEN_ENDPOINT","ACCESS_TOKEN_COOKIE_NAME","CSRF_TOKEN_API_PATH","loggingService","logError","func","logInfo","AxiosJwtAuthService","options","authenticatedHttpClient","httpClient","cachedAuthenticatedHttpClient","cachedHttpClient","authenticatedUser","checkPropTypes","jwtTokenService","csrfTokenService","addAuthenticationToHttpClient","create","then","cachedAxiosClient","e","message","middleware","applyMiddleware","clients","forEach","middlewareFn","client","error","useCache","redirectUrl","encodeURIComponent","global","location","assign","getLoginRedirectUrl","getLogoutRedirectUrl","authUser","getJwtToken","forceRefresh","decodedAccessToken","setAuthenticatedUser","email","userId","user_id","username","preferred_username","roles","administrator","name","getAuthenticatedUser","fetchAuthenticatedUser","isRedirectFromLoginPage","document","referrer","startsWith","redirectLoopError","Error","redirectToLogin","unauthorizedError","isRedirecting","user","get","response","data","newHttpClient","Object","defaults","withCredentials","refreshAccessTokenInterceptor","shouldSkip","axiosRequestConfig","isPublic","attachCsrfTokenInterceptor","method","isCsrfExempt","CSRF_PROTECTED_METHODS","includes","processAxiosRequestErrorInterceptor","interceptors","request","use"],"sources":["../../src/auth/AxiosJwtAuthService.js"],"sourcesContent":["import axios from 'axios';\nimport PropTypes from 'prop-types';\nimport { logFrontendAuthError } from './utils';\nimport { camelCaseObject, ensureDefinedConfig } from '../utils';\nimport createJwtTokenProviderInterceptor from './interceptors/createJwtTokenProviderInterceptor';\nimport createCsrfTokenProviderInterceptor from './interceptors/createCsrfTokenProviderInterceptor';\nimport createProcessAxiosRequestErrorInterceptor from './interceptors/createProcessAxiosRequestErrorInterceptor';\nimport AxiosJwtTokenService from './AxiosJwtTokenService';\nimport AxiosCsrfTokenService from './AxiosCsrfTokenService';\nimport configureCache from './LocalForageCache';\n\nconst optionsPropTypes = {\n config: PropTypes.shape({\n BASE_URL: PropTypes.string.isRequired,\n LMS_BASE_URL: PropTypes.string.isRequired,\n LOGIN_URL: PropTypes.string.isRequired,\n LOGOUT_URL: PropTypes.string.isRequired,\n REFRESH_ACCESS_TOKEN_ENDPOINT: PropTypes.string.isRequired,\n ACCESS_TOKEN_COOKIE_NAME: PropTypes.string.isRequired,\n CSRF_TOKEN_API_PATH: PropTypes.string.isRequired,\n }).isRequired,\n loggingService: PropTypes.shape({\n logError: PropTypes.func.isRequired,\n logInfo: PropTypes.func.isRequired,\n }).isRequired,\n};\n\n/**\n * @implements {AuthService}\n * @memberof module:Auth\n */\nclass AxiosJwtAuthService {\n /**\n * @param {Object} options\n * @param {Object} options.config\n * @param {string} options.config.BASE_URL\n * @param {string} options.config.LMS_BASE_URL\n * @param {string} options.config.LOGIN_URL\n * @param {string} options.config.LOGOUT_URL\n * @param {string} options.config.REFRESH_ACCESS_TOKEN_ENDPOINT\n * @param {string} options.config.ACCESS_TOKEN_COOKIE_NAME\n * @param {string} options.config.CSRF_TOKEN_API_PATH\n * @param {Object} options.loggingService requires logError and logInfo methods\n */\n constructor(options) {\n this.authenticatedHttpClient = null;\n this.httpClient = null;\n this.cachedAuthenticatedHttpClient = null;\n this.cachedHttpClient = null;\n this.authenticatedUser = null;\n\n ensureDefinedConfig(options, 'AuthService');\n PropTypes.checkPropTypes(optionsPropTypes, options, 'options', 'AuthService');\n\n this.config = options.config;\n this.loggingService = options.loggingService;\n this.jwtTokenService = new AxiosJwtTokenService(\n this.loggingService,\n this.config.ACCESS_TOKEN_COOKIE_NAME,\n this.config.REFRESH_ACCESS_TOKEN_ENDPOINT,\n );\n this.csrfTokenService = new AxiosCsrfTokenService(this.config.CSRF_TOKEN_API_PATH);\n this.authenticatedHttpClient = this.addAuthenticationToHttpClient(axios.create());\n this.httpClient = axios.create();\n configureCache()\n .then((cachedAxiosClient) => {\n this.cachedAuthenticatedHttpClient = this.addAuthenticationToHttpClient(cachedAxiosClient);\n this.cachedHttpClient = cachedAxiosClient;\n })\n .catch((e) => {\n // fallback to non-cached HTTP clients and log error\n this.cachedAuthenticatedHttpClient = this.authenticatedHttpClient;\n this.cachedHttpClient = this.httpClient;\n logFrontendAuthError(this.loggingService, `configureCache failed with error: ${e.message}`);\n }).finally(() => {\n this.middleware = options.middleware;\n this.applyMiddleware(options.middleware);\n });\n }\n\n /**\n * Applies middleware to the axios instances in this service.\n *\n * @param {Array} middleware Middleware to apply.\n */\n applyMiddleware(middleware = []) {\n const clients = [\n this.authenticatedHttpClient, this.httpClient,\n this.cachedAuthenticatedHttpClient, this.cachedHttpClient,\n ];\n try {\n (middleware).forEach((middlewareFn) => {\n clients.forEach((client) => client && middlewareFn(client));\n });\n } catch (error) {\n logFrontendAuthError(this.loggingService, error);\n throw error;\n }\n }\n\n /**\n * Gets the authenticated HTTP client for the service. This is an axios instance.\n *\n * @param {Object} [options] Optional options for how the HTTP client should be configured.\n * @param {boolean} [options.useCache] Whether to use front end caching for all requests made\n * with the returned client.\n *\n * @returns {HttpClient} A configured axios http client which can be used for authenticated\n * requests.\n */\n getAuthenticatedHttpClient(options = {}) {\n if (options.useCache) {\n return this.cachedAuthenticatedHttpClient;\n }\n\n return this.authenticatedHttpClient;\n }\n\n /**\n * Gets the unauthenticated HTTP client for the service. This is an axios instance.\n *\n * @param {Object} [options] Optional options for how the HTTP client should be configured.\n * @param {boolean} [options.useCache] Whether to use front end caching for all requests made\n * with the returned client.\n * @returns {HttpClient} A configured axios http client.\n */\n getHttpClient(options = {}) {\n if (options.useCache) {\n return this.cachedHttpClient;\n }\n\n return this.httpClient;\n }\n\n /**\n * Used primarily for testing.\n *\n * @ignore\n */\n getJwtTokenService() {\n return this.jwtTokenService;\n }\n\n /**\n * Used primarily for testing.\n *\n * @ignore\n */\n getCsrfTokenService() {\n return this.csrfTokenService;\n }\n\n /**\n * Builds a URL to the login page with a post-login redirect URL attached as a query parameter.\n *\n * ```\n * const url = getLoginRedirectUrl('http://localhost/mypage');\n * console.log(url); // http://localhost/login?next=http%3A%2F%2Flocalhost%2Fmypage\n * ```\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging in.\n */\n getLoginRedirectUrl(redirectUrl = this.config.BASE_URL) {\n return `${this.config.LOGIN_URL}?next=${encodeURIComponent(redirectUrl)}`;\n }\n\n /**\n * Redirects the user to the login page.\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging in.\n */\n redirectToLogin(redirectUrl = this.config.BASE_URL) {\n global.location.assign(this.getLoginRedirectUrl(redirectUrl));\n }\n\n /**\n * Builds a URL to the logout page with a post-logout redirect URL attached as a query parameter.\n *\n * ```\n * const url = getLogoutRedirectUrl('http://localhost/mypage');\n * console.log(url); // http://localhost/logout?next=http%3A%2F%2Flocalhost%2Fmypage\n * ```\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging out.\n */\n getLogoutRedirectUrl(redirectUrl = this.config.BASE_URL) {\n return `${this.config.LOGOUT_URL}?redirect_url=${encodeURIComponent(redirectUrl)}`;\n }\n\n /**\n * Redirects the user to the logout page.\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging out.\n */\n redirectToLogout(redirectUrl = this.config.BASE_URL) {\n global.location.assign(this.getLogoutRedirectUrl(redirectUrl));\n }\n\n /**\n * If it exists, returns the user data representing the currently authenticated user. If the\n * user is anonymous, returns null.\n *\n * @returns {UserData|null}\n */\n getAuthenticatedUser() {\n return this.authenticatedUser;\n }\n\n /**\n * Sets the authenticated user to the provided value.\n *\n * @param {UserData} authUser\n */\n setAuthenticatedUser(authUser) {\n this.authenticatedUser = authUser;\n }\n\n /**\n * Reads the authenticated user's access token. Resolves to null if the user is\n * unauthenticated.\n *\n * @returns {Promise<UserData>|Promise<null>} Resolves to the user's access token if they are\n * logged in.\n */\n async fetchAuthenticatedUser(options = {}) {\n const decodedAccessToken = await this.jwtTokenService.getJwtToken(options.forceRefresh || false);\n\n if (decodedAccessToken !== null) {\n this.setAuthenticatedUser({\n email: decodedAccessToken.email,\n userId: decodedAccessToken.user_id,\n username: decodedAccessToken.preferred_username,\n roles: decodedAccessToken.roles || [],\n administrator: decodedAccessToken.administrator,\n name: decodedAccessToken.name,\n });\n } else {\n this.setAuthenticatedUser(null);\n }\n\n return this.getAuthenticatedUser();\n }\n\n /**\n * Ensures a user is authenticated. It will redirect to login when not\n * authenticated.\n *\n * @param {string} [redirectUrl=config.BASE_URL] to return user after login when not\n * authenticated.\n * @returns {Promise<UserData>}\n */\n async ensureAuthenticatedUser(redirectUrl = this.config.BASE_URL) {\n await this.fetchAuthenticatedUser();\n\n if (this.getAuthenticatedUser() === null) {\n const isRedirectFromLoginPage = global.document.referrer\n && global.document.referrer.startsWith(this.config.LOGIN_URL);\n\n if (isRedirectFromLoginPage) {\n const redirectLoopError = new Error('Redirect from login page. Rejecting to avoid infinite redirect loop.');\n logFrontendAuthError(this.loggingService, redirectLoopError);\n throw redirectLoopError;\n }\n\n // The user is not authenticated, send them to the login page.\n this.redirectToLogin(redirectUrl);\n\n const unauthorizedError = new Error('Failed to ensure the user is authenticated');\n unauthorizedError.isRedirecting = true;\n throw unauthorizedError;\n }\n\n return this.getAuthenticatedUser();\n }\n\n /**\n * Fetches additional user account information for the authenticated user and merges it into the\n * existing authenticatedUser object, available via getAuthenticatedUser().\n *\n * ```\n * console.log(authenticatedUser); // Will be sparse and only contain basic information.\n * await hydrateAuthenticatedUser()\n * const authenticatedUser = getAuthenticatedUser();\n * console.log(authenticatedUser); // Will contain additional user information\n * ```\n *\n * @returns {Promise<null>}\n */\n async hydrateAuthenticatedUser() {\n const user = this.getAuthenticatedUser();\n if (user !== null) {\n const response = await this.authenticatedHttpClient\n .get(`${this.config.LMS_BASE_URL}/api/user/v1/accounts/${user.username}`);\n this.setAuthenticatedUser({ ...user, ...camelCaseObject(response.data) });\n }\n }\n\n /**\n * Adds authentication defaults and interceptors to an HTTP client instance.\n *\n * @param {HttpClient} newHttpClient\n * @param {Object} config\n * @param {string} [config.REFRESH_ACCESS_TOKEN_ENDPOINT]\n * @param {string} [config.ACCESS_TOKEN_COOKIE_NAME]\n * @param {string} [config.CSRF_TOKEN_API_PATH]\n * @returns {HttpClient} A configured Axios HTTP client.\n */\n addAuthenticationToHttpClient(newHttpClient) {\n const httpClient = Object.create(newHttpClient);\n // Set withCredentials to true. Enables cross-site Access-Control requests\n // to be made using cookies, authorization headers or TLS client\n // certificates. More on MDN:\n // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials\n httpClient.defaults.withCredentials = true;\n\n // Axios interceptors\n\n // The JWT access token interceptor attempts to refresh the user's jwt token\n // before any request unless the isPublic flag is set on the request config.\n const refreshAccessTokenInterceptor = createJwtTokenProviderInterceptor({\n jwtTokenService: this.jwtTokenService,\n shouldSkip: axiosRequestConfig => axiosRequestConfig.isPublic,\n });\n // The CSRF token intercepter fetches and caches a csrf token for any post,\n // put, patch, or delete request. That token is then added to the request\n // headers.\n const attachCsrfTokenInterceptor = createCsrfTokenProviderInterceptor({\n csrfTokenService: this.csrfTokenService,\n CSRF_TOKEN_API_PATH: this.config.CSRF_TOKEN_API_PATH,\n shouldSkip: (axiosRequestConfig) => {\n const { method, isCsrfExempt } = axiosRequestConfig;\n const CSRF_PROTECTED_METHODS = ['post', 'put', 'patch', 'delete'];\n return isCsrfExempt || !CSRF_PROTECTED_METHODS.includes(method);\n },\n });\n\n const processAxiosRequestErrorInterceptor = createProcessAxiosRequestErrorInterceptor({\n loggingService: this.loggingService,\n });\n\n // Request interceptors: Axios runs the interceptors in reverse order from\n // how they are listed. After fetching csrf tokens no longer require jwt\n // authentication, it won't matter which happens first. This change is\n // coming soon in edx-platform. Nov. 2019\n httpClient.interceptors.request.use(attachCsrfTokenInterceptor);\n httpClient.interceptors.request.use(refreshAccessTokenInterceptor);\n\n // Response interceptor: moves axios response error data into the error\n // object at error.customAttributes\n httpClient.interceptors.response.use(\n response => response,\n processAxiosRequestErrorInterceptor,\n );\n\n return httpClient;\n }\n}\n\nexport default AxiosJwtAuthService;\n"],"mappings":";;;;;;;;+CACA,oJ;;;;;;;;;;;;AADA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,oBAAT,QAAqC,SAArC;AACA,SAASC,eAAT,EAA0BC,mBAA1B,QAAqD,UAArD;AACA,OAAOC,iCAAP,MAA8C,kDAA9C;AACA,OAAOC,kCAAP,MAA+C,mDAA/C;AACA,OAAOC,yCAAP,MAAsD,0DAAtD;AACA,OAAOC,oBAAP,MAAiC,wBAAjC;AACA,OAAOC,qBAAP,MAAkC,yBAAlC;AACA,OAAOC,cAAP,MAA2B,oBAA3B;AAEA,IAAMC,gBAAgB,GAAG;EACvBC,MAAM,EAAEX,SAAS,CAACY,KAAV,CAAgB;IACtBC,QAAQ,EAAEb,SAAS,CAACc,MAAV,CAAiBC,UADL;IAEtBC,YAAY,EAAEhB,SAAS,CAACc,MAAV,CAAiBC,UAFT;IAGtBE,SAAS,EAAEjB,SAAS,CAACc,MAAV,CAAiBC,UAHN;IAItBG,UAAU,EAAElB,SAAS,CAACc,MAAV,CAAiBC,UAJP;IAKtBI,6BAA6B,EAAEnB,SAAS,CAACc,MAAV,CAAiBC,UAL1B;IAMtBK,wBAAwB,EAAEpB,SAAS,CAACc,MAAV,CAAiBC,UANrB;IAOtBM,mBAAmB,EAAErB,SAAS,CAACc,MAAV,CAAiBC;EAPhB,CAAhB,EAQLA,UAToB;EAUvBO,cAAc,EAAEtB,SAAS,CAACY,KAAV,CAAgB;IAC9BW,QAAQ,EAAEvB,SAAS,CAACwB,IAAV,CAAeT,UADK;IAE9BU,OAAO,EAAEzB,SAAS,CAACwB,IAAV,CAAeT;EAFM,CAAhB,EAGbA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d,mBAAmB,EAAE,KAAKV,MAAL,CAAYU,mBAFmC;QAGpEqE,UAAU,EAAE,oBAACC,kBAAD,EAAwB;UAClC,IAAQG,MAAR,GAAiCH,kBAAjC,CAAQG,MAAR;UAAA,IAAgBC,YAAhB,GAAiCJ,kBAAjC,CAAgBI,YAAhB;UACA,IAAMC,sBAAsB,GAAG,CAAC,MAAD,EAAS,KAAT,EAAgB,OAAhB,EAAyB,QAAzB,CAA/B;UACA,OAAOD,YAAY,IAAI,CAACC,sBAAsB,CAACC,QAAvB,CAAgCH,MAAhC,CAAxB;QACD;MAPmE,CAAD,CAArE;MAUA,IAAMI,mCAAmC,GAAG5F,yCAAyC,CAAC;QACpFgB,cAAc,EAAE,KAAKA;MAD+D,CAAD,CAArF,CA7B2C,CAiC3C;MACA;MACA;MACA;;MACAO,UAAU,CAACsE,YAAX,CAAwBC,OAAxB,CAAgCC,GAAhC,CAAoCR,0BAApC;MACAhE,UAAU,CAACsE,YAAX,CAAwBC,OAAxB,CAAgCC,GAAhC,CAAoCZ,6BAApC,EAtC2C,CAwC3C;MACA;;MACA5D,UAAU,CAACsE,YAAX,CAAwBhB,QAAxB,CAAiCkB,GAAjC,CACE,UAAAlB,QAAQ;QAAA,OAAIA,QAAJ;MAAA,CADV,EAEEe,mCAFF;MAKA,OAAOrE,UAAP;IACD;;;;;;AAGH,eAAeH,mBAAf"}
1
+ {"version":3,"file":"AxiosJwtAuthService.js","names":["_regeneratorRuntime","exports","Op","Object","prototype","hasOwn","hasOwnProperty","defineProperty","obj","key","desc","value","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","create","context","Context","makeInvokeMethod","tryCatch","fn","arg","type","call","ContinueSentinel","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","method","_invoke","AsyncIterator","PromiseImpl","invoke","resolve","reject","record","result","_typeof","__await","then","unwrapped","error","previousPromise","callInvokeWithMethodAndArg","state","Error","doneResult","delegate","delegateResult","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","done","methodName","undefined","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","length","i","displayName","isGeneratorFunction","genFun","ctor","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","keys","val","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","_catch","thrown","delegateYield","asyncGeneratorStep","gen","_next","_throw","_asyncToGenerator","args","arguments","apply","_classCallCheck","instance","Constructor","_defineProperties","target","props","descriptor","_toPropertyKey","_createClass","protoProps","staticProps","_toPrimitive","String","input","hint","prim","toPrimitive","res","Number","axios","PropTypes","logFrontendAuthError","camelCaseObject","ensureDefinedConfig","createJwtTokenProviderInterceptor","createCsrfTokenProviderInterceptor","createProcessAxiosRequestErrorInterceptor","AxiosJwtTokenService","AxiosCsrfTokenService","configureCache","optionsPropTypes","config","shape","BASE_URL","string","isRequired","LMS_BASE_URL","LOGIN_URL","LOGOUT_URL","REFRESH_ACCESS_TOKEN_ENDPOINT","ACCESS_TOKEN_COOKIE_NAME","CSRF_TOKEN_API_PATH","loggingService","logError","func","logInfo","AxiosJwtAuthService","options","_this","authenticatedHttpClient","httpClient","cachedAuthenticatedHttpClient","cachedHttpClient","authenticatedUser","checkPropTypes","jwtTokenService","csrfTokenService","addAuthenticationToHttpClient","cachedAxiosClient","e","concat","message","middleware","applyMiddleware","clients","middlewareFn","client","getAuthenticatedHttpClient","useCache","getHttpClient","getJwtTokenService","getCsrfTokenService","getLoginRedirectUrl","redirectUrl","encodeURIComponent","redirectToLogin","global","location","assign","getLogoutRedirectUrl","redirectToLogout","getAuthenticatedUser","setAuthenticatedUser","authUser","_fetchAuthenticatedUser","_callee","decodedAccessToken","_args","_callee$","_context","getJwtToken","forceRefresh","email","userId","user_id","username","preferred_username","roles","administrator","fetchAuthenticatedUser","_ensureAuthenticatedUser","_callee2","isRedirectFromLoginPage","redirectLoopError","unauthorizedError","_args2","_callee2$","_context2","document","referrer","startsWith","isRedirecting","ensureAuthenticatedUser","_hydrateAuthenticatedUser","_callee3","user","response","_callee3$","_context3","get","_objectSpread","data","hydrateAuthenticatedUser","newHttpClient","defaults","withCredentials","refreshAccessTokenInterceptor","shouldSkip","axiosRequestConfig","isPublic","attachCsrfTokenInterceptor","isCsrfExempt","CSRF_PROTECTED_METHODS","includes","processAxiosRequestErrorInterceptor","interceptors","request","use"],"sources":["../../src/auth/AxiosJwtAuthService.js"],"sourcesContent":["import axios from 'axios';\nimport PropTypes from 'prop-types';\nimport { logFrontendAuthError } from './utils';\nimport { camelCaseObject, ensureDefinedConfig } from '../utils';\nimport createJwtTokenProviderInterceptor from './interceptors/createJwtTokenProviderInterceptor';\nimport createCsrfTokenProviderInterceptor from './interceptors/createCsrfTokenProviderInterceptor';\nimport createProcessAxiosRequestErrorInterceptor from './interceptors/createProcessAxiosRequestErrorInterceptor';\nimport AxiosJwtTokenService from './AxiosJwtTokenService';\nimport AxiosCsrfTokenService from './AxiosCsrfTokenService';\nimport configureCache from './LocalForageCache';\n\nconst optionsPropTypes = {\n config: PropTypes.shape({\n BASE_URL: PropTypes.string.isRequired,\n LMS_BASE_URL: PropTypes.string.isRequired,\n LOGIN_URL: PropTypes.string.isRequired,\n LOGOUT_URL: PropTypes.string.isRequired,\n REFRESH_ACCESS_TOKEN_ENDPOINT: PropTypes.string.isRequired,\n ACCESS_TOKEN_COOKIE_NAME: PropTypes.string.isRequired,\n CSRF_TOKEN_API_PATH: PropTypes.string.isRequired,\n }).isRequired,\n loggingService: PropTypes.shape({\n logError: PropTypes.func.isRequired,\n logInfo: PropTypes.func.isRequired,\n }).isRequired,\n};\n\n/**\n * @implements {AuthService}\n * @memberof module:Auth\n */\nclass AxiosJwtAuthService {\n /**\n * @param {Object} options\n * @param {Object} options.config\n * @param {string} options.config.BASE_URL\n * @param {string} options.config.LMS_BASE_URL\n * @param {string} options.config.LOGIN_URL\n * @param {string} options.config.LOGOUT_URL\n * @param {string} options.config.REFRESH_ACCESS_TOKEN_ENDPOINT\n * @param {string} options.config.ACCESS_TOKEN_COOKIE_NAME\n * @param {string} options.config.CSRF_TOKEN_API_PATH\n * @param {Object} options.loggingService requires logError and logInfo methods\n */\n constructor(options) {\n this.authenticatedHttpClient = null;\n this.httpClient = null;\n this.cachedAuthenticatedHttpClient = null;\n this.cachedHttpClient = null;\n this.authenticatedUser = null;\n\n ensureDefinedConfig(options, 'AuthService');\n PropTypes.checkPropTypes(optionsPropTypes, options, 'options', 'AuthService');\n\n this.config = options.config;\n this.loggingService = options.loggingService;\n this.jwtTokenService = new AxiosJwtTokenService(\n this.loggingService,\n this.config.ACCESS_TOKEN_COOKIE_NAME,\n this.config.REFRESH_ACCESS_TOKEN_ENDPOINT,\n );\n this.csrfTokenService = new AxiosCsrfTokenService(this.config.CSRF_TOKEN_API_PATH);\n this.authenticatedHttpClient = this.addAuthenticationToHttpClient(axios.create());\n this.httpClient = axios.create();\n configureCache()\n .then((cachedAxiosClient) => {\n this.cachedAuthenticatedHttpClient = this.addAuthenticationToHttpClient(cachedAxiosClient);\n this.cachedHttpClient = cachedAxiosClient;\n })\n .catch((e) => {\n // fallback to non-cached HTTP clients and log error\n this.cachedAuthenticatedHttpClient = this.authenticatedHttpClient;\n this.cachedHttpClient = this.httpClient;\n logFrontendAuthError(this.loggingService, `configureCache failed with error: ${e.message}`);\n }).finally(() => {\n this.middleware = options.middleware;\n this.applyMiddleware(options.middleware);\n });\n }\n\n /**\n * Applies middleware to the axios instances in this service.\n *\n * @param {Array} middleware Middleware to apply.\n */\n applyMiddleware(middleware = []) {\n const clients = [\n this.authenticatedHttpClient, this.httpClient,\n this.cachedAuthenticatedHttpClient, this.cachedHttpClient,\n ];\n try {\n (middleware).forEach((middlewareFn) => {\n clients.forEach((client) => client && middlewareFn(client));\n });\n } catch (error) {\n logFrontendAuthError(this.loggingService, error);\n throw error;\n }\n }\n\n /**\n * Gets the authenticated HTTP client for the service. This is an axios instance.\n *\n * @param {Object} [options] Optional options for how the HTTP client should be configured.\n * @param {boolean} [options.useCache] Whether to use front end caching for all requests made\n * with the returned client.\n *\n * @returns {HttpClient} A configured axios http client which can be used for authenticated\n * requests.\n */\n getAuthenticatedHttpClient(options = {}) {\n if (options.useCache) {\n return this.cachedAuthenticatedHttpClient;\n }\n\n return this.authenticatedHttpClient;\n }\n\n /**\n * Gets the unauthenticated HTTP client for the service. This is an axios instance.\n *\n * @param {Object} [options] Optional options for how the HTTP client should be configured.\n * @param {boolean} [options.useCache] Whether to use front end caching for all requests made\n * with the returned client.\n * @returns {HttpClient} A configured axios http client.\n */\n getHttpClient(options = {}) {\n if (options.useCache) {\n return this.cachedHttpClient;\n }\n\n return this.httpClient;\n }\n\n /**\n * Used primarily for testing.\n *\n * @ignore\n */\n getJwtTokenService() {\n return this.jwtTokenService;\n }\n\n /**\n * Used primarily for testing.\n *\n * @ignore\n */\n getCsrfTokenService() {\n return this.csrfTokenService;\n }\n\n /**\n * Builds a URL to the login page with a post-login redirect URL attached as a query parameter.\n *\n * ```\n * const url = getLoginRedirectUrl('http://localhost/mypage');\n * console.log(url); // http://localhost/login?next=http%3A%2F%2Flocalhost%2Fmypage\n * ```\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging in.\n */\n getLoginRedirectUrl(redirectUrl = this.config.BASE_URL) {\n return `${this.config.LOGIN_URL}?next=${encodeURIComponent(redirectUrl)}`;\n }\n\n /**\n * Redirects the user to the login page.\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging in.\n */\n redirectToLogin(redirectUrl = this.config.BASE_URL) {\n global.location.assign(this.getLoginRedirectUrl(redirectUrl));\n }\n\n /**\n * Builds a URL to the logout page with a post-logout redirect URL attached as a query parameter.\n *\n * ```\n * const url = getLogoutRedirectUrl('http://localhost/mypage');\n * console.log(url); // http://localhost/logout?next=http%3A%2F%2Flocalhost%2Fmypage\n * ```\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging out.\n */\n getLogoutRedirectUrl(redirectUrl = this.config.BASE_URL) {\n return `${this.config.LOGOUT_URL}?redirect_url=${encodeURIComponent(redirectUrl)}`;\n }\n\n /**\n * Redirects the user to the logout page.\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging out.\n */\n redirectToLogout(redirectUrl = this.config.BASE_URL) {\n global.location.assign(this.getLogoutRedirectUrl(redirectUrl));\n }\n\n /**\n * If it exists, returns the user data representing the currently authenticated user. If the\n * user is anonymous, returns null.\n *\n * @returns {UserData|null}\n */\n getAuthenticatedUser() {\n return this.authenticatedUser;\n }\n\n /**\n * Sets the authenticated user to the provided value.\n *\n * @param {UserData} authUser\n */\n setAuthenticatedUser(authUser) {\n this.authenticatedUser = authUser;\n }\n\n /**\n * Reads the authenticated user's access token. Resolves to null if the user is\n * unauthenticated.\n *\n * @returns {Promise<UserData>|Promise<null>} Resolves to the user's access token if they are\n * logged in.\n */\n async fetchAuthenticatedUser(options = {}) {\n const decodedAccessToken = await this.jwtTokenService.getJwtToken(options.forceRefresh || false);\n\n if (decodedAccessToken !== null) {\n this.setAuthenticatedUser({\n email: decodedAccessToken.email,\n userId: decodedAccessToken.user_id,\n username: decodedAccessToken.preferred_username,\n roles: decodedAccessToken.roles || [],\n administrator: decodedAccessToken.administrator,\n name: decodedAccessToken.name,\n });\n } else {\n this.setAuthenticatedUser(null);\n }\n\n return this.getAuthenticatedUser();\n }\n\n /**\n * Ensures a user is authenticated. It will redirect to login when not\n * authenticated.\n *\n * @param {string} [redirectUrl=config.BASE_URL] to return user after login when not\n * authenticated.\n * @returns {Promise<UserData>}\n */\n async ensureAuthenticatedUser(redirectUrl = this.config.BASE_URL) {\n await this.fetchAuthenticatedUser();\n\n if (this.getAuthenticatedUser() === null) {\n const isRedirectFromLoginPage = global.document.referrer\n && global.document.referrer.startsWith(this.config.LOGIN_URL);\n\n if (isRedirectFromLoginPage) {\n const redirectLoopError = new Error('Redirect from login page. Rejecting to avoid infinite redirect loop.');\n logFrontendAuthError(this.loggingService, redirectLoopError);\n throw redirectLoopError;\n }\n\n // The user is not authenticated, send them to the login page.\n this.redirectToLogin(redirectUrl);\n\n const unauthorizedError = new Error('Failed to ensure the user is authenticated');\n unauthorizedError.isRedirecting = true;\n throw unauthorizedError;\n }\n\n return this.getAuthenticatedUser();\n }\n\n /**\n * Fetches additional user account information for the authenticated user and merges it into the\n * existing authenticatedUser object, available via getAuthenticatedUser().\n *\n * ```\n * console.log(authenticatedUser); // Will be sparse and only contain basic information.\n * await hydrateAuthenticatedUser()\n * const authenticatedUser = getAuthenticatedUser();\n * console.log(authenticatedUser); // Will contain additional user information\n * ```\n *\n * @returns {Promise<null>}\n */\n async hydrateAuthenticatedUser() {\n const user = this.getAuthenticatedUser();\n if (user !== null) {\n const response = await this.authenticatedHttpClient\n .get(`${this.config.LMS_BASE_URL}/api/user/v1/accounts/${user.username}`);\n this.setAuthenticatedUser({ ...user, ...camelCaseObject(response.data) });\n }\n }\n\n /**\n * Adds authentication defaults and interceptors to an HTTP client instance.\n *\n * @param {HttpClient} newHttpClient\n * @param {Object} config\n * @param {string} [config.REFRESH_ACCESS_TOKEN_ENDPOINT]\n * @param {string} [config.ACCESS_TOKEN_COOKIE_NAME]\n * @param {string} [config.CSRF_TOKEN_API_PATH]\n * @returns {HttpClient} A configured Axios HTTP client.\n */\n addAuthenticationToHttpClient(newHttpClient) {\n const httpClient = Object.create(newHttpClient);\n // Set withCredentials to true. Enables cross-site Access-Control requests\n // to be made using cookies, authorization headers or TLS client\n // certificates. More on MDN:\n // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials\n httpClient.defaults.withCredentials = true;\n\n // Axios interceptors\n\n // The JWT access token interceptor attempts to refresh the user's jwt token\n // before any request unless the isPublic flag is set on the request config.\n const refreshAccessTokenInterceptor = createJwtTokenProviderInterceptor({\n jwtTokenService: this.jwtTokenService,\n shouldSkip: axiosRequestConfig => axiosRequestConfig.isPublic,\n });\n // The CSRF token intercepter fetches and caches a csrf token for any post,\n // put, patch, or delete request. That token is then added to the request\n // headers.\n const attachCsrfTokenInterceptor = createCsrfTokenProviderInterceptor({\n csrfTokenService: this.csrfTokenService,\n CSRF_TOKEN_API_PATH: this.config.CSRF_TOKEN_API_PATH,\n shouldSkip: (axiosRequestConfig) => {\n const { method, isCsrfExempt } = axiosRequestConfig;\n const CSRF_PROTECTED_METHODS = ['post', 'put', 'patch', 'delete'];\n return isCsrfExempt || !CSRF_PROTECTED_METHODS.includes(method);\n },\n });\n\n const processAxiosRequestErrorInterceptor = createProcessAxiosRequestErrorInterceptor({\n loggingService: this.loggingService,\n });\n\n // Request interceptors: Axios runs the interceptors in reverse order from\n // how they are listed. After fetching csrf tokens no longer require jwt\n // authentication, it won't matter which happens first. This change is\n // coming soon in edx-platform. Nov. 2019\n httpClient.interceptors.request.use(attachCsrfTokenInterceptor);\n httpClient.interceptors.request.use(refreshAccessTokenInterceptor);\n\n // Response interceptor: moves axios response error data into the error\n // object at error.customAttributes\n httpClient.interceptors.response.use(\n response => response,\n processAxiosRequestErrorInterceptor,\n );\n\n return httpClient;\n }\n}\n\nexport default AxiosJwtAuthService;\n"],"mappings":";;;;+CACA,qJAAAA,mBAAA,YAAAA,oBAAA,WAAAC,OAAA,SAAAA,OAAA,OAAAC,EAAA,GAAAC,MAAA,CAAAC,SAAA,EAAAC,MAAA,GAAAH,EAAA,CAAAI,cAAA,EAAAC,cAAA,GAAAJ,MAAA,CAAAI,cAAA,cAAAC,GAAA,EAAAC,GAAA,EAAAC,IAAA,IAAAF,GAAA,CAAAC,GAAA,IAAAC,IAAA,CAAAC,KAAA,KAAAC,OAAA,wBAAAC,MAAA,GAAAA,MAAA,OAAAC,cAAA,GAAA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Y,GAAKH,kBAAkB,CAAnCG,YAAY;UAC5B,IAAMC,sBAAsB,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC;UACjE,OAAOD,YAAY,IAAI,CAACC,sBAAsB,CAACC,QAAQ,CAACrO,MAAM,CAAC;QACjE;MACF,CAAC,CAAC;MAEF,IAAMsO,mCAAmC,GAAG5G,yCAAyC,CAAC;QACpFgB,cAAc,EAAE,IAAI,CAACA;MACvB,CAAC,CAAC;;MAEF;MACA;MACA;MACA;MACAQ,UAAU,CAACqF,YAAY,CAACC,OAAO,CAACC,GAAG,CAACP,0BAA0B,CAAC;MAC/DhF,UAAU,CAACqF,YAAY,CAACC,OAAO,CAACC,GAAG,CAACX,6BAA6B,CAAC;;MAElE;MACA;MACA5E,UAAU,CAACqF,YAAY,CAACnB,QAAQ,CAACqB,GAAG,CAClC,UAAArB,QAAQ;QAAA,OAAIA,QAAQ;MAAA,GACpBkB,mCAAmC,CACpC;MAED,OAAOpF,UAAU;IACnB;EAAC;EAAA,OAAAJ,mBAAA;AAAA;AAGH,eAAeA,mBAAmB"}
@@ -1,37 +1,30 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
-
3
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
4
-
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
5
3
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
6
-
7
4
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
8
-
9
5
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10
-
11
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
12
-
6
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
13
7
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
14
-
8
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
9
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
15
10
  import Cookies from 'universal-cookie';
16
11
  import jwtDecode from 'jwt-decode';
17
12
  import axios from 'axios';
18
13
  import { logFrontendAuthError, processAxiosErrorAndThrow } from './utils';
19
14
  import createRetryInterceptor from './interceptors/createRetryInterceptor';
20
-
21
15
  var AxiosJwtTokenService = /*#__PURE__*/function () {
22
16
  function AxiosJwtTokenService(loggingService, tokenCookieName, tokenRefreshEndpoint) {
23
17
  _classCallCheck(this, AxiosJwtTokenService);
24
-
25
18
  this.loggingService = loggingService;
26
19
  this.tokenCookieName = tokenCookieName;
27
20
  this.tokenRefreshEndpoint = tokenRefreshEndpoint;
28
- this.httpClient = axios.create(); // Set withCredentials to true. Enables cross-site Access-Control requests
21
+ this.httpClient = axios.create();
22
+ // Set withCredentials to true. Enables cross-site Access-Control requests
29
23
  // to be made using cookies, authorization headers or TLS client
30
24
  // certificates. More on MDN:
31
25
  // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials
32
-
33
- this.httpClient.defaults.withCredentials = true; // Add retries to this axios instance
34
-
26
+ this.httpClient.defaults.withCredentials = true;
27
+ // Add retries to this axios instance
35
28
  this.httpClient.interceptors.response.use(function (response) {
36
29
  return response;
37
30
  }, createRetryInterceptor({
@@ -40,7 +33,6 @@ var AxiosJwtTokenService = /*#__PURE__*/function () {
40
33
  this.cookies = new Cookies();
41
34
  this.refreshRequestPromises = {};
42
35
  }
43
-
44
36
  _createClass(AxiosJwtTokenService, [{
45
37
  key: "getHttpClient",
46
38
  value: function getHttpClient() {
@@ -50,7 +42,6 @@ var AxiosJwtTokenService = /*#__PURE__*/function () {
50
42
  key: "decodeJwtCookie",
51
43
  value: function decodeJwtCookie() {
52
44
  var cookieValue = this.cookies.get(this.tokenCookieName);
53
-
54
45
  if (cookieValue) {
55
46
  try {
56
47
  return jwtDecode(cookieValue);
@@ -63,113 +54,89 @@ var AxiosJwtTokenService = /*#__PURE__*/function () {
63
54
  throw error;
64
55
  }
65
56
  }
66
-
67
57
  return null;
68
58
  }
69
59
  }, {
70
60
  key: "refresh",
71
61
  value: function refresh() {
72
62
  var _this = this;
73
-
74
63
  var responseServerEpochSeconds = 0;
75
-
76
64
  if (this.refreshRequestPromises[this.tokenCookieName] === undefined) {
77
65
  var makeRefreshRequest = /*#__PURE__*/function () {
78
66
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
79
67
  var axiosResponse, userIsUnauthenticated, _decodedJwtToken, browserEpochSeconds, browserDriftSeconds, decodedJwtToken, error;
80
-
81
68
  return _regeneratorRuntime().wrap(function _callee$(_context) {
82
- while (1) {
83
- switch (_context.prev = _context.next) {
84
- case 0:
85
- _context.prev = 0;
86
- _context.prev = 1;
87
- _context.next = 4;
88
- return _this.httpClient.post(_this.tokenRefreshEndpoint);
89
-
90
- case 4:
91
- axiosResponse = _context.sent;
92
-
93
- // eslint-disable-next-line max-len
94
- if (axiosResponse.data && axiosResponse.data.response_epoch_seconds) {
95
- responseServerEpochSeconds = axiosResponse.data.response_epoch_seconds;
96
- }
97
-
98
- _context.next = 11;
69
+ while (1) switch (_context.prev = _context.next) {
70
+ case 0:
71
+ _context.prev = 0;
72
+ _context.prev = 1;
73
+ _context.next = 4;
74
+ return _this.httpClient.post(_this.tokenRefreshEndpoint);
75
+ case 4:
76
+ axiosResponse = _context.sent;
77
+ // eslint-disable-next-line max-len
78
+ if (axiosResponse.data && axiosResponse.data.response_epoch_seconds) {
79
+ responseServerEpochSeconds = axiosResponse.data.response_epoch_seconds;
80
+ }
81
+ _context.next = 11;
82
+ break;
83
+ case 8:
84
+ _context.prev = 8;
85
+ _context.t0 = _context["catch"](1);
86
+ processAxiosErrorAndThrow(_context.t0);
87
+ case 11:
88
+ _context.next = 21;
89
+ break;
90
+ case 13:
91
+ _context.prev = 13;
92
+ _context.t1 = _context["catch"](0);
93
+ userIsUnauthenticated = _context.t1.response && _context.t1.response.status === 401;
94
+ if (!userIsUnauthenticated) {
95
+ _context.next = 20;
99
96
  break;
100
-
101
- case 8:
102
- _context.prev = 8;
103
- _context.t0 = _context["catch"](1);
104
- processAxiosErrorAndThrow(_context.t0);
105
-
106
- case 11:
107
- _context.next = 21;
97
+ }
98
+ // Clean up the cookie if it exists to eliminate any situation
99
+ // where the cookie is not expired but the jwt is expired.
100
+ _this.cookies.remove(_this.tokenCookieName);
101
+ _decodedJwtToken = null;
102
+ return _context.abrupt("return", _decodedJwtToken);
103
+ case 20:
104
+ throw _context.t1;
105
+ case 21:
106
+ browserEpochSeconds = Date.now() / 1000;
107
+ browserDriftSeconds = responseServerEpochSeconds > 0 ? Math.abs(browserEpochSeconds - responseServerEpochSeconds) : null;
108
+ decodedJwtToken = _this.decodeJwtCookie();
109
+ if (decodedJwtToken) {
110
+ _context.next = 28;
108
111
  break;
109
-
110
- case 13:
111
- _context.prev = 13;
112
- _context.t1 = _context["catch"](0);
113
- userIsUnauthenticated = _context.t1.response && _context.t1.response.status === 401;
114
-
115
- if (!userIsUnauthenticated) {
116
- _context.next = 20;
117
- break;
118
- }
119
-
120
- // Clean up the cookie if it exists to eliminate any situation
121
- // where the cookie is not expired but the jwt is expired.
122
- _this.cookies.remove(_this.tokenCookieName);
123
-
124
- _decodedJwtToken = null;
125
- return _context.abrupt("return", _decodedJwtToken);
126
-
127
- case 20:
128
- throw _context.t1;
129
-
130
- case 21:
131
- browserEpochSeconds = Date.now() / 1000;
132
- browserDriftSeconds = responseServerEpochSeconds > 0 ? Math.abs(browserEpochSeconds - responseServerEpochSeconds) : null;
133
- decodedJwtToken = _this.decodeJwtCookie();
134
-
135
- if (decodedJwtToken) {
136
- _context.next = 28;
137
- break;
138
- }
139
-
140
- // This is an unexpected case. The refresh endpoint should set the
141
- // cookie that is needed.
142
- // For more details, see:
143
- // docs/decisions/0005-token-null-after-successful-refresh.rst
144
- error = new Error('Access token is still null after successful refresh.');
145
- error.customAttributes = {
146
- axiosResponse: axiosResponse,
147
- browserDriftSeconds: browserDriftSeconds,
148
- browserEpochSeconds: browserEpochSeconds
149
- };
150
- throw error;
151
-
152
- case 28:
153
- return _context.abrupt("return", decodedJwtToken);
154
-
155
- case 29:
156
- case "end":
157
- return _context.stop();
158
- }
112
+ }
113
+ // This is an unexpected case. The refresh endpoint should set the
114
+ // cookie that is needed.
115
+ // For more details, see:
116
+ // docs/decisions/0005-token-null-after-successful-refresh.rst
117
+ error = new Error('Access token is still null after successful refresh.');
118
+ error.customAttributes = {
119
+ axiosResponse: axiosResponse,
120
+ browserDriftSeconds: browserDriftSeconds,
121
+ browserEpochSeconds: browserEpochSeconds
122
+ };
123
+ throw error;
124
+ case 28:
125
+ return _context.abrupt("return", decodedJwtToken);
126
+ case 29:
127
+ case "end":
128
+ return _context.stop();
159
129
  }
160
130
  }, _callee, null, [[0, 13], [1, 8]]);
161
131
  }));
162
-
163
132
  return function makeRefreshRequest() {
164
133
  return _ref.apply(this, arguments);
165
134
  };
166
135
  }();
167
-
168
136
  this.refreshRequestPromises[this.tokenCookieName] = makeRefreshRequest()["finally"](function () {
169
137
  delete _this.refreshRequestPromises[_this.tokenCookieName];
170
138
  });
171
139
  }
172
-
173
140
  return this.refreshRequestPromises[this.tokenCookieName];
174
141
  }
175
142
  }, {
@@ -177,61 +144,49 @@ var AxiosJwtTokenService = /*#__PURE__*/function () {
177
144
  value: function () {
178
145
  var _getJwtToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
179
146
  var forceRefresh,
180
- decodedJwtToken,
181
- _args2 = arguments;
147
+ decodedJwtToken,
148
+ _args2 = arguments;
182
149
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
183
- while (1) {
184
- switch (_context2.prev = _context2.next) {
185
- case 0:
186
- forceRefresh = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : false;
187
- _context2.prev = 1;
188
- decodedJwtToken = this.decodeJwtCookie(this.tokenCookieName);
189
-
190
- if (!(!AxiosJwtTokenService.isTokenExpired(decodedJwtToken) && !forceRefresh)) {
191
- _context2.next = 5;
192
- break;
193
- }
194
-
195
- return _context2.abrupt("return", decodedJwtToken);
196
-
197
- case 5:
198
- _context2.next = 10;
150
+ while (1) switch (_context2.prev = _context2.next) {
151
+ case 0:
152
+ forceRefresh = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : false;
153
+ _context2.prev = 1;
154
+ decodedJwtToken = this.decodeJwtCookie(this.tokenCookieName);
155
+ if (!(!AxiosJwtTokenService.isTokenExpired(decodedJwtToken) && !forceRefresh)) {
156
+ _context2.next = 5;
199
157
  break;
200
-
201
- case 7:
202
- _context2.prev = 7;
203
- _context2.t0 = _context2["catch"](1);
204
- // Log unexpected error and continue with attempt to refresh it.
205
- // TODO: Fix these. They're still using loggingService as a singleton.
206
- logFrontendAuthError(this.loggingService, _context2.t0);
207
-
208
- case 10:
209
- _context2.prev = 10;
210
- _context2.next = 13;
211
- return this.refresh();
212
-
213
- case 13:
214
- return _context2.abrupt("return", _context2.sent);
215
-
216
- case 16:
217
- _context2.prev = 16;
218
- _context2.t1 = _context2["catch"](10);
219
- // TODO: Fix these. They're still using loggingService as a singleton.
220
- logFrontendAuthError(this.loggingService, _context2.t1);
221
- throw _context2.t1;
222
-
223
- case 20:
224
- case "end":
225
- return _context2.stop();
226
- }
158
+ }
159
+ return _context2.abrupt("return", decodedJwtToken);
160
+ case 5:
161
+ _context2.next = 10;
162
+ break;
163
+ case 7:
164
+ _context2.prev = 7;
165
+ _context2.t0 = _context2["catch"](1);
166
+ // Log unexpected error and continue with attempt to refresh it.
167
+ // TODO: Fix these. They're still using loggingService as a singleton.
168
+ logFrontendAuthError(this.loggingService, _context2.t0);
169
+ case 10:
170
+ _context2.prev = 10;
171
+ _context2.next = 13;
172
+ return this.refresh();
173
+ case 13:
174
+ return _context2.abrupt("return", _context2.sent);
175
+ case 16:
176
+ _context2.prev = 16;
177
+ _context2.t1 = _context2["catch"](10);
178
+ // TODO: Fix these. They're still using loggingService as a singleton.
179
+ logFrontendAuthError(this.loggingService, _context2.t1);
180
+ throw _context2.t1;
181
+ case 20:
182
+ case "end":
183
+ return _context2.stop();
227
184
  }
228
185
  }, _callee2, this, [[1, 7], [10, 16]]);
229
186
  }));
230
-
231
187
  function getJwtToken() {
232
188
  return _getJwtToken.apply(this, arguments);
233
189
  }
234
-
235
190
  return getJwtToken;
236
191
  }()
237
192
  }], [{
@@ -240,9 +195,7 @@ var AxiosJwtTokenService = /*#__PURE__*/function () {
240
195
  return !token || token.exp < Date.now() / 1000;
241
196
  }
242
197
  }]);
243
-
244
198
  return AxiosJwtTokenService;
245
199
  }();
246
-
247
200
  export { AxiosJwtTokenService as default };
248
201
  //# sourceMappingURL=AxiosJwtTokenService.js.map