{"version":3,"sources":["node_modules/rfc4648/lib/rfc4648.js","node_modules/angular-auth-oidc-client/fesm2022/angular-auth-oidc-client.mjs"],"sourcesContent":["/* eslint-disable @typescript-eslint/strict-boolean-expressions */\n\n// ---------------------------------------------------------------------------\n// Specific encodings\n// ---------------------------------------------------------------------------\nvar base16Encoding = {\n chars: '0123456789ABCDEF',\n bits: 4\n};\nvar base32Encoding = {\n chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567',\n bits: 5\n};\nvar base32HexEncoding = {\n chars: '0123456789ABCDEFGHIJKLMNOPQRSTUV',\n bits: 5\n};\nvar base64Encoding = {\n chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',\n bits: 6\n};\nvar base64UrlEncoding = {\n chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_',\n bits: 6\n};\nvar base16 = {\n parse: function parse(string, opts) {\n return _parse(string.toUpperCase(), base16Encoding, opts);\n },\n stringify: function stringify(data, opts) {\n return _stringify(data, base16Encoding, opts);\n }\n};\nvar base32 = {\n parse: function parse(string, opts) {\n if (opts === void 0) {\n opts = {};\n }\n return _parse(opts.loose ? string.toUpperCase().replace(/0/g, 'O').replace(/1/g, 'L').replace(/8/g, 'B') : string, base32Encoding, opts);\n },\n stringify: function stringify(data, opts) {\n return _stringify(data, base32Encoding, opts);\n }\n};\nvar base32hex = {\n parse: function parse(string, opts) {\n return _parse(string, base32HexEncoding, opts);\n },\n stringify: function stringify(data, opts) {\n return _stringify(data, base32HexEncoding, opts);\n }\n};\nvar base64 = {\n parse: function parse(string, opts) {\n return _parse(string, base64Encoding, opts);\n },\n stringify: function stringify(data, opts) {\n return _stringify(data, base64Encoding, opts);\n }\n};\nvar base64url = {\n parse: function parse(string, opts) {\n return _parse(string, base64UrlEncoding, opts);\n },\n stringify: function stringify(data, opts) {\n return _stringify(data, base64UrlEncoding, opts);\n }\n};\n\n// ---------------------------------------------------------------------------\n// Codec implementation\n// ---------------------------------------------------------------------------\n\nvar codec = {\n parse: _parse,\n stringify: _stringify\n};\nfunction _parse(string, encoding, opts) {\n var _opts$out;\n if (opts === void 0) {\n opts = {};\n }\n // Build the character lookup table:\n if (!encoding.codes) {\n encoding.codes = {};\n for (var i = 0; i < encoding.chars.length; ++i) {\n encoding.codes[encoding.chars[i]] = i;\n }\n }\n\n // The string must have a whole number of bytes:\n if (!opts.loose && string.length * encoding.bits & 7) {\n throw new SyntaxError('Invalid padding');\n }\n\n // Count the padding bytes:\n var end = string.length;\n while (string[end - 1] === '=') {\n --end;\n\n // If we get a whole number of bytes, there is too much padding:\n if (!opts.loose && !((string.length - end) * encoding.bits & 7)) {\n throw new SyntaxError('Invalid padding');\n }\n }\n\n // Allocate the output:\n var out = new ((_opts$out = opts.out) != null ? _opts$out : Uint8Array)(end * encoding.bits / 8 | 0);\n\n // Parse the data:\n var bits = 0; // Number of bits currently in the buffer\n var buffer = 0; // Bits waiting to be written out, MSB first\n var written = 0; // Next byte to write\n for (var _i = 0; _i < end; ++_i) {\n // Read one character from the string:\n var value = encoding.codes[string[_i]];\n if (value === undefined) {\n throw new SyntaxError('Invalid character ' + string[_i]);\n }\n\n // Append the bits to the buffer:\n buffer = buffer << encoding.bits | value;\n bits += encoding.bits;\n\n // Write out some bits if the buffer has a byte's worth:\n if (bits >= 8) {\n bits -= 8;\n out[written++] = 0xff & buffer >> bits;\n }\n }\n\n // Verify that we have received just enough bits:\n if (bits >= encoding.bits || 0xff & buffer << 8 - bits) {\n throw new SyntaxError('Unexpected end of data');\n }\n return out;\n}\nfunction _stringify(data, encoding, opts) {\n if (opts === void 0) {\n opts = {};\n }\n var _opts = opts,\n _opts$pad = _opts.pad,\n pad = _opts$pad === void 0 ? true : _opts$pad;\n var mask = (1 << encoding.bits) - 1;\n var out = '';\n var bits = 0; // Number of bits currently in the buffer\n var buffer = 0; // Bits waiting to be written out, MSB first\n for (var i = 0; i < data.length; ++i) {\n // Slurp data into the buffer:\n buffer = buffer << 8 | 0xff & data[i];\n bits += 8;\n\n // Write out as much as we can:\n while (bits > encoding.bits) {\n bits -= encoding.bits;\n out += encoding.chars[mask & buffer >> bits];\n }\n }\n\n // Partial character:\n if (bits) {\n out += encoding.chars[mask & buffer << encoding.bits - bits];\n }\n\n // Add padding characters until we hit a byte boundary:\n if (pad) {\n while (out.length * encoding.bits & 7) {\n out += '=';\n }\n }\n return out;\n}\nexport { base16, base32, base32hex, base64, base64url, codec };","import { DOCUMENT, isPlatformBrowser, CommonModule } from '@angular/common';\nimport { HttpParams, HttpClient, HttpHeaders, HttpErrorResponse, HttpResponse, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';\nimport * as i0 from '@angular/core';\nimport { InjectionToken, Injectable, inject, NgZone, PLATFORM_ID, isDevMode, RendererFactory2, makeEnvironmentProviders, APP_INITIALIZER, NgModule } from '@angular/core';\nimport { of, forkJoin, ReplaySubject, from, BehaviorSubject, throwError, timer, Observable, Subject, TimeoutError } from 'rxjs';\nimport { map, mergeMap, tap, distinctUntilChanged, switchMap, retryWhen, catchError, retry, concatMap, finalize, take, timeout } from 'rxjs/operators';\nimport { base64url } from 'rfc4648';\nimport { Router } from '@angular/router';\nimport { toSignal } from '@angular/core/rxjs-interop';\nclass OpenIdConfigLoader {}\nclass StsConfigLoader {}\nclass StsConfigStaticLoader {\n constructor(passedConfigs) {\n this.passedConfigs = passedConfigs;\n }\n loadConfigs() {\n if (Array.isArray(this.passedConfigs)) {\n return of(this.passedConfigs);\n }\n return of([this.passedConfigs]);\n }\n}\nclass StsConfigHttpLoader {\n constructor(configs$) {\n this.configs$ = configs$;\n }\n loadConfigs() {\n if (Array.isArray(this.configs$)) {\n return forkJoin(this.configs$);\n }\n const singleConfigOrArray = this.configs$;\n return singleConfigOrArray.pipe(map(value => {\n if (Array.isArray(value)) {\n return value;\n }\n return [value];\n }));\n }\n}\nfunction createStaticLoader(passedConfig) {\n if (!passedConfig?.config) {\n throw new Error('No config provided!');\n }\n return new StsConfigStaticLoader(passedConfig.config);\n}\nconst PASSED_CONFIG = new InjectionToken('PASSED_CONFIG');\n\n/**\n * Implement this class-interface to create a custom logger service.\n */\nlet AbstractLoggerService = /*#__PURE__*/(() => {\n class AbstractLoggerService {\n static {\n this.ɵfac = function AbstractLoggerService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || AbstractLoggerService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: AbstractLoggerService,\n factory: AbstractLoggerService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return AbstractLoggerService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet ConsoleLoggerService = /*#__PURE__*/(() => {\n class ConsoleLoggerService {\n logError(message, ...args) {\n console.error(message, ...args);\n }\n logWarning(message, ...args) {\n console.warn(message, ...args);\n }\n logDebug(message, ...args) {\n console.debug(message, ...args);\n }\n static {\n this.ɵfac = function ConsoleLoggerService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || ConsoleLoggerService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ConsoleLoggerService,\n factory: ConsoleLoggerService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return ConsoleLoggerService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nvar LogLevel = /*#__PURE__*/function (LogLevel) {\n LogLevel[LogLevel[\"None\"] = 0] = \"None\";\n LogLevel[LogLevel[\"Debug\"] = 1] = \"Debug\";\n LogLevel[LogLevel[\"Warn\"] = 2] = \"Warn\";\n LogLevel[LogLevel[\"Error\"] = 3] = \"Error\";\n return LogLevel;\n}(LogLevel || {});\nlet LoggerService = /*#__PURE__*/(() => {\n class LoggerService {\n constructor() {\n this.abstractLoggerService = inject(AbstractLoggerService);\n }\n logError(configuration, message, ...args) {\n if (this.loggingIsTurnedOff(configuration)) {\n return;\n }\n const {\n configId\n } = configuration;\n const messageToLog = this.isObject(message) ? JSON.stringify(message) : message;\n if (!!args && !!args.length) {\n this.abstractLoggerService.logError(`[ERROR] ${configId} - ${messageToLog}`, ...args);\n } else {\n this.abstractLoggerService.logError(`[ERROR] ${configId} - ${messageToLog}`);\n }\n }\n logWarning(configuration, message, ...args) {\n if (!this.logLevelIsSet(configuration)) {\n return;\n }\n if (this.loggingIsTurnedOff(configuration)) {\n return;\n }\n if (!this.currentLogLevelIsEqualOrSmallerThan(configuration, LogLevel.Warn)) {\n return;\n }\n const {\n configId\n } = configuration;\n const messageToLog = this.isObject(message) ? JSON.stringify(message) : message;\n if (!!args && !!args.length) {\n this.abstractLoggerService.logWarning(`[WARN] ${configId} - ${messageToLog}`, ...args);\n } else {\n this.abstractLoggerService.logWarning(`[WARN] ${configId} - ${messageToLog}`);\n }\n }\n logDebug(configuration, message, ...args) {\n if (!configuration) {\n return;\n }\n if (!this.logLevelIsSet(configuration)) {\n return;\n }\n if (this.loggingIsTurnedOff(configuration)) {\n return;\n }\n if (!this.currentLogLevelIsEqualOrSmallerThan(configuration, LogLevel.Debug)) {\n return;\n }\n const {\n configId\n } = configuration;\n const messageToLog = this.isObject(message) ? JSON.stringify(message) : message;\n if (!!args && !!args.length) {\n this.abstractLoggerService.logDebug(`[DEBUG] ${configId} - ${messageToLog}`, ...args);\n } else {\n this.abstractLoggerService.logDebug(`[DEBUG] ${configId} - ${messageToLog}`);\n }\n }\n currentLogLevelIsEqualOrSmallerThan(configuration, logLevelToCompare) {\n const {\n logLevel\n } = configuration || {};\n if (!logLevel) {\n return false;\n }\n return logLevel <= logLevelToCompare;\n }\n logLevelIsSet(configuration) {\n const {\n logLevel\n } = configuration || {};\n if (logLevel === null) {\n return false;\n }\n return logLevel !== undefined;\n }\n loggingIsTurnedOff(configuration) {\n const {\n logLevel\n } = configuration || {};\n return logLevel === LogLevel.None;\n }\n isObject(possibleObject) {\n return Object.prototype.toString.call(possibleObject) === '[object Object]';\n }\n static {\n this.ɵfac = function LoggerService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || LoggerService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: LoggerService,\n factory: LoggerService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return LoggerService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nvar EventTypes = /*#__PURE__*/function (EventTypes) {\n /**\n * This only works in the AppModule Constructor\n */\n EventTypes[EventTypes[\"ConfigLoaded\"] = 0] = \"ConfigLoaded\";\n EventTypes[EventTypes[\"CheckingAuth\"] = 1] = \"CheckingAuth\";\n EventTypes[EventTypes[\"CheckingAuthFinished\"] = 2] = \"CheckingAuthFinished\";\n EventTypes[EventTypes[\"CheckingAuthFinishedWithError\"] = 3] = \"CheckingAuthFinishedWithError\";\n EventTypes[EventTypes[\"ConfigLoadingFailed\"] = 4] = \"ConfigLoadingFailed\";\n EventTypes[EventTypes[\"CheckSessionReceived\"] = 5] = \"CheckSessionReceived\";\n EventTypes[EventTypes[\"UserDataChanged\"] = 6] = \"UserDataChanged\";\n EventTypes[EventTypes[\"NewAuthenticationResult\"] = 7] = \"NewAuthenticationResult\";\n EventTypes[EventTypes[\"TokenExpired\"] = 8] = \"TokenExpired\";\n EventTypes[EventTypes[\"IdTokenExpired\"] = 9] = \"IdTokenExpired\";\n EventTypes[EventTypes[\"SilentRenewStarted\"] = 10] = \"SilentRenewStarted\";\n EventTypes[EventTypes[\"SilentRenewFailed\"] = 11] = \"SilentRenewFailed\";\n return EventTypes;\n}(EventTypes || {});\nlet PublicEventsService = /*#__PURE__*/(() => {\n class PublicEventsService {\n constructor() {\n this.notify = new ReplaySubject(1);\n }\n /**\n * Fires a new event.\n *\n * @param type The event type.\n * @param value The event value.\n */\n fireEvent(type, value) {\n this.notify.next({\n type,\n value\n });\n }\n /**\n * Wires up the event notification observable.\n */\n registerForEvents() {\n return this.notify.asObservable();\n }\n static {\n this.ɵfac = function PublicEventsService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || PublicEventsService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: PublicEventsService,\n factory: PublicEventsService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return PublicEventsService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Implement this class-interface to create a custom storage.\n */\nlet AbstractSecurityStorage = /*#__PURE__*/(() => {\n class AbstractSecurityStorage {\n static {\n this.ɵfac = function AbstractSecurityStorage_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || AbstractSecurityStorage)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: AbstractSecurityStorage,\n factory: AbstractSecurityStorage.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return AbstractSecurityStorage;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet BrowserStorageService = /*#__PURE__*/(() => {\n class BrowserStorageService {\n constructor() {\n this.loggerService = inject(LoggerService);\n this.abstractSecurityStorage = inject(AbstractSecurityStorage);\n }\n read(key, configuration) {\n const {\n configId\n } = configuration;\n if (!configId) {\n this.loggerService.logDebug(configuration, `Wanted to read '${key}' but configId was '${configId}'`);\n return null;\n }\n if (!this.hasStorage()) {\n this.loggerService.logDebug(configuration, `Wanted to read '${key}' but Storage was undefined`);\n return null;\n }\n const storedConfig = this.abstractSecurityStorage.read(configId);\n if (!storedConfig) {\n return null;\n }\n return JSON.parse(storedConfig);\n }\n write(value, configuration) {\n const {\n configId\n } = configuration;\n if (!configId) {\n this.loggerService.logDebug(configuration, `Wanted to write but configId was '${configId}'`);\n return false;\n }\n if (!this.hasStorage()) {\n this.loggerService.logDebug(configuration, `Wanted to write but Storage was falsy`);\n return false;\n }\n value = value || null;\n this.abstractSecurityStorage.write(configId, JSON.stringify(value));\n return true;\n }\n remove(key, configuration) {\n if (!this.hasStorage()) {\n this.loggerService.logDebug(configuration, `Wanted to remove '${key}' but Storage was falsy`);\n return false;\n }\n // const storage = this.getStorage(configuration);\n // if (!storage) {\n // this.loggerService.logDebug(configuration, `Wanted to write '${key}' but Storage was falsy`);\n // return false;\n // }\n this.abstractSecurityStorage.remove(key);\n return true;\n }\n // TODO THIS STORAGE WANTS AN ID BUT CLEARS EVERYTHING\n clear(configuration) {\n if (!this.hasStorage()) {\n this.loggerService.logDebug(configuration, `Wanted to clear storage but Storage was falsy`);\n return false;\n }\n // const storage = this.getStorage(configuration);\n // if (!storage) {\n // this.loggerService.logDebug(configuration, `Wanted to clear storage but Storage was falsy`);\n // return false;\n // }\n this.abstractSecurityStorage.clear();\n return true;\n }\n hasStorage() {\n return typeof Storage !== 'undefined';\n }\n static {\n this.ɵfac = function BrowserStorageService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || BrowserStorageService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: BrowserStorageService,\n factory: BrowserStorageService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return BrowserStorageService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet StoragePersistenceService = /*#__PURE__*/(() => {\n class StoragePersistenceService {\n constructor() {\n this.browserStorageService = inject(BrowserStorageService);\n }\n read(key, config) {\n const storedConfig = this.browserStorageService.read(key, config) || {};\n return storedConfig[key];\n }\n write(key, value, config) {\n const storedConfig = this.browserStorageService.read(key, config) || {};\n storedConfig[key] = value;\n return this.browserStorageService.write(storedConfig, config);\n }\n remove(key, config) {\n const storedConfig = this.browserStorageService.read(key, config) || {};\n delete storedConfig[key];\n this.browserStorageService.write(storedConfig, config);\n }\n clear(config) {\n this.browserStorageService.clear(config);\n }\n resetStorageFlowData(config) {\n this.remove('session_state', config);\n this.remove('storageSilentRenewRunning', config);\n this.remove('storageCodeFlowInProgress', config);\n this.remove('codeVerifier', config);\n this.remove('userData', config);\n this.remove('storageCustomParamsAuthRequest', config);\n this.remove('access_token_expires_at', config);\n this.remove('storageCustomParamsRefresh', config);\n this.remove('storageCustomParamsEndSession', config);\n this.remove('reusable_refresh_token', config);\n }\n resetAuthStateInStorage(config) {\n this.remove('authzData', config);\n this.remove('reusable_refresh_token', config);\n this.remove('authnResult', config);\n }\n getAccessToken(config) {\n return this.read('authzData', config);\n }\n getIdToken(config) {\n return this.read('authnResult', config)?.id_token;\n }\n getRefreshToken(config) {\n const refreshToken = this.read('authnResult', config)?.refresh_token;\n if (!refreshToken && config.allowUnsafeReuseRefreshToken) {\n return this.read('reusable_refresh_token', config);\n }\n return refreshToken;\n }\n getAuthenticationResult(config) {\n return this.read('authnResult', config);\n }\n static {\n this.ɵfac = function StoragePersistenceService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || StoragePersistenceService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: StoragePersistenceService,\n factory: StoragePersistenceService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return StoragePersistenceService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet JwkExtractor = /*#__PURE__*/(() => {\n class JwkExtractor {\n extractJwk(keys, spec, throwOnEmpty = true) {\n if (0 === keys.length) {\n throw JwkExtractorInvalidArgumentError;\n }\n const foundKeys = keys.filter(k => spec?.kid ? k['kid'] === spec.kid : true).filter(k => spec?.use ? k['use'] === spec.use : true).filter(k => spec?.kty ? k['kty'] === spec.kty : true);\n if (foundKeys.length === 0 && throwOnEmpty) {\n throw JwkExtractorNoMatchingKeysError;\n }\n if (foundKeys.length > 1 && (null === spec || undefined === spec)) {\n throw JwkExtractorSeveralMatchingKeysError;\n }\n return foundKeys;\n }\n static {\n this.ɵfac = function JwkExtractor_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || JwkExtractor)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: JwkExtractor,\n factory: JwkExtractor.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return JwkExtractor;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction buildErrorName(name) {\n return JwkExtractor.name + ': ' + name;\n}\nconst JwkExtractorInvalidArgumentError = {\n name: buildErrorName('InvalidArgumentError'),\n message: 'Array of keys was empty. Unable to extract'\n};\nconst JwkExtractorNoMatchingKeysError = {\n name: buildErrorName('NoMatchingKeysError'),\n message: 'No key found matching the spec'\n};\nconst JwkExtractorSeveralMatchingKeysError = {\n name: buildErrorName('SeveralMatchingKeysError'),\n message: 'More than one key found. Please use spec to filter'\n};\nconst PARTS_OF_TOKEN = 3;\nlet TokenHelperService = /*#__PURE__*/(() => {\n class TokenHelperService {\n constructor() {\n this.loggerService = inject(LoggerService);\n this.document = inject(DOCUMENT);\n }\n getTokenExpirationDate(dataIdToken) {\n if (!Object.prototype.hasOwnProperty.call(dataIdToken, 'exp')) {\n return new Date(new Date().toUTCString());\n }\n const date = new Date(0); // The 0 here is the key, which sets the date to the epoch\n date.setUTCSeconds(dataIdToken.exp);\n return date;\n }\n getSigningInputFromToken(token, encoded, configuration) {\n if (!this.tokenIsValid(token, configuration)) {\n return '';\n }\n const header = this.getHeaderFromToken(token, encoded, configuration);\n const payload = this.getPayloadFromToken(token, encoded, configuration);\n return [header, payload].join('.');\n }\n getHeaderFromToken(token, encoded, configuration) {\n if (!this.tokenIsValid(token, configuration)) {\n return {};\n }\n return this.getPartOfToken(token, 0, encoded);\n }\n getPayloadFromToken(token, encoded, configuration) {\n if (!configuration) {\n return {};\n }\n if (!this.tokenIsValid(token, configuration)) {\n return {};\n }\n return this.getPartOfToken(token, 1, encoded);\n }\n getSignatureFromToken(token, encoded, configuration) {\n if (!this.tokenIsValid(token, configuration)) {\n return {};\n }\n return this.getPartOfToken(token, 2, encoded);\n }\n getPartOfToken(token, index, encoded) {\n const partOfToken = this.extractPartOfToken(token, index);\n if (encoded) {\n return partOfToken;\n }\n const result = this.urlBase64Decode(partOfToken);\n return JSON.parse(result);\n }\n urlBase64Decode(str) {\n let output = str.replace(/-/g, '+').replace(/_/g, '/');\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += '==';\n break;\n case 3:\n output += '=';\n break;\n default:\n throw Error('Illegal base64url string!');\n }\n const decoded = typeof this.document.defaultView !== 'undefined' ? this.document.defaultView?.atob(output) : Buffer.from(output, 'base64').toString('binary');\n if (!decoded) {\n return '';\n }\n try {\n // Going backwards: from byte stream, to percent-encoding, to original string.\n return decodeURIComponent(decoded.split('').map(c => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)).join(''));\n } catch (err) {\n return decoded;\n }\n }\n tokenIsValid(token, configuration) {\n if (!token) {\n this.loggerService.logError(configuration, `token '${token}' is not valid --> token falsy`);\n return false;\n }\n if (!token.includes('.')) {\n this.loggerService.logError(configuration, `token '${token}' is not valid --> no dots included`);\n return false;\n }\n const parts = token.split('.');\n if (parts.length !== PARTS_OF_TOKEN) {\n this.loggerService.logError(configuration, `token '${token}' is not valid --> token has to have exactly ${PARTS_OF_TOKEN - 1} dots`);\n return false;\n }\n return true;\n }\n extractPartOfToken(token, index) {\n return token.split('.')[index];\n }\n static {\n this.ɵfac = function TokenHelperService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || TokenHelperService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: TokenHelperService,\n factory: TokenHelperService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return TokenHelperService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet CryptoService = /*#__PURE__*/(() => {\n class CryptoService {\n constructor() {\n this.document = inject(DOCUMENT);\n }\n getCrypto() {\n // support for IE, (window.crypto || window.msCrypto)\n return this.document.defaultView?.crypto || this.document.defaultView?.msCrypto;\n }\n static {\n this.ɵfac = function CryptoService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || CryptoService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: CryptoService,\n factory: CryptoService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return CryptoService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet JwkWindowCryptoService = /*#__PURE__*/(() => {\n class JwkWindowCryptoService {\n constructor() {\n this.cryptoService = inject(CryptoService);\n }\n importVerificationKey(key, algorithm) {\n return this.cryptoService.getCrypto().subtle.importKey('jwk', key, algorithm, false, ['verify']);\n }\n verifyKey(verifyAlgorithm, cryptoKey, signature, signingInput) {\n return this.cryptoService.getCrypto().subtle.verify(verifyAlgorithm, cryptoKey, signature, new TextEncoder().encode(signingInput));\n }\n static {\n this.ɵfac = function JwkWindowCryptoService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || JwkWindowCryptoService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: JwkWindowCryptoService,\n factory: JwkWindowCryptoService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return JwkWindowCryptoService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet JwtWindowCryptoService = /*#__PURE__*/(() => {\n class JwtWindowCryptoService {\n constructor() {\n this.cryptoService = inject(CryptoService);\n }\n generateCodeChallenge(codeVerifier) {\n return this.calcHash(codeVerifier).pipe(map(challengeRaw => this.base64UrlEncode(challengeRaw)));\n }\n generateAtHash(accessToken, algorithm) {\n return this.calcHash(accessToken, algorithm).pipe(map(tokenHash => {\n const substr = tokenHash.substr(0, tokenHash.length / 2);\n const tokenHashBase64 = btoa(substr);\n return tokenHashBase64.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '');\n }));\n }\n calcHash(valueToHash, algorithm = 'SHA-256') {\n const msgBuffer = new TextEncoder().encode(valueToHash);\n return from(this.cryptoService.getCrypto().subtle.digest(algorithm, msgBuffer)).pipe(map(hashBuffer => {\n const buffer = hashBuffer;\n const hashArray = Array.from(new Uint8Array(buffer));\n return this.toHashString(hashArray);\n }));\n }\n toHashString(byteArray) {\n let result = '';\n for (const e of byteArray) {\n result += String.fromCharCode(e);\n }\n return result;\n }\n base64UrlEncode(str) {\n const base64 = btoa(str);\n return base64.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '');\n }\n static {\n this.ɵfac = function JwtWindowCryptoService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || JwtWindowCryptoService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: JwtWindowCryptoService,\n factory: JwtWindowCryptoService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return JwtWindowCryptoService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction getVerifyAlg(alg) {\n switch (alg.charAt(0)) {\n case 'R':\n return {\n name: 'RSASSA-PKCS1-v1_5',\n hash: 'SHA-256'\n };\n case 'E':\n if (alg.includes('256')) {\n return {\n name: 'ECDSA',\n hash: 'SHA-256'\n };\n } else if (alg.includes('384')) {\n return {\n name: 'ECDSA',\n hash: 'SHA-384'\n };\n } else {\n return null;\n }\n default:\n return null;\n }\n}\nfunction alg2kty(alg) {\n switch (alg.charAt(0)) {\n case 'R':\n return 'RSA';\n case 'E':\n return 'EC';\n default:\n throw new Error('Cannot infer kty from alg: ' + alg);\n }\n}\nfunction getImportAlg(alg) {\n switch (alg.charAt(0)) {\n case 'R':\n if (alg.includes('256')) {\n return {\n name: 'RSASSA-PKCS1-v1_5',\n hash: 'SHA-256'\n };\n } else if (alg.includes('384')) {\n return {\n name: 'RSASSA-PKCS1-v1_5',\n hash: 'SHA-384'\n };\n } else if (alg.includes('512')) {\n return {\n name: 'RSASSA-PKCS1-v1_5',\n hash: 'SHA-512'\n };\n } else {\n return null;\n }\n case 'E':\n if (alg.includes('256')) {\n return {\n name: 'ECDSA',\n namedCurve: 'P-256'\n };\n } else if (alg.includes('384')) {\n return {\n name: 'ECDSA',\n namedCurve: 'P-384'\n };\n } else {\n return null;\n }\n default:\n return null;\n }\n}\n\n// http://openid.net/specs/openid-connect-implicit-1_0.html\n// id_token\n// id_token C1: The Issuer Identifier for the OpenID Provider (which is typically obtained during Discovery)\n// MUST exactly match the value of the iss (issuer) Claim.\n//\n// id_token C2: The Client MUST validate that the aud (audience) Claim contains its client_id value registered at the Issuer identified\n// by the iss (issuer) Claim as an audience.The ID Token MUST be rejected if the ID Token does not list the Client as a valid audience,\n// or if it contains additional audiences not trusted by the Client.\n//\n// id_token C3: If the ID Token contains multiple audiences, the Client SHOULD verify that an azp Claim is present.\n//\n// id_token C4: If an azp (authorized party) Claim is present, the Client SHOULD verify that its client_id is the Claim Value.\n//\n// id_token C5: The Client MUST validate the signature of the ID Token according to JWS [JWS] using the algorithm specified in the\n// alg Header Parameter of the JOSE Header.The Client MUST use the keys provided by the Issuer.\n//\n// id_token C6: The alg value SHOULD be RS256. Validation of tokens using other signing algorithms is described in the OpenID Connect\n// Core 1.0\n// [OpenID.Core] specification.\n//\n// id_token C7: The current time MUST be before the time represented by the exp Claim (possibly allowing for some small leeway to account\n// for clock skew).\n//\n// id_token C8: The iat Claim can be used to reject tokens that were issued too far away from the current time,\n// limiting the amount of time that nonces need to be stored to prevent attacks.The acceptable range is Client specific.\n//\n// id_token C9: The value of the nonce Claim MUST be checked to verify that it is the same value as the one that was sent\n// in the Authentication Request.The Client SHOULD check the nonce value for replay attacks.The precise method for detecting replay attacks\n// is Client specific.\n//\n// id_token C10: If the acr Claim was requested, the Client SHOULD check that the asserted Claim Value is appropriate.\n// The meaning and processing of acr Claim Values is out of scope for this document.\n//\n// id_token C11: When a max_age request is made, the Client SHOULD check the auth_time Claim value and request re- authentication\n// if it determines too much time has elapsed since the last End- User authentication.\n// Access Token Validation\n// access_token C1: Hash the octets of the ASCII representation of the access_token with the hash algorithm specified in JWA[JWA]\n// for the alg Header Parameter of the ID Token's JOSE Header. For instance, if the alg is RS256, the hash algorithm used is SHA-256.\n// access_token C2: Take the left- most half of the hash and base64url- encode it.\n// access_token C3: The value of at_hash in the ID Token MUST match the value produced in the previous step if at_hash is present\n// in the ID Token.\nlet TokenValidationService = /*#__PURE__*/(() => {\n class TokenValidationService {\n constructor() {\n this.keyAlgorithms = ['HS256', 'HS384', 'HS512', 'RS256', 'RS384', 'RS512', 'ES256', 'ES384', 'PS256', 'PS384', 'PS512'];\n this.tokenHelperService = inject(TokenHelperService);\n this.loggerService = inject(LoggerService);\n this.jwkExtractor = inject(JwkExtractor);\n this.jwkWindowCryptoService = inject(JwkWindowCryptoService);\n this.jwtWindowCryptoService = inject(JwtWindowCryptoService);\n }\n static {\n this.refreshTokenNoncePlaceholder = '--RefreshToken--';\n }\n // id_token C7: The current time MUST be before the time represented by the exp Claim\n // (possibly allowing for some small leeway to account for clock skew).\n hasIdTokenExpired(token, configuration, offsetSeconds) {\n const decoded = this.tokenHelperService.getPayloadFromToken(token, false, configuration);\n return !this.validateIdTokenExpNotExpired(decoded, configuration, offsetSeconds);\n }\n // id_token C7: The current time MUST be before the time represented by the exp Claim\n // (possibly allowing for some small leeway to account for clock skew).\n validateIdTokenExpNotExpired(decodedIdToken, configuration, offsetSeconds) {\n const tokenExpirationDate = this.tokenHelperService.getTokenExpirationDate(decodedIdToken);\n offsetSeconds = offsetSeconds || 0;\n if (!tokenExpirationDate) {\n return false;\n }\n const tokenExpirationValue = tokenExpirationDate.valueOf();\n const nowWithOffset = this.calculateNowWithOffset(offsetSeconds);\n const tokenNotExpired = tokenExpirationValue > nowWithOffset;\n this.loggerService.logDebug(configuration, `Has idToken expired: ${!tokenNotExpired} --> expires in ${this.millisToMinutesAndSeconds(tokenExpirationValue - nowWithOffset)} , ${new Date(tokenExpirationValue).toLocaleTimeString()} > ${new Date(nowWithOffset).toLocaleTimeString()}`);\n return tokenNotExpired;\n }\n validateAccessTokenNotExpired(accessTokenExpiresAt, configuration, offsetSeconds) {\n // value is optional, so if it does not exist, then it has not expired\n if (!accessTokenExpiresAt) {\n return true;\n }\n offsetSeconds = offsetSeconds || 0;\n const accessTokenExpirationValue = accessTokenExpiresAt.valueOf();\n const nowWithOffset = this.calculateNowWithOffset(offsetSeconds);\n const tokenNotExpired = accessTokenExpirationValue > nowWithOffset;\n this.loggerService.logDebug(configuration, `Has accessToken expired: ${!tokenNotExpired} --> expires in ${this.millisToMinutesAndSeconds(accessTokenExpirationValue - nowWithOffset)} , ${new Date(accessTokenExpirationValue).toLocaleTimeString()} > ${new Date(nowWithOffset).toLocaleTimeString()}`);\n return tokenNotExpired;\n }\n // iss\n // REQUIRED. Issuer Identifier for the Issuer of the response.The iss value is a case-sensitive URL using the\n // https scheme that contains scheme, host,\n // and optionally, port number and path components and no query or fragment components.\n //\n // sub\n // REQUIRED. Subject Identifier.Locally unique and never reassigned identifier within the Issuer for the End- User,\n // which is intended to be consumed by the Client, e.g., 24400320 or AItOawmwtWwcT0k51BayewNvutrJUqsvl6qs7A4.\n // It MUST NOT exceed 255 ASCII characters in length.The sub value is a case-sensitive string.\n //\n // aud\n // REQUIRED. Audience(s) that this ID Token is intended for. It MUST contain the OAuth 2.0 client_id of the Relying Party as an\n // audience value.\n // It MAY also contain identifiers for other audiences.In the general case, the aud value is an array of case-sensitive strings.\n // In the common special case when there is one audience, the aud value MAY be a single case-sensitive string.\n //\n // exp\n // REQUIRED. Expiration time on or after which the ID Token MUST NOT be accepted for processing.\n // The processing of this parameter requires that the current date/ time MUST be before the expiration date/ time listed in the value.\n // Implementers MAY provide for some small leeway, usually no more than a few minutes, to account for clock skew.\n // Its value is a JSON [RFC7159] number representing the number of seconds from 1970- 01 - 01T00: 00:00Z as measured in UTC until\n // the date/ time.\n // See RFC 3339 [RFC3339] for details regarding date/ times in general and UTC in particular.\n //\n // iat\n // REQUIRED. Time at which the JWT was issued. Its value is a JSON number representing the number of seconds from\n // 1970- 01 - 01T00: 00: 00Z as measured\n // in UTC until the date/ time.\n validateRequiredIdToken(dataIdToken, configuration) {\n let validated = true;\n if (!Object.prototype.hasOwnProperty.call(dataIdToken, 'iss')) {\n validated = false;\n this.loggerService.logWarning(configuration, 'iss is missing, this is required in the id_token');\n }\n if (!Object.prototype.hasOwnProperty.call(dataIdToken, 'sub')) {\n validated = false;\n this.loggerService.logWarning(configuration, 'sub is missing, this is required in the id_token');\n }\n if (!Object.prototype.hasOwnProperty.call(dataIdToken, 'aud')) {\n validated = false;\n this.loggerService.logWarning(configuration, 'aud is missing, this is required in the id_token');\n }\n if (!Object.prototype.hasOwnProperty.call(dataIdToken, 'exp')) {\n validated = false;\n this.loggerService.logWarning(configuration, 'exp is missing, this is required in the id_token');\n }\n if (!Object.prototype.hasOwnProperty.call(dataIdToken, 'iat')) {\n validated = false;\n this.loggerService.logWarning(configuration, 'iat is missing, this is required in the id_token');\n }\n return validated;\n }\n // id_token C8: The iat Claim can be used to reject tokens that were issued too far away from the current time,\n // limiting the amount of time that nonces need to be stored to prevent attacks.The acceptable range is Client specific.\n validateIdTokenIatMaxOffset(dataIdToken, maxOffsetAllowedInSeconds, disableIatOffsetValidation, configuration) {\n if (disableIatOffsetValidation) {\n return true;\n }\n if (!Object.prototype.hasOwnProperty.call(dataIdToken, 'iat')) {\n return false;\n }\n const dateTimeIatIdToken = new Date(0); // The 0 here is the key, which sets the date to the epoch\n dateTimeIatIdToken.setUTCSeconds(dataIdToken.iat);\n maxOffsetAllowedInSeconds = maxOffsetAllowedInSeconds || 0;\n const nowInUtc = new Date(new Date().toUTCString());\n const diff = nowInUtc.valueOf() - dateTimeIatIdToken.valueOf();\n const maxOffsetAllowedInMilliseconds = maxOffsetAllowedInSeconds * 1000;\n this.loggerService.logDebug(configuration, `validate id token iat max offset ${diff} < ${maxOffsetAllowedInMilliseconds}`);\n if (diff > 0) {\n return diff < maxOffsetAllowedInMilliseconds;\n }\n return -diff < maxOffsetAllowedInMilliseconds;\n }\n // id_token C9: The value of the nonce Claim MUST be checked to verify that it is the same value as the one\n // that was sent in the Authentication Request.The Client SHOULD check the nonce value for replay attacks.\n // The precise method for detecting replay attacks is Client specific.\n // However the nonce claim SHOULD not be present for the refresh_token grant type\n // https://bitbucket.org/openid/connect/issues/1025/ambiguity-with-how-nonce-is-handled-on\n // The current spec is ambiguous and KeyCloak does send it.\n validateIdTokenNonce(dataIdToken, localNonce, ignoreNonceAfterRefresh, configuration) {\n const isFromRefreshToken = (dataIdToken.nonce === undefined || ignoreNonceAfterRefresh) && localNonce === TokenValidationService.refreshTokenNoncePlaceholder;\n if (!isFromRefreshToken && dataIdToken.nonce !== localNonce) {\n this.loggerService.logDebug(configuration, 'Validate_id_token_nonce failed, dataIdToken.nonce: ' + dataIdToken.nonce + ' local_nonce:' + localNonce);\n return false;\n }\n return true;\n }\n // id_token C1: The Issuer Identifier for the OpenID Provider (which is typically obtained during Discovery)\n // MUST exactly match the value of the iss (issuer) Claim.\n validateIdTokenIss(dataIdToken, authWellKnownEndpointsIssuer, configuration) {\n if (dataIdToken.iss !== authWellKnownEndpointsIssuer) {\n this.loggerService.logDebug(configuration, 'Validate_id_token_iss failed, dataIdToken.iss: ' + dataIdToken.iss + ' authWellKnownEndpoints issuer:' + authWellKnownEndpointsIssuer);\n return false;\n }\n return true;\n }\n // id_token C2: The Client MUST validate that the aud (audience) Claim contains its client_id value registered at the Issuer identified\n // by the iss (issuer) Claim as an audience.\n // The ID Token MUST be rejected if the ID Token does not list the Client as a valid audience, or if it contains additional audiences\n // not trusted by the Client.\n validateIdTokenAud(dataIdToken, aud, configuration) {\n if (Array.isArray(dataIdToken.aud)) {\n const result = dataIdToken.aud.includes(aud);\n if (!result) {\n this.loggerService.logDebug(configuration, 'Validate_id_token_aud array failed, dataIdToken.aud: ' + dataIdToken.aud + ' client_id:' + aud);\n return false;\n }\n return true;\n } else if (dataIdToken.aud !== aud) {\n this.loggerService.logDebug(configuration, 'Validate_id_token_aud failed, dataIdToken.aud: ' + dataIdToken.aud + ' client_id:' + aud);\n return false;\n }\n return true;\n }\n validateIdTokenAzpExistsIfMoreThanOneAud(dataIdToken) {\n if (!dataIdToken) {\n return false;\n }\n return !(Array.isArray(dataIdToken.aud) && dataIdToken.aud.length > 1 && !dataIdToken.azp);\n }\n // If an azp (authorized party) Claim is present, the Client SHOULD verify that its client_id is the Claim Value.\n validateIdTokenAzpValid(dataIdToken, clientId) {\n if (!dataIdToken?.azp) {\n return true;\n }\n return dataIdToken.azp === clientId;\n }\n validateStateFromHashCallback(state, localState, configuration) {\n if (state !== localState) {\n this.loggerService.logDebug(configuration, 'ValidateStateFromHashCallback failed, state: ' + state + ' local_state:' + localState);\n return false;\n }\n return true;\n }\n // id_token C5: The Client MUST validate the signature of the ID Token according to JWS [JWS] using the algorithm specified in the alg\n // Header Parameter of the JOSE Header.The Client MUST use the keys provided by the Issuer.\n // id_token C6: The alg value SHOULD be RS256. Validation of tokens using other signing algorithms is described in the\n // OpenID Connect Core 1.0 [OpenID.Core] specification.\n validateSignatureIdToken(idToken, jwtkeys, configuration) {\n if (!idToken) {\n return of(true);\n }\n if (!jwtkeys || !jwtkeys.keys) {\n return of(false);\n }\n const headerData = this.tokenHelperService.getHeaderFromToken(idToken, false, configuration);\n if (Object.keys(headerData).length === 0 && headerData.constructor === Object) {\n this.loggerService.logWarning(configuration, 'id token has no header data');\n return of(false);\n }\n const kid = headerData.kid;\n const alg = headerData.alg;\n const keys = jwtkeys.keys;\n let foundKeys;\n let key;\n if (!this.keyAlgorithms.includes(alg)) {\n this.loggerService.logWarning(configuration, 'alg not supported', alg);\n return of(false);\n }\n const kty = alg2kty(alg);\n const use = 'sig';\n try {\n foundKeys = kid ? this.jwkExtractor.extractJwk(keys, {\n kid,\n kty,\n use\n }, false) : this.jwkExtractor.extractJwk(keys, {\n kty,\n use\n }, false);\n if (foundKeys.length === 0) {\n foundKeys = kid ? this.jwkExtractor.extractJwk(keys, {\n kid,\n kty\n }) : this.jwkExtractor.extractJwk(keys, {\n kty\n });\n }\n key = foundKeys[0];\n } catch (e) {\n this.loggerService.logError(configuration, e);\n return of(false);\n }\n const algorithm = getImportAlg(alg);\n const signingInput = this.tokenHelperService.getSigningInputFromToken(idToken, true, configuration);\n const rawSignature = this.tokenHelperService.getSignatureFromToken(idToken, true, configuration);\n return from(this.jwkWindowCryptoService.importVerificationKey(key, algorithm)).pipe(mergeMap(cryptoKey => {\n const signature = base64url.parse(rawSignature, {\n loose: true\n });\n const verifyAlgorithm = getVerifyAlg(alg);\n return from(this.jwkWindowCryptoService.verifyKey(verifyAlgorithm, cryptoKey, signature, signingInput));\n }), tap(isValid => {\n if (!isValid) {\n this.loggerService.logWarning(configuration, 'incorrect Signature, validation failed for id_token');\n }\n }));\n }\n // Accepts ID Token without 'kid' claim in JOSE header if only one JWK supplied in 'jwks_url'\n //// private validate_no_kid_in_header_only_one_allowed_in_jwtkeys(header_data: any, jwtkeys: any): boolean {\n //// this.oidcSecurityCommon.logDebug('amount of jwtkeys.keys: ' + jwtkeys.keys.length);\n //// if (!header_data.hasOwnProperty('kid')) {\n //// // no kid defined in Jose header\n //// if (jwtkeys.keys.length != 1) {\n //// this.oidcSecurityCommon.logDebug('jwtkeys.keys.length != 1 and no kid in header');\n //// return false;\n //// }\n //// }\n //// return true;\n //// }\n // Access Token Validation\n // access_token C1: Hash the octets of the ASCII representation of the access_token with the hash algorithm specified in JWA[JWA]\n // for the alg Header Parameter of the ID Token's JOSE Header. For instance, if the alg is RS256, the hash algorithm used is SHA-256.\n // access_token C2: Take the left- most half of the hash and base64url- encode it.\n // access_token C3: The value of at_hash in the ID Token MUST match the value produced in the previous step if at_hash\n // is present in the ID Token.\n validateIdTokenAtHash(accessToken, atHash, idTokenAlg, configuration) {\n this.loggerService.logDebug(configuration, 'at_hash from the server:' + atHash);\n // 'sha256' 'sha384' 'sha512'\n let sha = 'SHA-256';\n if (idTokenAlg.includes('384')) {\n sha = 'SHA-384';\n } else if (idTokenAlg.includes('512')) {\n sha = 'SHA-512';\n }\n return this.jwtWindowCryptoService.generateAtHash('' + accessToken, sha).pipe(mergeMap(hash => {\n this.loggerService.logDebug(configuration, 'at_hash client validation not decoded:' + hash);\n if (hash === atHash) {\n return of(true); // isValid;\n } else {\n return this.jwtWindowCryptoService.generateAtHash('' + decodeURIComponent(accessToken), sha).pipe(map(newHash => {\n this.loggerService.logDebug(configuration, '-gen access--' + hash);\n return newHash === atHash;\n }));\n }\n }));\n }\n millisToMinutesAndSeconds(millis) {\n const minutes = Math.floor(millis / 60000);\n const seconds = (millis % 60000 / 1000).toFixed(0);\n return minutes + ':' + (+seconds < 10 ? '0' : '') + seconds;\n }\n calculateNowWithOffset(offsetSeconds) {\n return new Date(new Date().toUTCString()).valueOf() + offsetSeconds * 1000;\n }\n static {\n this.ɵfac = function TokenValidationService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || TokenValidationService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: TokenValidationService,\n factory: TokenValidationService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return TokenValidationService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst DEFAULT_AUTHRESULT = {\n isAuthenticated: false,\n allConfigsAuthenticated: []\n};\nlet AuthStateService = /*#__PURE__*/(() => {\n class AuthStateService {\n constructor() {\n this.storagePersistenceService = inject(StoragePersistenceService);\n this.loggerService = inject(LoggerService);\n this.publicEventsService = inject(PublicEventsService);\n this.tokenValidationService = inject(TokenValidationService);\n this.authenticatedInternal$ = new BehaviorSubject(DEFAULT_AUTHRESULT);\n }\n get authenticated$() {\n return this.authenticatedInternal$.asObservable().pipe(distinctUntilChanged());\n }\n setAuthenticatedAndFireEvent(allConfigs) {\n const result = this.composeAuthenticatedResult(allConfigs);\n this.authenticatedInternal$.next(result);\n }\n setUnauthenticatedAndFireEvent(currentConfig, allConfigs) {\n this.storagePersistenceService.resetAuthStateInStorage(currentConfig);\n const result = this.composeUnAuthenticatedResult(allConfigs);\n this.authenticatedInternal$.next(result);\n }\n updateAndPublishAuthState(authenticationResult) {\n this.publicEventsService.fireEvent(EventTypes.NewAuthenticationResult, authenticationResult);\n }\n setAuthorizationData(accessToken, authResult, currentConfig, allConfigs) {\n this.loggerService.logDebug(currentConfig, `storing the accessToken '${accessToken}'`);\n this.storagePersistenceService.write('authzData', accessToken, currentConfig);\n this.persistAccessTokenExpirationTime(authResult, currentConfig);\n this.setAuthenticatedAndFireEvent(allConfigs);\n }\n getAccessToken(configuration) {\n if (!configuration) {\n return '';\n }\n if (!this.isAuthenticated(configuration)) {\n return '';\n }\n const token = this.storagePersistenceService.getAccessToken(configuration);\n return this.decodeURIComponentSafely(token);\n }\n getIdToken(configuration) {\n if (!configuration) {\n return '';\n }\n if (!this.isAuthenticated(configuration)) {\n return '';\n }\n const token = this.storagePersistenceService.getIdToken(configuration);\n return this.decodeURIComponentSafely(token);\n }\n getRefreshToken(configuration) {\n if (!configuration) {\n return '';\n }\n if (!this.isAuthenticated(configuration)) {\n return '';\n }\n const token = this.storagePersistenceService.getRefreshToken(configuration);\n return this.decodeURIComponentSafely(token);\n }\n getAuthenticationResult(configuration) {\n if (!configuration) {\n return null;\n }\n if (!this.isAuthenticated(configuration)) {\n return null;\n }\n return this.storagePersistenceService.getAuthenticationResult(configuration);\n }\n areAuthStorageTokensValid(configuration) {\n if (!configuration) {\n return false;\n }\n if (!this.isAuthenticated(configuration)) {\n return false;\n }\n if (this.hasIdTokenExpiredAndRenewCheckIsEnabled(configuration)) {\n this.loggerService.logDebug(configuration, 'persisted idToken is expired');\n return false;\n }\n if (this.hasAccessTokenExpiredIfExpiryExists(configuration)) {\n this.loggerService.logDebug(configuration, 'persisted accessToken is expired');\n return false;\n }\n this.loggerService.logDebug(configuration, 'persisted idToken and accessToken are valid');\n return true;\n }\n hasIdTokenExpiredAndRenewCheckIsEnabled(configuration) {\n const {\n renewTimeBeforeTokenExpiresInSeconds,\n triggerRefreshWhenIdTokenExpired,\n disableIdTokenValidation\n } = configuration;\n if (!triggerRefreshWhenIdTokenExpired || disableIdTokenValidation) {\n return false;\n }\n const tokenToCheck = this.storagePersistenceService.getIdToken(configuration);\n const idTokenExpired = this.tokenValidationService.hasIdTokenExpired(tokenToCheck, configuration, renewTimeBeforeTokenExpiresInSeconds);\n if (idTokenExpired) {\n this.publicEventsService.fireEvent(EventTypes.IdTokenExpired, idTokenExpired);\n }\n return idTokenExpired;\n }\n hasAccessTokenExpiredIfExpiryExists(configuration) {\n const {\n renewTimeBeforeTokenExpiresInSeconds\n } = configuration;\n const accessTokenExpiresIn = this.storagePersistenceService.read('access_token_expires_at', configuration);\n const accessTokenHasNotExpired = this.tokenValidationService.validateAccessTokenNotExpired(accessTokenExpiresIn, configuration, renewTimeBeforeTokenExpiresInSeconds);\n const hasExpired = !accessTokenHasNotExpired;\n if (hasExpired) {\n this.publicEventsService.fireEvent(EventTypes.TokenExpired, hasExpired);\n }\n return hasExpired;\n }\n isAuthenticated(configuration) {\n if (!configuration) {\n throwError(() => new Error('Please provide a configuration before setting up the module'));\n return false;\n }\n const hasAccessToken = !!this.storagePersistenceService.getAccessToken(configuration);\n const hasIdToken = !!this.storagePersistenceService.getIdToken(configuration);\n return hasAccessToken && hasIdToken;\n }\n decodeURIComponentSafely(token) {\n if (token) {\n return decodeURIComponent(token);\n } else {\n return '';\n }\n }\n persistAccessTokenExpirationTime(authResult, configuration) {\n if (authResult?.expires_in) {\n const accessTokenExpiryTime = new Date(new Date().toUTCString()).valueOf() + authResult.expires_in * 1000;\n this.storagePersistenceService.write('access_token_expires_at', accessTokenExpiryTime, configuration);\n }\n }\n composeAuthenticatedResult(allConfigs) {\n if (allConfigs.length === 1) {\n const {\n configId\n } = allConfigs[0];\n return {\n isAuthenticated: true,\n allConfigsAuthenticated: [{\n configId: configId ?? '',\n isAuthenticated: true\n }]\n };\n }\n return this.checkAllConfigsIfTheyAreAuthenticated(allConfigs);\n }\n composeUnAuthenticatedResult(allConfigs) {\n if (allConfigs.length === 1) {\n const {\n configId\n } = allConfigs[0];\n return {\n isAuthenticated: false,\n allConfigsAuthenticated: [{\n configId: configId ?? '',\n isAuthenticated: false\n }]\n };\n }\n return this.checkAllConfigsIfTheyAreAuthenticated(allConfigs);\n }\n checkAllConfigsIfTheyAreAuthenticated(allConfigs) {\n const allConfigsAuthenticated = allConfigs.map(config => ({\n configId: config.configId ?? '',\n isAuthenticated: this.isAuthenticated(config)\n }));\n const isAuthenticated = allConfigsAuthenticated.every(x => !!x.isAuthenticated);\n return {\n allConfigsAuthenticated,\n isAuthenticated\n };\n }\n static {\n this.ɵfac = function AuthStateService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || AuthStateService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: AuthStateService,\n factory: AuthStateService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return AuthStateService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst STORAGE_KEY = 'redirect';\nlet AutoLoginService = /*#__PURE__*/(() => {\n class AutoLoginService {\n constructor() {\n this.storageService = inject(StoragePersistenceService);\n this.router = inject(Router);\n }\n checkSavedRedirectRouteAndNavigate(config) {\n if (!config) {\n return;\n }\n const savedRouteForRedirect = this.getStoredRedirectRoute(config);\n if (savedRouteForRedirect != null) {\n this.deleteStoredRedirectRoute(config);\n this.router.navigateByUrl(savedRouteForRedirect);\n }\n }\n /**\n * Saves the redirect URL to storage.\n *\n * @param config The OpenId configuration.\n * @param url The redirect URL to save.\n */\n saveRedirectRoute(config, url) {\n if (!config) {\n return;\n }\n this.storageService.write(STORAGE_KEY, url, config);\n }\n /**\n * Gets the stored redirect URL from storage.\n */\n getStoredRedirectRoute(config) {\n return this.storageService.read(STORAGE_KEY, config);\n }\n /**\n * Removes the redirect URL from storage.\n */\n deleteStoredRedirectRoute(config) {\n this.storageService.remove(STORAGE_KEY, config);\n }\n static {\n this.ɵfac = function AutoLoginService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || AutoLoginService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: AutoLoginService,\n factory: AutoLoginService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return AutoLoginService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet FlowHelper = /*#__PURE__*/(() => {\n class FlowHelper {\n isCurrentFlowCodeFlow(configuration) {\n return this.currentFlowIs('code', configuration);\n }\n isCurrentFlowAnyImplicitFlow(configuration) {\n return this.isCurrentFlowImplicitFlowWithAccessToken(configuration) || this.isCurrentFlowImplicitFlowWithoutAccessToken(configuration);\n }\n isCurrentFlowCodeFlowWithRefreshTokens(configuration) {\n if (!configuration) {\n return false;\n }\n const {\n useRefreshToken\n } = configuration;\n return this.isCurrentFlowCodeFlow(configuration) && Boolean(useRefreshToken);\n }\n isCurrentFlowImplicitFlowWithAccessToken(configuration) {\n return this.currentFlowIs('id_token token', configuration);\n }\n currentFlowIs(flowTypes, configuration) {\n const {\n responseType\n } = configuration;\n if (Array.isArray(flowTypes)) {\n return flowTypes.some(x => responseType === x);\n }\n return responseType === flowTypes;\n }\n isCurrentFlowImplicitFlowWithoutAccessToken(configuration) {\n return this.currentFlowIs('id_token', configuration);\n }\n static {\n this.ɵfac = function FlowHelper_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || FlowHelper)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: FlowHelper,\n factory: FlowHelper.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return FlowHelper;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet RandomService = /*#__PURE__*/(() => {\n class RandomService {\n constructor() {\n this.loggerService = inject(LoggerService);\n this.cryptoService = inject(CryptoService);\n }\n createRandom(requiredLength, configuration) {\n if (requiredLength <= 0) {\n return '';\n }\n if (requiredLength > 0 && requiredLength < 7) {\n this.loggerService.logWarning(configuration, `RandomService called with ${requiredLength} but 7 chars is the minimum, returning 10 chars`);\n requiredLength = 10;\n }\n const length = requiredLength - 6;\n const arr = new Uint8Array(Math.floor(length / 2));\n const crypto = this.cryptoService.getCrypto();\n if (crypto) {\n crypto.getRandomValues(arr);\n }\n return Array.from(arr, this.toHex).join('') + this.randomString(7);\n }\n toHex(dec) {\n return ('0' + dec.toString(16)).substr(-2);\n }\n randomString(length) {\n let result = '';\n const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n const values = new Uint32Array(length);\n const crypto = this.cryptoService.getCrypto();\n if (crypto) {\n crypto.getRandomValues(values);\n for (let i = 0; i < length; i++) {\n result += characters[values[i] % characters.length];\n }\n }\n return result;\n }\n static {\n this.ɵfac = function RandomService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || RandomService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RandomService,\n factory: RandomService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return RandomService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet FlowsDataService = /*#__PURE__*/(() => {\n class FlowsDataService {\n constructor() {\n this.loggerService = inject(LoggerService);\n this.storagePersistenceService = inject(StoragePersistenceService);\n this.randomService = inject(RandomService);\n }\n createNonce(configuration) {\n const nonce = this.randomService.createRandom(40, configuration);\n this.loggerService.logDebug(configuration, 'Nonce created. nonce:' + nonce);\n this.setNonce(nonce, configuration);\n return nonce;\n }\n setNonce(nonce, configuration) {\n this.storagePersistenceService.write('authNonce', nonce, configuration);\n }\n getAuthStateControl(configuration) {\n if (!configuration) {\n return '';\n }\n return this.storagePersistenceService.read('authStateControl', configuration);\n }\n setAuthStateControl(authStateControl, configuration) {\n if (!configuration) {\n return false;\n }\n return this.storagePersistenceService.write('authStateControl', authStateControl, configuration);\n }\n getExistingOrCreateAuthStateControl(configuration) {\n let state = this.storagePersistenceService.read('authStateControl', configuration);\n if (!state) {\n state = this.randomService.createRandom(40, configuration);\n this.storagePersistenceService.write('authStateControl', state, configuration);\n }\n return state;\n }\n setSessionState(sessionState, configuration) {\n this.storagePersistenceService.write('session_state', sessionState, configuration);\n }\n resetStorageFlowData(configuration) {\n this.storagePersistenceService.resetStorageFlowData(configuration);\n }\n getCodeVerifier(configuration) {\n return this.storagePersistenceService.read('codeVerifier', configuration);\n }\n createCodeVerifier(configuration) {\n const codeVerifier = this.randomService.createRandom(67, configuration);\n this.storagePersistenceService.write('codeVerifier', codeVerifier, configuration);\n return codeVerifier;\n }\n isCodeFlowInProgress(configuration) {\n return !!this.storagePersistenceService.read('storageCodeFlowInProgress', configuration);\n }\n setCodeFlowInProgress(configuration) {\n this.storagePersistenceService.write('storageCodeFlowInProgress', true, configuration);\n }\n resetCodeFlowInProgress(configuration) {\n this.storagePersistenceService.write('storageCodeFlowInProgress', false, configuration);\n }\n isSilentRenewRunning(configuration) {\n const {\n configId,\n silentRenewTimeoutInSeconds\n } = configuration;\n const storageObject = this.getSilentRenewRunningStorageEntry(configuration);\n if (!storageObject) {\n return false;\n }\n if (storageObject.state === 'not-running') {\n return false;\n }\n const timeOutInMilliseconds = (silentRenewTimeoutInSeconds ?? 0) * 1000;\n const dateOfLaunchedProcessUtc = Date.parse(storageObject.dateOfLaunchedProcessUtc);\n const currentDateUtc = Date.parse(new Date().toISOString());\n const elapsedTimeInMilliseconds = Math.abs(currentDateUtc - dateOfLaunchedProcessUtc);\n const isProbablyStuck = elapsedTimeInMilliseconds > timeOutInMilliseconds;\n if (isProbablyStuck) {\n this.loggerService.logDebug(configuration, 'silent renew process is probably stuck, state will be reset.', configId);\n this.resetSilentRenewRunning(configuration);\n return false;\n }\n return storageObject.state === 'running';\n }\n setSilentRenewRunning(configuration) {\n const storageObject = {\n state: 'running',\n dateOfLaunchedProcessUtc: new Date().toISOString()\n };\n this.storagePersistenceService.write('storageSilentRenewRunning', JSON.stringify(storageObject), configuration);\n }\n resetSilentRenewRunning(configuration) {\n if (!configuration) {\n return;\n }\n this.storagePersistenceService.write('storageSilentRenewRunning', '', configuration);\n }\n getSilentRenewRunningStorageEntry(configuration) {\n const storageEntry = this.storagePersistenceService.read('storageSilentRenewRunning', configuration);\n if (!storageEntry) {\n return {\n dateOfLaunchedProcessUtc: '',\n state: 'not-running'\n };\n }\n return JSON.parse(storageEntry);\n }\n static {\n this.ɵfac = function FlowsDataService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || FlowsDataService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: FlowsDataService,\n factory: FlowsDataService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return FlowsDataService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nclass UriEncoder {\n encodeKey(key) {\n return encodeURIComponent(key);\n }\n encodeValue(value) {\n return encodeURIComponent(value);\n }\n decodeKey(key) {\n return decodeURIComponent(key);\n }\n decodeValue(value) {\n return decodeURIComponent(value);\n }\n}\nconst CALLBACK_PARAMS_TO_CHECK = ['code', 'state', 'token', 'id_token'];\nconst AUTH0_ENDPOINT = 'auth0.com';\nlet UrlService = /*#__PURE__*/(() => {\n class UrlService {\n constructor() {\n this.loggerService = inject(LoggerService);\n this.flowsDataService = inject(FlowsDataService);\n this.flowHelper = inject(FlowHelper);\n this.storagePersistenceService = inject(StoragePersistenceService);\n this.jwtWindowCryptoService = inject(JwtWindowCryptoService);\n }\n getUrlParameter(urlToCheck, name) {\n if (!urlToCheck) {\n return '';\n }\n if (!name) {\n return '';\n }\n name = name.replace(/[[]/, '\\\\[').replace(/[\\]]/, '\\\\]');\n const regex = new RegExp('[\\\\?&#]' + name + '=([^&#]*)');\n const results = regex.exec(urlToCheck);\n return results === null ? '' : decodeURIComponent(results[1]);\n }\n getUrlWithoutQueryParameters(url) {\n const u = new URL(url.toString());\n const keys = [];\n for (const key of u.searchParams.keys()) {\n keys.push(key);\n }\n keys.forEach(key => {\n u.searchParams.delete(key);\n });\n return u;\n }\n queryParametersExist(expected, actual) {\n let r = true;\n expected.forEach((v, k) => {\n if (!actual.has(k)) {\n r = false;\n }\n });\n return r;\n }\n isCallbackFromSts(currentUrl, config) {\n if (config && config.checkRedirectUrlWhenCheckingIfIsCallback) {\n const currentUrlInstance = new URL(currentUrl);\n const redirectUrl = this.getRedirectUrl(config);\n if (!redirectUrl) {\n this.loggerService.logError(config, `UrlService.isCallbackFromSts: could not get redirectUrl from config, was: `, redirectUrl);\n return false;\n }\n const redirectUriUrlInstance = new URL(redirectUrl);\n const redirectUriWithoutQueryParams = this.getUrlWithoutQueryParameters(redirectUriUrlInstance).toString();\n const currentUrlWithoutQueryParams = this.getUrlWithoutQueryParameters(currentUrlInstance).toString();\n const redirectUriQueryParamsArePresentInCurrentUrl = this.queryParametersExist(redirectUriUrlInstance.searchParams, currentUrlInstance.searchParams);\n if (redirectUriWithoutQueryParams !== currentUrlWithoutQueryParams || !redirectUriQueryParamsArePresentInCurrentUrl) {\n return false;\n }\n }\n return CALLBACK_PARAMS_TO_CHECK.some(x => !!this.getUrlParameter(currentUrl, x));\n }\n getRefreshSessionSilentRenewUrl(config, customParams) {\n if (this.flowHelper.isCurrentFlowCodeFlow(config)) {\n return this.createUrlCodeFlowWithSilentRenew(config, customParams);\n }\n return of(this.createUrlImplicitFlowWithSilentRenew(config, customParams));\n }\n getAuthorizeParUrl(requestUri, configuration) {\n const authWellKnownEndPoints = this.storagePersistenceService.read('authWellKnownEndPoints', configuration);\n if (!authWellKnownEndPoints) {\n this.loggerService.logError(configuration, 'authWellKnownEndpoints is undefined');\n return null;\n }\n const authorizationEndpoint = authWellKnownEndPoints.authorizationEndpoint;\n if (!authorizationEndpoint) {\n this.loggerService.logError(configuration, `Can not create an authorize URL when authorizationEndpoint is '${authorizationEndpoint}'`);\n return null;\n }\n const {\n clientId\n } = configuration;\n if (!clientId) {\n this.loggerService.logError(configuration, `getAuthorizeParUrl could not add clientId because it was: `, clientId);\n return null;\n }\n const urlParts = authorizationEndpoint.split('?');\n const authorizationUrl = urlParts[0];\n const existingParams = urlParts[1];\n let params = this.createHttpParams(existingParams);\n params = params.set('request_uri', requestUri);\n params = params.append('client_id', clientId);\n return `${authorizationUrl}?${params}`;\n }\n getAuthorizeUrl(config, authOptions) {\n if (!config) {\n return of(null);\n }\n if (this.flowHelper.isCurrentFlowCodeFlow(config)) {\n return this.createUrlCodeFlowAuthorize(config, authOptions);\n }\n return of(this.createUrlImplicitFlowAuthorize(config, authOptions) || '');\n }\n getEndSessionEndpoint(configuration) {\n const authWellKnownEndPoints = this.storagePersistenceService.read('authWellKnownEndPoints', configuration);\n const endSessionEndpoint = authWellKnownEndPoints?.endSessionEndpoint;\n if (!endSessionEndpoint) {\n return {\n url: '',\n existingParams: ''\n };\n }\n const urlParts = endSessionEndpoint.split('?');\n const url = urlParts[0];\n const existingParams = urlParts[1] ?? '';\n return {\n url,\n existingParams\n };\n }\n getEndSessionUrl(configuration, customParams) {\n if (!configuration) {\n return null;\n }\n const idToken = this.storagePersistenceService.getIdToken(configuration);\n const {\n customParamsEndSessionRequest\n } = configuration;\n const mergedParams = {\n ...customParamsEndSessionRequest,\n ...customParams\n };\n return this.createEndSessionUrl(idToken, configuration, mergedParams);\n }\n createRevocationEndpointBodyAccessToken(token, configuration) {\n const clientId = this.getClientId(configuration);\n if (!clientId) {\n return null;\n }\n let params = this.createHttpParams();\n params = params.set('client_id', clientId);\n params = params.set('token', token);\n params = params.set('token_type_hint', 'access_token');\n return params.toString();\n }\n createRevocationEndpointBodyRefreshToken(token, configuration) {\n const clientId = this.getClientId(configuration);\n if (!clientId) {\n return null;\n }\n let params = this.createHttpParams();\n params = params.set('client_id', clientId);\n params = params.set('token', token);\n params = params.set('token_type_hint', 'refresh_token');\n return params.toString();\n }\n getRevocationEndpointUrl(configuration) {\n const authWellKnownEndPoints = this.storagePersistenceService.read('authWellKnownEndPoints', configuration);\n const revocationEndpoint = authWellKnownEndPoints?.revocationEndpoint;\n if (!revocationEndpoint) {\n return null;\n }\n const urlParts = revocationEndpoint.split('?');\n return urlParts[0];\n }\n createBodyForCodeFlowCodeRequest(code, configuration, customTokenParams) {\n const clientId = this.getClientId(configuration);\n if (!clientId) {\n return null;\n }\n let params = this.createHttpParams();\n params = params.set('grant_type', 'authorization_code');\n params = params.set('client_id', clientId);\n if (!configuration.disablePkce) {\n const codeVerifier = this.flowsDataService.getCodeVerifier(configuration);\n if (!codeVerifier) {\n this.loggerService.logError(configuration, `CodeVerifier is not set `, codeVerifier);\n return null;\n }\n params = params.set('code_verifier', codeVerifier);\n }\n params = params.set('code', code);\n if (customTokenParams) {\n params = this.appendCustomParams({\n ...customTokenParams\n }, params);\n }\n const silentRenewUrl = this.getSilentRenewUrl(configuration);\n if (this.flowsDataService.isSilentRenewRunning(configuration) && silentRenewUrl) {\n params = params.set('redirect_uri', silentRenewUrl);\n return params.toString();\n }\n const redirectUrl = this.getRedirectUrl(configuration);\n if (!redirectUrl) {\n return null;\n }\n params = params.set('redirect_uri', redirectUrl);\n return params.toString();\n }\n createBodyForCodeFlowRefreshTokensRequest(refreshToken, configuration, customParamsRefresh) {\n const clientId = this.getClientId(configuration);\n if (!clientId) {\n return null;\n }\n let params = this.createHttpParams();\n params = params.set('grant_type', 'refresh_token');\n params = params.set('client_id', clientId);\n params = params.set('refresh_token', refreshToken);\n if (customParamsRefresh) {\n params = this.appendCustomParams({\n ...customParamsRefresh\n }, params);\n }\n return params.toString();\n }\n createBodyForParCodeFlowRequest(configuration, authOptions) {\n const redirectUrl = this.getRedirectUrl(configuration, authOptions);\n if (!redirectUrl) {\n return of(null);\n }\n const state = this.flowsDataService.getExistingOrCreateAuthStateControl(configuration);\n const nonce = this.flowsDataService.createNonce(configuration);\n this.loggerService.logDebug(configuration, 'Authorize created. adding myautostate: ' + state);\n // code_challenge with \"S256\"\n const codeVerifier = this.flowsDataService.createCodeVerifier(configuration);\n return this.jwtWindowCryptoService.generateCodeChallenge(codeVerifier).pipe(map(codeChallenge => {\n const {\n clientId,\n responseType,\n scope,\n hdParam,\n customParamsAuthRequest\n } = configuration;\n let params = this.createHttpParams('');\n params = params.set('client_id', clientId ?? '');\n params = params.append('redirect_uri', redirectUrl);\n params = params.append('response_type', responseType ?? '');\n params = params.append('scope', scope ?? '');\n params = params.append('nonce', nonce);\n params = params.append('state', state);\n params = params.append('code_challenge', codeChallenge);\n params = params.append('code_challenge_method', 'S256');\n if (hdParam) {\n params = params.append('hd', hdParam);\n }\n if (customParamsAuthRequest) {\n params = this.appendCustomParams({\n ...customParamsAuthRequest\n }, params);\n }\n if (authOptions?.customParams) {\n params = this.appendCustomParams({\n ...authOptions.customParams\n }, params);\n }\n return params.toString();\n }));\n }\n getPostLogoutRedirectUrl(configuration) {\n const {\n postLogoutRedirectUri\n } = configuration;\n if (!postLogoutRedirectUri) {\n this.loggerService.logError(configuration, `could not get postLogoutRedirectUri, was: `, postLogoutRedirectUri);\n return null;\n }\n return postLogoutRedirectUri;\n }\n createEndSessionUrl(idTokenHint, configuration, customParamsEndSession) {\n // Auth0 needs a special logout url\n // See https://auth0.com/docs/api/authentication#logout\n if (this.isAuth0Endpoint(configuration)) {\n return this.composeAuth0Endpoint(configuration);\n }\n const {\n url,\n existingParams\n } = this.getEndSessionEndpoint(configuration);\n if (!url) {\n return null;\n }\n let params = this.createHttpParams(existingParams);\n if (!!idTokenHint) {\n params = params.set('id_token_hint', idTokenHint);\n }\n const postLogoutRedirectUri = this.getPostLogoutRedirectUrl(configuration);\n if (postLogoutRedirectUri) {\n params = params.append('post_logout_redirect_uri', postLogoutRedirectUri);\n }\n if (customParamsEndSession) {\n params = this.appendCustomParams({\n ...customParamsEndSession\n }, params);\n }\n return `${url}?${params}`;\n }\n createAuthorizeUrl(codeChallenge, redirectUrl, nonce, state, configuration, prompt, customRequestParams) {\n const authWellKnownEndPoints = this.storagePersistenceService.read('authWellKnownEndPoints', configuration);\n const authorizationEndpoint = authWellKnownEndPoints?.authorizationEndpoint;\n if (!authorizationEndpoint) {\n this.loggerService.logError(configuration, `Can not create an authorize URL when authorizationEndpoint is '${authorizationEndpoint}'`);\n return '';\n }\n const {\n clientId,\n responseType,\n scope,\n hdParam,\n customParamsAuthRequest\n } = configuration;\n if (!clientId) {\n this.loggerService.logError(configuration, `createAuthorizeUrl could not add clientId because it was: `, clientId);\n return '';\n }\n if (!responseType) {\n this.loggerService.logError(configuration, `createAuthorizeUrl could not add responseType because it was: `, responseType);\n return '';\n }\n if (!scope) {\n this.loggerService.logError(configuration, `createAuthorizeUrl could not add scope because it was: `, scope);\n return '';\n }\n const urlParts = authorizationEndpoint.split('?');\n const authorizationUrl = urlParts[0];\n const existingParams = urlParts[1];\n let params = this.createHttpParams(existingParams);\n params = params.set('client_id', clientId);\n params = params.append('redirect_uri', redirectUrl);\n params = params.append('response_type', responseType);\n params = params.append('scope', scope);\n params = params.append('nonce', nonce);\n params = params.append('state', state);\n if (this.flowHelper.isCurrentFlowCodeFlow(configuration)) {\n params = params.append('code_challenge', codeChallenge);\n params = params.append('code_challenge_method', 'S256');\n }\n const mergedParams = {\n ...customParamsAuthRequest,\n ...customRequestParams\n };\n if (Object.keys(mergedParams).length > 0) {\n params = this.appendCustomParams({\n ...mergedParams\n }, params);\n }\n if (prompt) {\n params = this.overWriteParam(params, 'prompt', prompt);\n }\n if (hdParam) {\n params = params.append('hd', hdParam);\n }\n return `${authorizationUrl}?${params}`;\n }\n createUrlImplicitFlowWithSilentRenew(configuration, customParams) {\n const state = this.flowsDataService.getExistingOrCreateAuthStateControl(configuration);\n const nonce = this.flowsDataService.createNonce(configuration);\n const silentRenewUrl = this.getSilentRenewUrl(configuration);\n if (!silentRenewUrl) {\n return null;\n }\n this.loggerService.logDebug(configuration, 'RefreshSession created. adding myautostate: ', state);\n const authWellKnownEndPoints = this.storagePersistenceService.read('authWellKnownEndPoints', configuration);\n if (authWellKnownEndPoints) {\n return this.createAuthorizeUrl('', silentRenewUrl, nonce, state, configuration, 'none', customParams);\n }\n this.loggerService.logError(configuration, 'authWellKnownEndpoints is undefined');\n return null;\n }\n createUrlCodeFlowWithSilentRenew(configuration, customParams) {\n const state = this.flowsDataService.getExistingOrCreateAuthStateControl(configuration);\n const nonce = this.flowsDataService.createNonce(configuration);\n this.loggerService.logDebug(configuration, 'RefreshSession created. adding myautostate: ' + state);\n // code_challenge with \"S256\"\n const codeVerifier = this.flowsDataService.createCodeVerifier(configuration);\n return this.jwtWindowCryptoService.generateCodeChallenge(codeVerifier).pipe(map(codeChallenge => {\n const silentRenewUrl = this.getSilentRenewUrl(configuration);\n if (!silentRenewUrl) {\n return '';\n }\n const authWellKnownEndPoints = this.storagePersistenceService.read('authWellKnownEndPoints', configuration);\n if (authWellKnownEndPoints) {\n return this.createAuthorizeUrl(codeChallenge, silentRenewUrl, nonce, state, configuration, 'none', customParams);\n }\n this.loggerService.logWarning(configuration, 'authWellKnownEndpoints is undefined');\n return '';\n }));\n }\n createUrlImplicitFlowAuthorize(configuration, authOptions) {\n const state = this.flowsDataService.getExistingOrCreateAuthStateControl(configuration);\n const nonce = this.flowsDataService.createNonce(configuration);\n this.loggerService.logDebug(configuration, 'Authorize created. adding myautostate: ' + state);\n const redirectUrl = this.getRedirectUrl(configuration, authOptions);\n if (!redirectUrl) {\n return null;\n }\n const authWellKnownEndPoints = this.storagePersistenceService.read('authWellKnownEndPoints', configuration);\n if (authWellKnownEndPoints) {\n const {\n customParams\n } = authOptions || {};\n return this.createAuthorizeUrl('', redirectUrl, nonce, state, configuration, '', customParams);\n }\n this.loggerService.logError(configuration, 'authWellKnownEndpoints is undefined');\n return null;\n }\n createUrlCodeFlowAuthorize(config, authOptions) {\n const state = this.flowsDataService.getExistingOrCreateAuthStateControl(config);\n const nonce = this.flowsDataService.createNonce(config);\n this.loggerService.logDebug(config, 'Authorize created. adding myautostate: ' + state);\n const redirectUrl = this.getRedirectUrl(config, authOptions);\n if (!redirectUrl) {\n return of(null);\n }\n return this.getCodeChallenge(config).pipe(map(codeChallenge => {\n const authWellKnownEndPoints = this.storagePersistenceService.read('authWellKnownEndPoints', config);\n if (authWellKnownEndPoints) {\n const {\n customParams\n } = authOptions || {};\n return this.createAuthorizeUrl(codeChallenge, redirectUrl, nonce, state, config, '', customParams);\n }\n this.loggerService.logError(config, 'authWellKnownEndpoints is undefined');\n return '';\n }));\n }\n getCodeChallenge(config) {\n if (config.disablePkce) {\n return of('');\n }\n // code_challenge with \"S256\"\n const codeVerifier = this.flowsDataService.createCodeVerifier(config);\n return this.jwtWindowCryptoService.generateCodeChallenge(codeVerifier);\n }\n getRedirectUrl(configuration, authOptions) {\n let {\n redirectUrl\n } = configuration;\n if (authOptions?.redirectUrl) {\n // override by redirectUrl from authOptions\n redirectUrl = authOptions.redirectUrl;\n }\n if (!redirectUrl) {\n this.loggerService.logError(configuration, `could not get redirectUrl, was: `, redirectUrl);\n return null;\n }\n return redirectUrl;\n }\n getSilentRenewUrl(configuration) {\n const {\n silentRenewUrl\n } = configuration;\n if (!silentRenewUrl) {\n this.loggerService.logError(configuration, `could not get silentRenewUrl, was: `, silentRenewUrl);\n return null;\n }\n return silentRenewUrl;\n }\n getClientId(configuration) {\n const {\n clientId\n } = configuration;\n if (!clientId) {\n this.loggerService.logError(configuration, `could not get clientId, was: `, clientId);\n return null;\n }\n return clientId;\n }\n appendCustomParams(customParams, params) {\n for (const [key, value] of Object.entries({\n ...customParams\n })) {\n params = params.append(key, value.toString());\n }\n return params;\n }\n overWriteParam(params, key, value) {\n return params.set(key, value);\n }\n createHttpParams(existingParams) {\n existingParams = existingParams ?? '';\n return new HttpParams({\n fromString: existingParams,\n encoder: new UriEncoder()\n });\n }\n isAuth0Endpoint(configuration) {\n const {\n authority,\n useCustomAuth0Domain\n } = configuration;\n if (!authority) {\n return false;\n }\n return authority.endsWith(AUTH0_ENDPOINT) || Boolean(useCustomAuth0Domain);\n }\n composeAuth0Endpoint(configuration) {\n // format: https://YOUR_DOMAIN/v2/logout?client_id=YOUR_CLIENT_ID&returnTo=LOGOUT_URL\n const {\n authority,\n clientId\n } = configuration;\n const postLogoutRedirectUrl = this.getPostLogoutRedirectUrl(configuration);\n return `${authority}/v2/logout?client_id=${clientId}&returnTo=${postLogoutRedirectUrl}`;\n }\n static {\n this.ɵfac = function UrlService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || UrlService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: UrlService,\n factory: UrlService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return UrlService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet HttpBaseService = /*#__PURE__*/(() => {\n class HttpBaseService {\n constructor() {\n this.http = inject(HttpClient);\n }\n get(url, params) {\n return this.http.get(url, params);\n }\n post(url, body, params) {\n return this.http.post(url, body, params);\n }\n static {\n this.ɵfac = function HttpBaseService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || HttpBaseService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: HttpBaseService,\n factory: HttpBaseService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return HttpBaseService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst NGSW_CUSTOM_PARAM = 'ngsw-bypass';\nlet DataService = /*#__PURE__*/(() => {\n class DataService {\n constructor() {\n this.httpClient = inject(HttpBaseService);\n }\n get(url, config, token) {\n const headers = this.prepareHeaders(token);\n const params = this.prepareParams(config);\n return this.httpClient.get(url, {\n headers,\n params\n });\n }\n post(url, body, config, headersParams) {\n const headers = headersParams || this.prepareHeaders();\n const params = this.prepareParams(config);\n return this.httpClient.post(url ?? '', body, {\n headers,\n params\n });\n }\n prepareHeaders(token) {\n let headers = new HttpHeaders();\n headers = headers.set('Accept', 'application/json');\n if (!!token) {\n headers = headers.set('Authorization', 'Bearer ' + decodeURIComponent(token));\n }\n return headers;\n }\n prepareParams(config) {\n let params = new HttpParams();\n const {\n ngswBypass\n } = config;\n if (ngswBypass) {\n params = params.set(NGSW_CUSTOM_PARAM, '');\n }\n return params;\n }\n static {\n this.ɵfac = function DataService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || DataService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: DataService,\n factory: DataService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return DataService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * checks if the error is a network error\n * by checking if either internal error is a ProgressEvent with type error\n * or another error with status 0\n * @param error\n * @returns true if the error is a network error\n */\nconst isNetworkError = error => !!error && error instanceof HttpErrorResponse && (error.error instanceof ProgressEvent && error.error.type === 'error' || error.status === 0 && !!error.error);\nlet CodeFlowCallbackHandlerService = /*#__PURE__*/(() => {\n class CodeFlowCallbackHandlerService {\n constructor() {\n this.urlService = inject(UrlService);\n this.loggerService = inject(LoggerService);\n this.tokenValidationService = inject(TokenValidationService);\n this.flowsDataService = inject(FlowsDataService);\n this.storagePersistenceService = inject(StoragePersistenceService);\n this.dataService = inject(DataService);\n }\n // STEP 1 Code Flow\n codeFlowCallback(urlToCheck, config) {\n const code = this.urlService.getUrlParameter(urlToCheck, 'code');\n const state = this.urlService.getUrlParameter(urlToCheck, 'state');\n const sessionState = this.urlService.getUrlParameter(urlToCheck, 'session_state');\n if (!state) {\n this.loggerService.logDebug(config, 'no state in url');\n return throwError(() => new Error('no state in url'));\n }\n if (!code) {\n this.loggerService.logDebug(config, 'no code in url');\n return throwError(() => new Error('no code in url'));\n }\n this.loggerService.logDebug(config, 'running validation for callback', urlToCheck);\n const initialCallbackContext = {\n code,\n refreshToken: '',\n state,\n sessionState,\n authResult: null,\n isRenewProcess: false,\n jwtKeys: null,\n validationResult: null,\n existingIdToken: null\n };\n return of(initialCallbackContext);\n }\n // STEP 2 Code Flow // Code Flow Silent Renew starts here\n codeFlowCodeRequest(callbackContext, config) {\n const authStateControl = this.flowsDataService.getAuthStateControl(config);\n const isStateCorrect = this.tokenValidationService.validateStateFromHashCallback(callbackContext.state, authStateControl, config);\n if (!isStateCorrect) {\n return throwError(() => new Error('codeFlowCodeRequest incorrect state'));\n }\n const authWellknownEndpoints = this.storagePersistenceService.read('authWellKnownEndPoints', config);\n const tokenEndpoint = authWellknownEndpoints?.tokenEndpoint;\n if (!tokenEndpoint) {\n return throwError(() => new Error('Token Endpoint not defined'));\n }\n let headers = new HttpHeaders();\n headers = headers.set('Content-Type', 'application/x-www-form-urlencoded');\n const bodyForCodeFlow = this.urlService.createBodyForCodeFlowCodeRequest(callbackContext.code, config, config?.customParamsCodeRequest);\n return this.dataService.post(tokenEndpoint, bodyForCodeFlow, config, headers).pipe(switchMap(response => {\n if (response) {\n const authResult = {\n ...response,\n state: callbackContext.state,\n session_state: callbackContext.sessionState\n };\n callbackContext.authResult = authResult;\n }\n return of(callbackContext);\n }), retryWhen(error => this.handleRefreshRetry(error, config)), catchError(error => {\n const {\n authority\n } = config;\n const errorMessage = `OidcService code request ${authority}`;\n this.loggerService.logError(config, errorMessage, error);\n return throwError(() => new Error(errorMessage));\n }));\n }\n handleRefreshRetry(errors, config) {\n return errors.pipe(mergeMap(error => {\n // retry token refresh if there is no internet connection\n if (isNetworkError(error)) {\n const {\n authority,\n refreshTokenRetryInSeconds\n } = config;\n const errorMessage = `OidcService code request ${authority} - no internet connection`;\n this.loggerService.logWarning(config, errorMessage, error);\n return timer((refreshTokenRetryInSeconds ?? 0) * 1000);\n }\n return throwError(() => error);\n }));\n }\n static {\n this.ɵfac = function CodeFlowCallbackHandlerService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || CodeFlowCallbackHandlerService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: CodeFlowCallbackHandlerService,\n factory: CodeFlowCallbackHandlerService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return CodeFlowCallbackHandlerService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nvar ValidationResult = /*#__PURE__*/function (ValidationResult) {\n ValidationResult[\"NotSet\"] = \"NotSet\";\n ValidationResult[\"StatesDoNotMatch\"] = \"StatesDoNotMatch\";\n ValidationResult[\"SignatureFailed\"] = \"SignatureFailed\";\n ValidationResult[\"IncorrectNonce\"] = \"IncorrectNonce\";\n ValidationResult[\"RequiredPropertyMissing\"] = \"RequiredPropertyMissing\";\n ValidationResult[\"MaxOffsetExpired\"] = \"MaxOffsetExpired\";\n ValidationResult[\"IssDoesNotMatchIssuer\"] = \"IssDoesNotMatchIssuer\";\n ValidationResult[\"NoAuthWellKnownEndPoints\"] = \"NoAuthWellKnownEndPoints\";\n ValidationResult[\"IncorrectAud\"] = \"IncorrectAud\";\n ValidationResult[\"IncorrectIdTokenClaimsAfterRefresh\"] = \"IncorrectIdTokenClaimsAfterRefresh\";\n ValidationResult[\"IncorrectAzp\"] = \"IncorrectAzp\";\n ValidationResult[\"TokenExpired\"] = \"TokenExpired\";\n ValidationResult[\"IncorrectAtHash\"] = \"IncorrectAtHash\";\n ValidationResult[\"Ok\"] = \"Ok\";\n ValidationResult[\"LoginRequired\"] = \"LoginRequired\";\n ValidationResult[\"SecureTokenServerError\"] = \"SecureTokenServerError\";\n return ValidationResult;\n}(ValidationResult || {});\nconst DEFAULT_USERRESULT = {\n userData: null,\n allUserData: []\n};\nlet UserService = /*#__PURE__*/(() => {\n class UserService {\n constructor() {\n this.userDataInternal$ = new BehaviorSubject(DEFAULT_USERRESULT);\n this.loggerService = inject(LoggerService);\n this.tokenHelperService = inject(TokenHelperService);\n this.flowHelper = inject(FlowHelper);\n this.oidcDataService = inject(DataService);\n this.storagePersistenceService = inject(StoragePersistenceService);\n this.eventService = inject(PublicEventsService);\n }\n get userData$() {\n return this.userDataInternal$.asObservable();\n }\n getAndPersistUserDataInStore(currentConfiguration, allConfigs, isRenewProcess = false, idToken, decodedIdToken) {\n idToken = idToken || this.storagePersistenceService.getIdToken(currentConfiguration);\n decodedIdToken = decodedIdToken || this.tokenHelperService.getPayloadFromToken(idToken, false, currentConfiguration);\n const existingUserDataFromStorage = this.getUserDataFromStore(currentConfiguration);\n const haveUserData = !!existingUserDataFromStorage;\n const isCurrentFlowImplicitFlowWithAccessToken = this.flowHelper.isCurrentFlowImplicitFlowWithAccessToken(currentConfiguration);\n const isCurrentFlowCodeFlow = this.flowHelper.isCurrentFlowCodeFlow(currentConfiguration);\n const accessToken = this.storagePersistenceService.getAccessToken(currentConfiguration);\n if (!(isCurrentFlowImplicitFlowWithAccessToken || isCurrentFlowCodeFlow)) {\n this.loggerService.logDebug(currentConfiguration, `authCallback idToken flow with accessToken ${accessToken}`);\n this.setUserDataToStore(decodedIdToken, currentConfiguration, allConfigs);\n return of(decodedIdToken);\n }\n const {\n renewUserInfoAfterTokenRenew\n } = currentConfiguration;\n if (!isRenewProcess || renewUserInfoAfterTokenRenew || !haveUserData) {\n return this.getUserDataOidcFlowAndSave(decodedIdToken.sub, currentConfiguration, allConfigs).pipe(switchMap(userData => {\n this.loggerService.logDebug(currentConfiguration, 'Received user data: ', userData);\n if (!!userData) {\n this.loggerService.logDebug(currentConfiguration, 'accessToken: ', accessToken);\n return of(userData);\n } else {\n return throwError(() => new Error('Received no user data, request failed'));\n }\n }));\n }\n return of(existingUserDataFromStorage);\n }\n getUserDataFromStore(currentConfiguration) {\n if (!currentConfiguration) {\n return throwError(() => new Error('Please provide a configuration before setting up the module'));\n }\n return this.storagePersistenceService.read('userData', currentConfiguration) || null;\n }\n publishUserDataIfExists(currentConfiguration, allConfigs) {\n const userData = this.getUserDataFromStore(currentConfiguration);\n if (userData) {\n this.fireUserDataEvent(currentConfiguration, allConfigs, userData);\n }\n }\n setUserDataToStore(userData, currentConfiguration, allConfigs) {\n this.storagePersistenceService.write('userData', userData, currentConfiguration);\n this.fireUserDataEvent(currentConfiguration, allConfigs, userData);\n }\n resetUserDataInStore(currentConfiguration, allConfigs) {\n this.storagePersistenceService.remove('userData', currentConfiguration);\n this.fireUserDataEvent(currentConfiguration, allConfigs, null);\n }\n getUserDataOidcFlowAndSave(idTokenSub, currentConfiguration, allConfigs) {\n return this.getIdentityUserData(currentConfiguration).pipe(map(data => {\n if (this.validateUserDataSubIdToken(currentConfiguration, idTokenSub, data?.sub)) {\n this.setUserDataToStore(data, currentConfiguration, allConfigs);\n return data;\n } else {\n // something went wrong, user data sub does not match that from id_token\n this.loggerService.logWarning(currentConfiguration, `User data sub does not match sub in id_token, resetting`);\n this.resetUserDataInStore(currentConfiguration, allConfigs);\n return null;\n }\n }));\n }\n getIdentityUserData(currentConfiguration) {\n const token = this.storagePersistenceService.getAccessToken(currentConfiguration);\n const authWellKnownEndPoints = this.storagePersistenceService.read('authWellKnownEndPoints', currentConfiguration);\n if (!authWellKnownEndPoints) {\n this.loggerService.logWarning(currentConfiguration, 'init check session: authWellKnownEndpoints is undefined');\n return throwError(() => new Error('authWellKnownEndpoints is undefined'));\n }\n const userInfoEndpoint = authWellKnownEndPoints.userInfoEndpoint;\n if (!userInfoEndpoint) {\n this.loggerService.logError(currentConfiguration, 'init check session: authWellKnownEndpoints.userinfo_endpoint is undefined; set auto_userinfo = false in config');\n return throwError(() => new Error('authWellKnownEndpoints.userinfo_endpoint is undefined'));\n }\n return this.oidcDataService.get(userInfoEndpoint, currentConfiguration, token).pipe(retry(2));\n }\n validateUserDataSubIdToken(currentConfiguration, idTokenSub, userDataSub) {\n if (!idTokenSub) {\n return false;\n }\n if (!userDataSub) {\n return false;\n }\n if (idTokenSub.toString() !== userDataSub.toString()) {\n this.loggerService.logDebug(currentConfiguration, 'validateUserDataSubIdToken failed', idTokenSub, userDataSub);\n return false;\n }\n return true;\n }\n fireUserDataEvent(currentConfiguration, allConfigs, passedUserData) {\n const userData = this.composeSingleOrMultipleUserDataObject(currentConfiguration, allConfigs, passedUserData);\n this.userDataInternal$.next(userData);\n const {\n configId\n } = currentConfiguration;\n this.eventService.fireEvent(EventTypes.UserDataChanged, {\n configId,\n userData: passedUserData\n });\n }\n composeSingleOrMultipleUserDataObject(currentConfiguration, allConfigs, passedUserData) {\n const hasManyConfigs = allConfigs.length > 1;\n if (!hasManyConfigs) {\n const {\n configId\n } = currentConfiguration;\n return this.composeSingleUserDataResult(configId ?? '', passedUserData);\n }\n const allUserData = allConfigs.map(config => {\n const currentConfigId = currentConfiguration.configId ?? '';\n const configId = config.configId ?? '';\n if (this.currentConfigIsToUpdate(currentConfigId, config)) {\n return {\n configId,\n userData: passedUserData\n };\n }\n const alreadySavedUserData = this.storagePersistenceService.read('userData', config) || null;\n return {\n configId,\n userData: alreadySavedUserData\n };\n });\n return {\n userData: null,\n allUserData\n };\n }\n composeSingleUserDataResult(configId, userData) {\n return {\n userData,\n allUserData: [{\n configId,\n userData\n }]\n };\n }\n currentConfigIsToUpdate(configId, config) {\n return config.configId === configId;\n }\n static {\n this.ɵfac = function UserService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || UserService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: UserService,\n factory: UserService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return UserService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet ResetAuthDataService = /*#__PURE__*/(() => {\n class ResetAuthDataService {\n constructor() {\n this.loggerService = inject(LoggerService);\n this.userService = inject(UserService);\n this.flowsDataService = inject(FlowsDataService);\n this.authStateService = inject(AuthStateService);\n }\n resetAuthorizationData(currentConfiguration, allConfigs) {\n if (!currentConfiguration) {\n return;\n }\n this.userService.resetUserDataInStore(currentConfiguration, allConfigs);\n this.flowsDataService.resetStorageFlowData(currentConfiguration);\n this.authStateService.setUnauthenticatedAndFireEvent(currentConfiguration, allConfigs);\n this.loggerService.logDebug(currentConfiguration, 'Local Login information cleaned up and event fired');\n }\n static {\n this.ɵfac = function ResetAuthDataService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || ResetAuthDataService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ResetAuthDataService,\n factory: ResetAuthDataService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return ResetAuthDataService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet SigninKeyDataService = /*#__PURE__*/(() => {\n class SigninKeyDataService {\n constructor() {\n this.loggerService = inject(LoggerService);\n this.storagePersistenceService = inject(StoragePersistenceService);\n this.dataService = inject(DataService);\n }\n getSigningKeys(currentConfiguration) {\n const authWellKnownEndPoints = this.storagePersistenceService.read('authWellKnownEndPoints', currentConfiguration);\n const jwksUri = authWellKnownEndPoints?.jwksUri;\n if (!jwksUri) {\n const error = `getSigningKeys: authWellKnownEndpoints.jwksUri is: '${jwksUri}'`;\n this.loggerService.logWarning(currentConfiguration, error);\n return throwError(() => new Error(error));\n }\n this.loggerService.logDebug(currentConfiguration, 'Getting signinkeys from ', jwksUri);\n return this.dataService.get(jwksUri, currentConfiguration).pipe(retry(2), catchError(e => this.handleErrorGetSigningKeys(e, currentConfiguration)));\n }\n handleErrorGetSigningKeys(errorResponse, currentConfiguration) {\n let errMsg = '';\n if (errorResponse instanceof HttpResponse) {\n const body = errorResponse.body || {};\n const err = JSON.stringify(body);\n const {\n status,\n statusText\n } = errorResponse;\n errMsg = `${status || ''} - ${statusText || ''} ${err || ''}`;\n } else {\n const {\n message\n } = errorResponse;\n errMsg = !!message ? message : `${errorResponse}`;\n }\n this.loggerService.logError(currentConfiguration, errMsg);\n return throwError(() => new Error(errMsg));\n }\n static {\n this.ɵfac = function SigninKeyDataService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || SigninKeyDataService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: SigninKeyDataService,\n factory: SigninKeyDataService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return SigninKeyDataService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst JWT_KEYS = 'jwtKeys';\nlet HistoryJwtKeysCallbackHandlerService = /*#__PURE__*/(() => {\n class HistoryJwtKeysCallbackHandlerService {\n constructor() {\n this.loggerService = inject(LoggerService);\n this.authStateService = inject(AuthStateService);\n this.flowsDataService = inject(FlowsDataService);\n this.signInKeyDataService = inject(SigninKeyDataService);\n this.storagePersistenceService = inject(StoragePersistenceService);\n this.resetAuthDataService = inject(ResetAuthDataService);\n this.document = inject(DOCUMENT);\n }\n // STEP 3 Code Flow, STEP 2 Implicit Flow, STEP 3 Refresh Token\n callbackHistoryAndResetJwtKeys(callbackContext, config, allConfigs) {\n let toWrite = {\n ...callbackContext.authResult\n };\n if (!this.responseHasIdToken(callbackContext)) {\n const existingIdToken = this.storagePersistenceService.getIdToken(config);\n toWrite = {\n ...toWrite,\n id_token: existingIdToken\n };\n }\n this.storagePersistenceService.write('authnResult', toWrite, config);\n if (config.allowUnsafeReuseRefreshToken && callbackContext.authResult?.refresh_token) {\n this.storagePersistenceService.write('reusable_refresh_token', callbackContext.authResult.refresh_token, config);\n }\n if (this.historyCleanUpTurnedOn(config) && !callbackContext.isRenewProcess) {\n this.resetBrowserHistory();\n } else {\n this.loggerService.logDebug(config, 'history clean up inactive');\n }\n if (callbackContext.authResult?.error) {\n const errorMessage = `AuthCallback AuthResult came with error: ${callbackContext.authResult.error}`;\n this.loggerService.logDebug(config, errorMessage);\n this.resetAuthDataService.resetAuthorizationData(config, allConfigs);\n this.flowsDataService.setNonce('', config);\n this.handleResultErrorFromCallback(callbackContext.authResult, callbackContext.isRenewProcess);\n return throwError(() => new Error(errorMessage));\n }\n this.loggerService.logDebug(config, `AuthResult '${JSON.stringify(callbackContext.authResult, null, 2)}'.\n AuthCallback created, begin token validation`);\n return this.signInKeyDataService.getSigningKeys(config).pipe(tap(jwtKeys => this.storeSigningKeys(jwtKeys, config)), catchError(err => {\n // fallback: try to load jwtKeys from storage\n const storedJwtKeys = this.readSigningKeys(config);\n if (!!storedJwtKeys) {\n this.loggerService.logWarning(config, `Failed to retrieve signing keys, fallback to stored keys`);\n return of(storedJwtKeys);\n }\n return throwError(() => new Error(err));\n }), switchMap(jwtKeys => {\n if (jwtKeys) {\n callbackContext.jwtKeys = jwtKeys;\n return of(callbackContext);\n }\n const errorMessage = `Failed to retrieve signing key`;\n this.loggerService.logWarning(config, errorMessage);\n return throwError(() => new Error(errorMessage));\n }), catchError(err => {\n const errorMessage = `Failed to retrieve signing key with error: ${err}`;\n this.loggerService.logWarning(config, errorMessage);\n return throwError(() => new Error(errorMessage));\n }));\n }\n responseHasIdToken(callbackContext) {\n return !!callbackContext?.authResult?.id_token;\n }\n handleResultErrorFromCallback(result, isRenewProcess) {\n let validationResult = ValidationResult.SecureTokenServerError;\n if (result && typeof result === 'object' && 'error' in result && result.error === 'login_required') {\n validationResult = ValidationResult.LoginRequired;\n }\n this.authStateService.updateAndPublishAuthState({\n isAuthenticated: false,\n validationResult,\n isRenewProcess\n });\n }\n historyCleanUpTurnedOn(config) {\n const {\n historyCleanupOff\n } = config;\n return !historyCleanupOff;\n }\n resetBrowserHistory() {\n this.document.defaultView?.history.replaceState({}, this.document.title, this.document.defaultView.location.origin + this.document.defaultView.location.pathname);\n }\n storeSigningKeys(jwtKeys, config) {\n this.storagePersistenceService.write(JWT_KEYS, jwtKeys, config);\n }\n readSigningKeys(config) {\n return this.storagePersistenceService.read(JWT_KEYS, config);\n }\n static {\n this.ɵfac = function HistoryJwtKeysCallbackHandlerService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || HistoryJwtKeysCallbackHandlerService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: HistoryJwtKeysCallbackHandlerService,\n factory: HistoryJwtKeysCallbackHandlerService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return HistoryJwtKeysCallbackHandlerService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet ImplicitFlowCallbackHandlerService = /*#__PURE__*/(() => {\n class ImplicitFlowCallbackHandlerService {\n constructor() {\n this.loggerService = inject(LoggerService);\n this.resetAuthDataService = inject(ResetAuthDataService);\n this.flowsDataService = inject(FlowsDataService);\n this.document = inject(DOCUMENT);\n }\n // STEP 1 Code Flow\n // STEP 1 Implicit Flow\n implicitFlowCallback(config, allConfigs, hash) {\n const isRenewProcessData = this.flowsDataService.isSilentRenewRunning(config);\n this.loggerService.logDebug(config, 'BEGIN callback, no auth data');\n if (!isRenewProcessData) {\n this.resetAuthDataService.resetAuthorizationData(config, allConfigs);\n }\n hash = hash || this.document.location.hash.substring(1);\n const authResult = hash.split('&').reduce((resultData, item) => {\n const parts = item.split('=');\n resultData[parts.shift()] = parts.join('=');\n return resultData;\n }, {});\n const callbackContext = {\n code: '',\n refreshToken: '',\n state: '',\n sessionState: null,\n authResult,\n isRenewProcess: isRenewProcessData,\n jwtKeys: null,\n validationResult: null,\n existingIdToken: null\n };\n return of(callbackContext);\n }\n static {\n this.ɵfac = function ImplicitFlowCallbackHandlerService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || ImplicitFlowCallbackHandlerService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ImplicitFlowCallbackHandlerService,\n factory: ImplicitFlowCallbackHandlerService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return ImplicitFlowCallbackHandlerService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet RefreshSessionCallbackHandlerService = /*#__PURE__*/(() => {\n class RefreshSessionCallbackHandlerService {\n constructor() {\n this.loggerService = inject(LoggerService);\n this.authStateService = inject(AuthStateService);\n this.flowsDataService = inject(FlowsDataService);\n }\n // STEP 1 Refresh session\n refreshSessionWithRefreshTokens(config) {\n const stateData = this.flowsDataService.getExistingOrCreateAuthStateControl(config);\n this.loggerService.logDebug(config, 'RefreshSession created. Adding myautostate: ' + stateData);\n const refreshToken = this.authStateService.getRefreshToken(config);\n const idToken = this.authStateService.getIdToken(config);\n if (refreshToken) {\n const callbackContext = {\n code: '',\n refreshToken,\n state: stateData,\n sessionState: null,\n authResult: null,\n isRenewProcess: true,\n jwtKeys: null,\n validationResult: null,\n existingIdToken: idToken\n };\n this.loggerService.logDebug(config, 'found refresh code, obtaining new credentials with refresh code');\n // Nonce is not used with refresh tokens; but Key cloak may send it anyway\n this.flowsDataService.setNonce(TokenValidationService.refreshTokenNoncePlaceholder, config);\n return of(callbackContext);\n } else {\n const errorMessage = 'no refresh token found, please login';\n this.loggerService.logError(config, errorMessage);\n return throwError(() => new Error(errorMessage));\n }\n }\n static {\n this.ɵfac = function RefreshSessionCallbackHandlerService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || RefreshSessionCallbackHandlerService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RefreshSessionCallbackHandlerService,\n factory: RefreshSessionCallbackHandlerService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return RefreshSessionCallbackHandlerService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet RefreshTokenCallbackHandlerService = /*#__PURE__*/(() => {\n class RefreshTokenCallbackHandlerService {\n constructor() {\n this.urlService = inject(UrlService);\n this.loggerService = inject(LoggerService);\n this.dataService = inject(DataService);\n this.storagePersistenceService = inject(StoragePersistenceService);\n }\n // STEP 2 Refresh Token\n refreshTokensRequestTokens(callbackContext, config, customParamsRefresh) {\n let headers = new HttpHeaders();\n headers = headers.set('Content-Type', 'application/x-www-form-urlencoded');\n const authWellknownEndpoints = this.storagePersistenceService.read('authWellKnownEndPoints', config);\n const tokenEndpoint = authWellknownEndpoints?.tokenEndpoint;\n if (!tokenEndpoint) {\n return throwError(() => new Error('Token Endpoint not defined'));\n }\n const data = this.urlService.createBodyForCodeFlowRefreshTokensRequest(callbackContext.refreshToken, config, customParamsRefresh);\n return this.dataService.post(tokenEndpoint, data, config, headers).pipe(switchMap(response => {\n this.loggerService.logDebug(config, `token refresh response: ${response}`);\n if (response) {\n response.state = callbackContext.state;\n }\n callbackContext.authResult = response;\n return of(callbackContext);\n }), retryWhen(error => this.handleRefreshRetry(error, config)), catchError(error => {\n const {\n authority\n } = config;\n const errorMessage = `OidcService code request ${authority}`;\n this.loggerService.logError(config, errorMessage, error);\n return throwError(() => new Error(errorMessage));\n }));\n }\n handleRefreshRetry(errors, config) {\n return errors.pipe(mergeMap(error => {\n // retry token refresh if there is no internet connection\n if (isNetworkError(error)) {\n const {\n authority,\n refreshTokenRetryInSeconds\n } = config;\n const errorMessage = `OidcService code request ${authority} - no internet connection`;\n this.loggerService.logWarning(config, errorMessage, error);\n return timer((refreshTokenRetryInSeconds ?? 0) * 1000);\n }\n return throwError(() => error);\n }));\n }\n static {\n this.ɵfac = function RefreshTokenCallbackHandlerService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || RefreshTokenCallbackHandlerService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RefreshTokenCallbackHandlerService,\n factory: RefreshTokenCallbackHandlerService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return RefreshTokenCallbackHandlerService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet EqualityService = /*#__PURE__*/(() => {\n class EqualityService {\n isStringEqualOrNonOrderedArrayEqual(value1, value2) {\n if (this.isNullOrUndefined(value1)) {\n return false;\n }\n if (this.isNullOrUndefined(value2)) {\n return false;\n }\n if (this.oneValueIsStringAndTheOtherIsArray(value1, value2)) {\n return false;\n }\n if (this.bothValuesAreStrings(value1, value2)) {\n return value1 === value2;\n }\n return this.arraysHaveEqualContent(value1, value2);\n }\n areEqual(value1, value2) {\n if (!value1 || !value2) {\n return false;\n }\n if (this.bothValuesAreArrays(value1, value2)) {\n return this.arraysStrictEqual(value1, value2);\n }\n if (this.bothValuesAreStrings(value1, value2)) {\n return value1 === value2;\n }\n if (this.bothValuesAreObjects(value1, value2)) {\n return JSON.stringify(value1).toLowerCase() === JSON.stringify(value2).toLowerCase();\n }\n if (this.oneValueIsStringAndTheOtherIsArray(value1, value2)) {\n if (Array.isArray(value1) && this.valueIsString(value2)) {\n return value1[0] === value2;\n }\n if (Array.isArray(value2) && this.valueIsString(value1)) {\n return value2[0] === value1;\n }\n }\n return value1 === value2;\n }\n oneValueIsStringAndTheOtherIsArray(value1, value2) {\n return Array.isArray(value1) && this.valueIsString(value2) || Array.isArray(value2) && this.valueIsString(value1);\n }\n bothValuesAreObjects(value1, value2) {\n return this.valueIsObject(value1) && this.valueIsObject(value2);\n }\n bothValuesAreStrings(value1, value2) {\n return this.valueIsString(value1) && this.valueIsString(value2);\n }\n bothValuesAreArrays(value1, value2) {\n return Array.isArray(value1) && Array.isArray(value2);\n }\n valueIsString(value) {\n return typeof value === 'string' || value instanceof String;\n }\n valueIsObject(value) {\n return typeof value === 'object';\n }\n arraysStrictEqual(arr1, arr2) {\n if (arr1.length !== arr2.length) {\n return false;\n }\n for (let i = arr1.length; i--;) {\n if (arr1[i] !== arr2[i]) {\n return false;\n }\n }\n return true;\n }\n arraysHaveEqualContent(arr1, arr2) {\n if (arr1.length !== arr2.length) {\n return false;\n }\n return arr1.some(v => arr2.includes(v));\n }\n isNullOrUndefined(val) {\n return val === null || val === undefined;\n }\n static {\n this.ɵfac = function EqualityService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || EqualityService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: EqualityService,\n factory: EqualityService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return EqualityService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nclass StateValidationResult {\n constructor(accessToken = '', idToken = '', authResponseIsValid = false, decodedIdToken = {\n at_hash: ''\n }, state = ValidationResult.NotSet) {\n this.accessToken = accessToken;\n this.idToken = idToken;\n this.authResponseIsValid = authResponseIsValid;\n this.decodedIdToken = decodedIdToken;\n this.state = state;\n }\n}\nlet StateValidationService = /*#__PURE__*/(() => {\n class StateValidationService {\n constructor() {\n this.storagePersistenceService = inject(StoragePersistenceService);\n this.tokenValidationService = inject(TokenValidationService);\n this.tokenHelperService = inject(TokenHelperService);\n this.loggerService = inject(LoggerService);\n this.equalityService = inject(EqualityService);\n this.flowHelper = inject(FlowHelper);\n }\n getValidatedStateResult(callbackContext, configuration) {\n const hasError = Boolean(callbackContext.authResult?.error);\n const hasCallbackContext = Boolean(callbackContext);\n if (!hasCallbackContext || hasError) {\n return of(new StateValidationResult('', '', false, {}));\n }\n return this.validateState(callbackContext, configuration);\n }\n validateState(callbackContext, configuration) {\n const toReturn = new StateValidationResult();\n const authStateControl = this.storagePersistenceService.read('authStateControl', configuration);\n if (!this.tokenValidationService.validateStateFromHashCallback(callbackContext.authResult?.state, authStateControl, configuration)) {\n this.loggerService.logWarning(configuration, 'authCallback incorrect state');\n toReturn.state = ValidationResult.StatesDoNotMatch;\n this.handleUnsuccessfulValidation(configuration);\n return of(toReturn);\n }\n const isCurrentFlowImplicitFlowWithAccessToken = this.flowHelper.isCurrentFlowImplicitFlowWithAccessToken(configuration);\n const isCurrentFlowCodeFlow = this.flowHelper.isCurrentFlowCodeFlow(configuration);\n if (isCurrentFlowImplicitFlowWithAccessToken || isCurrentFlowCodeFlow) {\n toReturn.accessToken = callbackContext.authResult?.access_token ?? '';\n }\n const disableIdTokenValidation = configuration.disableIdTokenValidation;\n if (disableIdTokenValidation) {\n toReturn.state = ValidationResult.Ok;\n toReturn.authResponseIsValid = true;\n return of(toReturn);\n }\n const isInRefreshTokenFlow = callbackContext.isRenewProcess && !!callbackContext.refreshToken;\n const hasIdToken = Boolean(callbackContext.authResult?.id_token);\n if (isInRefreshTokenFlow && !hasIdToken) {\n toReturn.state = ValidationResult.Ok;\n toReturn.authResponseIsValid = true;\n return of(toReturn);\n }\n if (hasIdToken) {\n const {\n clientId,\n issValidationOff,\n maxIdTokenIatOffsetAllowedInSeconds,\n disableIatOffsetValidation,\n ignoreNonceAfterRefresh,\n renewTimeBeforeTokenExpiresInSeconds\n } = configuration;\n toReturn.idToken = callbackContext.authResult?.id_token ?? '';\n toReturn.decodedIdToken = this.tokenHelperService.getPayloadFromToken(toReturn.idToken, false, configuration);\n return this.tokenValidationService.validateSignatureIdToken(toReturn.idToken, callbackContext.jwtKeys, configuration).pipe(mergeMap(isSignatureIdTokenValid => {\n if (!isSignatureIdTokenValid) {\n this.loggerService.logDebug(configuration, 'authCallback Signature validation failed id_token');\n toReturn.state = ValidationResult.SignatureFailed;\n this.handleUnsuccessfulValidation(configuration);\n return of(toReturn);\n }\n const authNonce = this.storagePersistenceService.read('authNonce', configuration);\n if (!this.tokenValidationService.validateIdTokenNonce(toReturn.decodedIdToken, authNonce, Boolean(ignoreNonceAfterRefresh), configuration)) {\n this.loggerService.logWarning(configuration, 'authCallback incorrect nonce, did you call the checkAuth() method multiple times?');\n toReturn.state = ValidationResult.IncorrectNonce;\n this.handleUnsuccessfulValidation(configuration);\n return of(toReturn);\n }\n if (!this.tokenValidationService.validateRequiredIdToken(toReturn.decodedIdToken, configuration)) {\n this.loggerService.logDebug(configuration, 'authCallback Validation, one of the REQUIRED properties missing from id_token');\n toReturn.state = ValidationResult.RequiredPropertyMissing;\n this.handleUnsuccessfulValidation(configuration);\n return of(toReturn);\n }\n if (!isInRefreshTokenFlow && !this.tokenValidationService.validateIdTokenIatMaxOffset(toReturn.decodedIdToken, maxIdTokenIatOffsetAllowedInSeconds ?? 120, Boolean(disableIatOffsetValidation), configuration)) {\n this.loggerService.logWarning(configuration, 'authCallback Validation, iat rejected id_token was issued too far away from the current time');\n toReturn.state = ValidationResult.MaxOffsetExpired;\n this.handleUnsuccessfulValidation(configuration);\n return of(toReturn);\n }\n const authWellKnownEndPoints = this.storagePersistenceService.read('authWellKnownEndPoints', configuration);\n if (authWellKnownEndPoints) {\n if (issValidationOff) {\n this.loggerService.logDebug(configuration, 'iss validation is turned off, this is not recommended!');\n } else if (!issValidationOff && !this.tokenValidationService.validateIdTokenIss(toReturn.decodedIdToken, authWellKnownEndPoints.issuer, configuration)) {\n this.loggerService.logWarning(configuration, 'authCallback incorrect iss does not match authWellKnownEndpoints issuer');\n toReturn.state = ValidationResult.IssDoesNotMatchIssuer;\n this.handleUnsuccessfulValidation(configuration);\n return of(toReturn);\n }\n } else {\n this.loggerService.logWarning(configuration, 'authWellKnownEndpoints is undefined');\n toReturn.state = ValidationResult.NoAuthWellKnownEndPoints;\n this.handleUnsuccessfulValidation(configuration);\n return of(toReturn);\n }\n if (!this.tokenValidationService.validateIdTokenAud(toReturn.decodedIdToken, clientId, configuration)) {\n this.loggerService.logWarning(configuration, 'authCallback incorrect aud');\n toReturn.state = ValidationResult.IncorrectAud;\n this.handleUnsuccessfulValidation(configuration);\n return of(toReturn);\n }\n if (!this.tokenValidationService.validateIdTokenAzpExistsIfMoreThanOneAud(toReturn.decodedIdToken)) {\n this.loggerService.logWarning(configuration, 'authCallback missing azp');\n toReturn.state = ValidationResult.IncorrectAzp;\n this.handleUnsuccessfulValidation(configuration);\n return of(toReturn);\n }\n if (!this.tokenValidationService.validateIdTokenAzpValid(toReturn.decodedIdToken, clientId)) {\n this.loggerService.logWarning(configuration, 'authCallback incorrect azp');\n toReturn.state = ValidationResult.IncorrectAzp;\n this.handleUnsuccessfulValidation(configuration);\n return of(toReturn);\n }\n if (!this.isIdTokenAfterRefreshTokenRequestValid(callbackContext, toReturn.decodedIdToken, configuration)) {\n this.loggerService.logWarning(configuration, 'authCallback pre, post id_token claims do not match in refresh');\n toReturn.state = ValidationResult.IncorrectIdTokenClaimsAfterRefresh;\n this.handleUnsuccessfulValidation(configuration);\n return of(toReturn);\n }\n if (!isInRefreshTokenFlow && !this.tokenValidationService.validateIdTokenExpNotExpired(toReturn.decodedIdToken, configuration, renewTimeBeforeTokenExpiresInSeconds)) {\n this.loggerService.logWarning(configuration, 'authCallback id token expired');\n toReturn.state = ValidationResult.TokenExpired;\n this.handleUnsuccessfulValidation(configuration);\n return of(toReturn);\n }\n return this.validateDefault(isCurrentFlowImplicitFlowWithAccessToken, isCurrentFlowCodeFlow, toReturn, configuration, callbackContext);\n }));\n } else {\n this.loggerService.logDebug(configuration, 'No id_token found, skipping id_token validation');\n }\n return this.validateDefault(isCurrentFlowImplicitFlowWithAccessToken, isCurrentFlowCodeFlow, toReturn, configuration, callbackContext);\n }\n validateDefault(isCurrentFlowImplicitFlowWithAccessToken, isCurrentFlowCodeFlow, toReturn, configuration, callbackContext) {\n // flow id_token\n if (!isCurrentFlowImplicitFlowWithAccessToken && !isCurrentFlowCodeFlow) {\n toReturn.authResponseIsValid = true;\n toReturn.state = ValidationResult.Ok;\n this.handleSuccessfulValidation(configuration);\n this.handleUnsuccessfulValidation(configuration);\n return of(toReturn);\n }\n // only do check if id_token returned, no always the case when using refresh tokens\n if (callbackContext.authResult?.id_token) {\n const idTokenHeader = this.tokenHelperService.getHeaderFromToken(toReturn.idToken, false, configuration);\n if (isCurrentFlowCodeFlow && !toReturn.decodedIdToken.at_hash) {\n this.loggerService.logDebug(configuration, 'Code Flow active, and no at_hash in the id_token, skipping check!');\n } else {\n return this.tokenValidationService.validateIdTokenAtHash(toReturn.accessToken, toReturn.decodedIdToken.at_hash, idTokenHeader.alg,\n // 'RS256'\n configuration).pipe(map(valid => {\n if (!valid || !toReturn.accessToken) {\n this.loggerService.logWarning(configuration, 'authCallback incorrect at_hash');\n toReturn.state = ValidationResult.IncorrectAtHash;\n this.handleUnsuccessfulValidation(configuration);\n return toReturn;\n } else {\n toReturn.authResponseIsValid = true;\n toReturn.state = ValidationResult.Ok;\n this.handleSuccessfulValidation(configuration);\n return toReturn;\n }\n }));\n }\n }\n toReturn.authResponseIsValid = true;\n toReturn.state = ValidationResult.Ok;\n this.handleSuccessfulValidation(configuration);\n return of(toReturn);\n }\n isIdTokenAfterRefreshTokenRequestValid(callbackContext, newIdToken, configuration) {\n const {\n useRefreshToken,\n disableRefreshIdTokenAuthTimeValidation\n } = configuration;\n if (!useRefreshToken) {\n return true;\n }\n if (!callbackContext.existingIdToken) {\n return true;\n }\n const decodedIdToken = this.tokenHelperService.getPayloadFromToken(callbackContext.existingIdToken, false, configuration);\n // Upon successful validation of the Refresh Token, the response body is the Token Response of Section 3.1.3.3\n // except that it might not contain an id_token.\n // If an ID Token is returned as a result of a token refresh request, the following requirements apply:\n // its iss Claim Value MUST be the same as in the ID Token issued when the original authentication occurred,\n if (decodedIdToken.iss !== newIdToken.iss) {\n this.loggerService.logDebug(configuration, `iss do not match: ${decodedIdToken.iss} ${newIdToken.iss}`);\n return false;\n }\n // its azp Claim Value MUST be the same as in the ID Token issued when the original authentication occurred;\n // if no azp Claim was present in the original ID Token, one MUST NOT be present in the new ID Token, and\n // otherwise, the same rules apply as apply when issuing an ID Token at the time of the original authentication.\n if (decodedIdToken.azp !== newIdToken.azp) {\n this.loggerService.logDebug(configuration, `azp do not match: ${decodedIdToken.azp} ${newIdToken.azp}`);\n return false;\n }\n // its sub Claim Value MUST be the same as in the ID Token issued when the original authentication occurred,\n if (decodedIdToken.sub !== newIdToken.sub) {\n this.loggerService.logDebug(configuration, `sub do not match: ${decodedIdToken.sub} ${newIdToken.sub}`);\n return false;\n }\n // its aud Claim Value MUST be the same as in the ID Token issued when the original authentication occurred,\n if (!this.equalityService.isStringEqualOrNonOrderedArrayEqual(decodedIdToken?.aud, newIdToken?.aud)) {\n this.loggerService.logDebug(configuration, `aud in new id_token is not valid: '${decodedIdToken?.aud}' '${newIdToken.aud}'`);\n return false;\n }\n if (disableRefreshIdTokenAuthTimeValidation) {\n return true;\n }\n // its iat Claim MUST represent the time that the new ID Token is issued,\n // if the ID Token contains an auth_time Claim, its value MUST represent the time of the original authentication\n // - not the time that the new ID token is issued,\n if (decodedIdToken.auth_time !== newIdToken.auth_time) {\n this.loggerService.logDebug(configuration, `auth_time do not match: ${decodedIdToken.auth_time} ${newIdToken.auth_time}`);\n return false;\n }\n return true;\n }\n handleSuccessfulValidation(configuration) {\n const {\n autoCleanStateAfterAuthentication\n } = configuration;\n this.storagePersistenceService.write('authNonce', null, configuration);\n if (autoCleanStateAfterAuthentication) {\n this.storagePersistenceService.write('authStateControl', '', configuration);\n }\n this.loggerService.logDebug(configuration, 'authCallback token(s) validated, continue');\n }\n handleUnsuccessfulValidation(configuration) {\n const {\n autoCleanStateAfterAuthentication\n } = configuration;\n this.storagePersistenceService.write('authNonce', null, configuration);\n if (autoCleanStateAfterAuthentication) {\n this.storagePersistenceService.write('authStateControl', '', configuration);\n }\n this.loggerService.logDebug(configuration, 'authCallback token(s) invalid');\n }\n static {\n this.ɵfac = function StateValidationService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || StateValidationService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: StateValidationService,\n factory: StateValidationService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return StateValidationService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet StateValidationCallbackHandlerService = /*#__PURE__*/(() => {\n class StateValidationCallbackHandlerService {\n constructor() {\n this.loggerService = inject(LoggerService);\n this.stateValidationService = inject(StateValidationService);\n this.authStateService = inject(AuthStateService);\n this.resetAuthDataService = inject(ResetAuthDataService);\n this.document = inject(DOCUMENT);\n }\n // STEP 4 All flows\n callbackStateValidation(callbackContext, configuration, allConfigs) {\n return this.stateValidationService.getValidatedStateResult(callbackContext, configuration).pipe(map(validationResult => {\n callbackContext.validationResult = validationResult;\n if (validationResult.authResponseIsValid) {\n this.authStateService.setAuthorizationData(validationResult.accessToken, callbackContext.authResult, configuration, allConfigs);\n return callbackContext;\n } else {\n const errorMessage = `authorizedCallback, token(s) validation failed, resetting. Hash: ${this.document.location.hash}`;\n this.loggerService.logWarning(configuration, errorMessage);\n this.resetAuthDataService.resetAuthorizationData(configuration, allConfigs);\n this.publishUnauthorizedState(callbackContext.validationResult, callbackContext.isRenewProcess);\n throw new Error(errorMessage);\n }\n }));\n }\n publishUnauthorizedState(stateValidationResult, isRenewProcess) {\n this.authStateService.updateAndPublishAuthState({\n isAuthenticated: false,\n validationResult: stateValidationResult.state,\n isRenewProcess\n });\n }\n static {\n this.ɵfac = function StateValidationCallbackHandlerService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || StateValidationCallbackHandlerService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: StateValidationCallbackHandlerService,\n factory: StateValidationCallbackHandlerService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return StateValidationCallbackHandlerService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet UserCallbackHandlerService = /*#__PURE__*/(() => {\n class UserCallbackHandlerService {\n constructor() {\n this.loggerService = inject(LoggerService);\n this.authStateService = inject(AuthStateService);\n this.flowsDataService = inject(FlowsDataService);\n this.userService = inject(UserService);\n this.resetAuthDataService = inject(ResetAuthDataService);\n }\n // STEP 5 userData\n callbackUser(callbackContext, configuration, allConfigs) {\n const {\n isRenewProcess,\n validationResult,\n authResult,\n refreshToken\n } = callbackContext;\n const {\n autoUserInfo,\n renewUserInfoAfterTokenRenew\n } = configuration;\n if (!autoUserInfo) {\n if (!isRenewProcess || renewUserInfoAfterTokenRenew) {\n // userData is set to the id_token decoded, auto get user data set to false\n if (validationResult?.decodedIdToken) {\n this.userService.setUserDataToStore(validationResult.decodedIdToken, configuration, allConfigs);\n }\n }\n if (!isRenewProcess && !refreshToken) {\n this.flowsDataService.setSessionState(authResult?.session_state, configuration);\n }\n this.publishAuthState(validationResult, isRenewProcess);\n return of(callbackContext);\n }\n return this.userService.getAndPersistUserDataInStore(configuration, allConfigs, isRenewProcess, validationResult?.idToken, validationResult?.decodedIdToken).pipe(switchMap(userData => {\n if (!!userData) {\n if (!refreshToken) {\n this.flowsDataService.setSessionState(authResult?.session_state, configuration);\n }\n this.publishAuthState(validationResult, isRenewProcess);\n return of(callbackContext);\n } else {\n this.resetAuthDataService.resetAuthorizationData(configuration, allConfigs);\n this.publishUnauthenticatedState(validationResult, isRenewProcess);\n const errorMessage = `Called for userData but they were ${userData}`;\n this.loggerService.logWarning(configuration, errorMessage);\n return throwError(() => new Error(errorMessage));\n }\n }), catchError(err => {\n const errorMessage = `Failed to retrieve user info with error: ${err}`;\n this.loggerService.logWarning(configuration, errorMessage);\n return throwError(() => new Error(errorMessage));\n }));\n }\n publishAuthState(stateValidationResult, isRenewProcess) {\n if (!stateValidationResult) {\n return;\n }\n this.authStateService.updateAndPublishAuthState({\n isAuthenticated: true,\n validationResult: stateValidationResult.state,\n isRenewProcess\n });\n }\n publishUnauthenticatedState(stateValidationResult, isRenewProcess) {\n if (!stateValidationResult) {\n return;\n }\n this.authStateService.updateAndPublishAuthState({\n isAuthenticated: false,\n validationResult: stateValidationResult.state,\n isRenewProcess\n });\n }\n static {\n this.ɵfac = function UserCallbackHandlerService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || UserCallbackHandlerService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: UserCallbackHandlerService,\n factory: UserCallbackHandlerService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return UserCallbackHandlerService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet FlowsService = /*#__PURE__*/(() => {\n class FlowsService {\n constructor() {\n this.codeFlowCallbackHandlerService = inject(CodeFlowCallbackHandlerService);\n this.implicitFlowCallbackHandlerService = inject(ImplicitFlowCallbackHandlerService);\n this.historyJwtKeysCallbackHandlerService = inject(HistoryJwtKeysCallbackHandlerService);\n this.userHandlerService = inject(UserCallbackHandlerService);\n this.stateValidationCallbackHandlerService = inject(StateValidationCallbackHandlerService);\n this.refreshSessionCallbackHandlerService = inject(RefreshSessionCallbackHandlerService);\n this.refreshTokenCallbackHandlerService = inject(RefreshTokenCallbackHandlerService);\n }\n processCodeFlowCallback(urlToCheck, config, allConfigs) {\n return this.codeFlowCallbackHandlerService.codeFlowCallback(urlToCheck, config).pipe(concatMap(callbackContext => this.codeFlowCallbackHandlerService.codeFlowCodeRequest(callbackContext, config)), concatMap(callbackContext => this.historyJwtKeysCallbackHandlerService.callbackHistoryAndResetJwtKeys(callbackContext, config, allConfigs)), concatMap(callbackContext => this.stateValidationCallbackHandlerService.callbackStateValidation(callbackContext, config, allConfigs)), concatMap(callbackContext => this.userHandlerService.callbackUser(callbackContext, config, allConfigs)));\n }\n processSilentRenewCodeFlowCallback(firstContext, config, allConfigs) {\n return this.codeFlowCallbackHandlerService.codeFlowCodeRequest(firstContext, config).pipe(concatMap(callbackContext => this.historyJwtKeysCallbackHandlerService.callbackHistoryAndResetJwtKeys(callbackContext, config, allConfigs)), concatMap(callbackContext => this.stateValidationCallbackHandlerService.callbackStateValidation(callbackContext, config, allConfigs)), concatMap(callbackContext => this.userHandlerService.callbackUser(callbackContext, config, allConfigs)));\n }\n processImplicitFlowCallback(config, allConfigs, hash) {\n return this.implicitFlowCallbackHandlerService.implicitFlowCallback(config, allConfigs, hash).pipe(concatMap(callbackContext => this.historyJwtKeysCallbackHandlerService.callbackHistoryAndResetJwtKeys(callbackContext, config, allConfigs)), concatMap(callbackContext => this.stateValidationCallbackHandlerService.callbackStateValidation(callbackContext, config, allConfigs)), concatMap(callbackContext => this.userHandlerService.callbackUser(callbackContext, config, allConfigs)));\n }\n processRefreshToken(config, allConfigs, customParamsRefresh) {\n return this.refreshSessionCallbackHandlerService.refreshSessionWithRefreshTokens(config).pipe(concatMap(callbackContext => this.refreshTokenCallbackHandlerService.refreshTokensRequestTokens(callbackContext, config, customParamsRefresh)), concatMap(callbackContext => this.historyJwtKeysCallbackHandlerService.callbackHistoryAndResetJwtKeys(callbackContext, config, allConfigs)), concatMap(callbackContext => this.stateValidationCallbackHandlerService.callbackStateValidation(callbackContext, config, allConfigs)), concatMap(callbackContext => this.userHandlerService.callbackUser(callbackContext, config, allConfigs)));\n }\n static {\n this.ɵfac = function FlowsService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || FlowsService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: FlowsService,\n factory: FlowsService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return FlowsService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet IntervalService = /*#__PURE__*/(() => {\n class IntervalService {\n constructor() {\n this.zone = inject(NgZone);\n this.document = inject(DOCUMENT);\n this.runTokenValidationRunning = null;\n }\n isTokenValidationRunning() {\n return Boolean(this.runTokenValidationRunning);\n }\n stopPeriodicTokenCheck() {\n if (this.runTokenValidationRunning) {\n this.runTokenValidationRunning.unsubscribe();\n this.runTokenValidationRunning = null;\n }\n }\n startPeriodicTokenCheck(repeatAfterSeconds) {\n const millisecondsDelayBetweenTokenCheck = repeatAfterSeconds * 1000;\n return new Observable(subscriber => {\n let intervalId;\n this.zone.runOutsideAngular(() => {\n intervalId = this.document?.defaultView?.setInterval(() => this.zone.run(() => subscriber.next()), millisecondsDelayBetweenTokenCheck);\n });\n return () => {\n clearInterval(intervalId);\n };\n });\n }\n static {\n this.ɵfac = function IntervalService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || IntervalService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: IntervalService,\n factory: IntervalService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return IntervalService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet CodeFlowCallbackService = /*#__PURE__*/(() => {\n class CodeFlowCallbackService {\n constructor() {\n this.flowsService = inject(FlowsService);\n this.router = inject(Router);\n this.flowsDataService = inject(FlowsDataService);\n this.intervalService = inject(IntervalService);\n }\n authenticatedCallbackWithCode(urlToCheck, config, allConfigs) {\n const isRenewProcess = this.flowsDataService.isSilentRenewRunning(config);\n const {\n triggerAuthorizationResultEvent\n } = config;\n const postLoginRoute = config.postLoginRoute || '/';\n const unauthorizedRoute = config.unauthorizedRoute || '/';\n return this.flowsService.processCodeFlowCallback(urlToCheck, config, allConfigs).pipe(tap(callbackContext => {\n this.flowsDataService.resetCodeFlowInProgress(config);\n if (!triggerAuthorizationResultEvent && !callbackContext.isRenewProcess) {\n this.router.navigateByUrl(postLoginRoute);\n }\n }), catchError(error => {\n this.flowsDataService.resetSilentRenewRunning(config);\n this.flowsDataService.resetCodeFlowInProgress(config);\n this.intervalService.stopPeriodicTokenCheck();\n if (!triggerAuthorizationResultEvent && !isRenewProcess) {\n this.router.navigateByUrl(unauthorizedRoute);\n }\n return throwError(() => new Error(error));\n }));\n }\n static {\n this.ɵfac = function CodeFlowCallbackService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || CodeFlowCallbackService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: CodeFlowCallbackService,\n factory: CodeFlowCallbackService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return CodeFlowCallbackService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet ImplicitFlowCallbackService = /*#__PURE__*/(() => {\n class ImplicitFlowCallbackService {\n constructor() {\n this.flowsService = inject(FlowsService);\n this.router = inject(Router);\n this.flowsDataService = inject(FlowsDataService);\n this.intervalService = inject(IntervalService);\n }\n authenticatedImplicitFlowCallback(config, allConfigs, hash) {\n const isRenewProcess = this.flowsDataService.isSilentRenewRunning(config);\n const triggerAuthorizationResultEvent = Boolean(config.triggerAuthorizationResultEvent);\n const postLoginRoute = config.postLoginRoute ?? '';\n const unauthorizedRoute = config.unauthorizedRoute ?? '';\n return this.flowsService.processImplicitFlowCallback(config, allConfigs, hash).pipe(tap(callbackContext => {\n if (!triggerAuthorizationResultEvent && !callbackContext.isRenewProcess) {\n this.router.navigateByUrl(postLoginRoute);\n }\n }), catchError(error => {\n this.flowsDataService.resetSilentRenewRunning(config);\n this.intervalService.stopPeriodicTokenCheck();\n if (!triggerAuthorizationResultEvent && !isRenewProcess) {\n this.router.navigateByUrl(unauthorizedRoute);\n }\n return throwError(() => new Error(error));\n }));\n }\n static {\n this.ɵfac = function ImplicitFlowCallbackService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || ImplicitFlowCallbackService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ImplicitFlowCallbackService,\n factory: ImplicitFlowCallbackService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return ImplicitFlowCallbackService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet CallbackService = /*#__PURE__*/(() => {\n class CallbackService {\n constructor() {\n this.urlService = inject(UrlService);\n this.flowHelper = inject(FlowHelper);\n this.implicitFlowCallbackService = inject(ImplicitFlowCallbackService);\n this.codeFlowCallbackService = inject(CodeFlowCallbackService);\n this.stsCallbackInternal$ = new Subject();\n }\n get stsCallback$() {\n return this.stsCallbackInternal$.asObservable();\n }\n isCallback(currentUrl, config) {\n if (!currentUrl) {\n return false;\n }\n return this.urlService.isCallbackFromSts(currentUrl, config);\n }\n handleCallbackAndFireEvents(currentCallbackUrl, config, allConfigs) {\n let callback$ = new Observable();\n if (this.flowHelper.isCurrentFlowCodeFlow(config)) {\n callback$ = this.codeFlowCallbackService.authenticatedCallbackWithCode(currentCallbackUrl, config, allConfigs);\n } else if (this.flowHelper.isCurrentFlowAnyImplicitFlow(config)) {\n if (currentCallbackUrl?.includes('#')) {\n const hash = currentCallbackUrl.substring(currentCallbackUrl.indexOf('#') + 1);\n callback$ = this.implicitFlowCallbackService.authenticatedImplicitFlowCallback(config, allConfigs, hash);\n } else {\n callback$ = this.implicitFlowCallbackService.authenticatedImplicitFlowCallback(config, allConfigs);\n }\n }\n return callback$.pipe(tap(() => this.stsCallbackInternal$.next()));\n }\n static {\n this.ɵfac = function CallbackService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || CallbackService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: CallbackService,\n factory: CallbackService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return CallbackService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet PlatformProvider = /*#__PURE__*/(() => {\n class PlatformProvider {\n constructor() {\n this.platformId = inject(PLATFORM_ID);\n }\n isBrowser() {\n return isPlatformBrowser(this.platformId);\n }\n static {\n this.ɵfac = function PlatformProvider_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || PlatformProvider)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: PlatformProvider,\n factory: PlatformProvider.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return PlatformProvider;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst WELL_KNOWN_SUFFIX = `/.well-known/openid-configuration`;\nlet AuthWellKnownDataService = /*#__PURE__*/(() => {\n class AuthWellKnownDataService {\n constructor() {\n this.loggerService = inject(LoggerService);\n this.http = inject(DataService);\n }\n getWellKnownEndPointsForConfig(config) {\n const {\n authWellknownEndpointUrl,\n authWellknownEndpoints = {}\n } = config;\n if (!authWellknownEndpointUrl) {\n const errorMessage = 'no authWellknownEndpoint given!';\n this.loggerService.logError(config, errorMessage);\n return throwError(() => new Error(errorMessage));\n }\n return this.getWellKnownDocument(authWellknownEndpointUrl, config).pipe(map(wellKnownEndpoints => ({\n issuer: wellKnownEndpoints.issuer,\n jwksUri: wellKnownEndpoints.jwks_uri,\n authorizationEndpoint: wellKnownEndpoints.authorization_endpoint,\n tokenEndpoint: wellKnownEndpoints.token_endpoint,\n userInfoEndpoint: wellKnownEndpoints.userinfo_endpoint,\n endSessionEndpoint: wellKnownEndpoints.end_session_endpoint,\n checkSessionIframe: wellKnownEndpoints.check_session_iframe,\n revocationEndpoint: wellKnownEndpoints.revocation_endpoint,\n introspectionEndpoint: wellKnownEndpoints.introspection_endpoint,\n parEndpoint: wellKnownEndpoints.pushed_authorization_request_endpoint\n })), map(mappedWellKnownEndpoints => ({\n ...mappedWellKnownEndpoints,\n ...authWellknownEndpoints\n })));\n }\n getWellKnownDocument(wellKnownEndpoint, config) {\n let url = wellKnownEndpoint;\n const wellKnownSuffix = config.authWellknownUrlSuffix || WELL_KNOWN_SUFFIX;\n if (!wellKnownEndpoint.includes(wellKnownSuffix)) {\n url = `${wellKnownEndpoint}${wellKnownSuffix}`;\n }\n return this.http.get(url, config).pipe(retry(2));\n }\n static {\n this.ɵfac = function AuthWellKnownDataService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || AuthWellKnownDataService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: AuthWellKnownDataService,\n factory: AuthWellKnownDataService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return AuthWellKnownDataService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet AuthWellKnownService = /*#__PURE__*/(() => {\n class AuthWellKnownService {\n constructor() {\n this.dataService = inject(AuthWellKnownDataService);\n this.publicEventsService = inject(PublicEventsService);\n this.storagePersistenceService = inject(StoragePersistenceService);\n }\n storeWellKnownEndpoints(config, mappedWellKnownEndpoints) {\n this.storagePersistenceService.write('authWellKnownEndPoints', mappedWellKnownEndpoints, config);\n }\n queryAndStoreAuthWellKnownEndPoints(config) {\n if (!config) {\n return throwError(() => new Error('Please provide a configuration before setting up the module'));\n }\n return this.dataService.getWellKnownEndPointsForConfig(config).pipe(tap(mappedWellKnownEndpoints => this.storeWellKnownEndpoints(config, mappedWellKnownEndpoints)), catchError(error => {\n this.publicEventsService.fireEvent(EventTypes.ConfigLoadingFailed, null);\n return throwError(() => new Error(error));\n }));\n }\n static {\n this.ɵfac = function AuthWellKnownService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || AuthWellKnownService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: AuthWellKnownService,\n factory: AuthWellKnownService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return AuthWellKnownService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst DEFAULT_CONFIG = {\n authority: 'https://please_set',\n authWellknownEndpointUrl: '',\n authWellknownEndpoints: undefined,\n redirectUrl: 'https://please_set',\n checkRedirectUrlWhenCheckingIfIsCallback: true,\n clientId: 'please_set',\n responseType: 'code',\n scope: 'openid email profile',\n hdParam: '',\n postLogoutRedirectUri: 'https://please_set',\n startCheckSession: false,\n silentRenew: false,\n silentRenewUrl: 'https://please_set',\n silentRenewTimeoutInSeconds: 20,\n renewTimeBeforeTokenExpiresInSeconds: 0,\n useRefreshToken: false,\n usePushedAuthorisationRequests: false,\n ignoreNonceAfterRefresh: false,\n postLoginRoute: '/',\n forbiddenRoute: '/forbidden',\n unauthorizedRoute: '/unauthorized',\n autoUserInfo: true,\n autoCleanStateAfterAuthentication: true,\n triggerAuthorizationResultEvent: false,\n logLevel: LogLevel.Warn,\n issValidationOff: false,\n historyCleanupOff: false,\n maxIdTokenIatOffsetAllowedInSeconds: 120,\n disableIatOffsetValidation: false,\n customParamsAuthRequest: {},\n customParamsRefreshTokenRequest: {},\n customParamsEndSessionRequest: {},\n customParamsCodeRequest: {},\n disableRefreshIdTokenAuthTimeValidation: false,\n triggerRefreshWhenIdTokenExpired: true,\n tokenRefreshInSeconds: 4,\n refreshTokenRetryInSeconds: 3,\n ngswBypass: false\n};\nconst POSITIVE_VALIDATION_RESULT = {\n result: true,\n messages: [],\n level: 'none'\n};\nconst ensureAuthority = passedConfig => {\n if (!passedConfig.authority) {\n return {\n result: false,\n messages: ['The authority URL MUST be provided in the configuration! '],\n level: 'error'\n };\n }\n return POSITIVE_VALIDATION_RESULT;\n};\nconst ensureClientId = passedConfig => {\n if (!passedConfig.clientId) {\n return {\n result: false,\n messages: ['The clientId is required and missing from your config!'],\n level: 'error'\n };\n }\n return POSITIVE_VALIDATION_RESULT;\n};\nconst createIdentifierToCheck = passedConfig => {\n if (!passedConfig) {\n return '';\n }\n const {\n authority,\n clientId,\n scope\n } = passedConfig;\n return `${authority}${clientId}${scope}`;\n};\nconst arrayHasDuplicates = array => new Set(array).size !== array.length;\nconst ensureNoDuplicatedConfigsRule = passedConfigs => {\n const allIdentifiers = passedConfigs.map(x => createIdentifierToCheck(x));\n const someAreNotSet = allIdentifiers.some(x => x === '');\n if (someAreNotSet) {\n return {\n result: false,\n messages: [`Please make sure you add an object with a 'config' property: ....({ config }) instead of ...(config)`],\n level: 'error'\n };\n }\n const hasDuplicates = arrayHasDuplicates(allIdentifiers);\n if (hasDuplicates) {\n return {\n result: false,\n messages: ['You added multiple configs with the same authority, clientId and scope'],\n level: 'warning'\n };\n }\n return POSITIVE_VALIDATION_RESULT;\n};\nconst ensureRedirectRule = passedConfig => {\n if (!passedConfig.redirectUrl) {\n return {\n result: false,\n messages: ['The redirectUrl is required and missing from your config'],\n level: 'error'\n };\n }\n return POSITIVE_VALIDATION_RESULT;\n};\nconst ensureSilentRenewUrlWhenNoRefreshTokenUsed = passedConfig => {\n const usesSilentRenew = passedConfig.silentRenew;\n const usesRefreshToken = passedConfig.useRefreshToken;\n const hasSilentRenewUrl = passedConfig.silentRenewUrl;\n if (usesSilentRenew && !usesRefreshToken && !hasSilentRenewUrl) {\n return {\n result: false,\n messages: ['Please provide a silent renew URL if using renew and not refresh tokens'],\n level: 'error'\n };\n }\n return POSITIVE_VALIDATION_RESULT;\n};\nconst useOfflineScopeWithSilentRenew = passedConfig => {\n const hasRefreshToken = passedConfig.useRefreshToken;\n const hasSilentRenew = passedConfig.silentRenew;\n const scope = passedConfig.scope || '';\n const hasOfflineScope = scope.split(' ').includes('offline_access');\n if (hasRefreshToken && hasSilentRenew && !hasOfflineScope) {\n return {\n result: false,\n messages: ['When using silent renew and refresh tokens please set the `offline_access` scope'],\n level: 'warning'\n };\n }\n return POSITIVE_VALIDATION_RESULT;\n};\nconst allRules = [ensureAuthority, useOfflineScopeWithSilentRenew, ensureRedirectRule, ensureClientId, ensureSilentRenewUrlWhenNoRefreshTokenUsed];\nconst allMultipleConfigRules = [ensureNoDuplicatedConfigsRule];\nlet ConfigValidationService = /*#__PURE__*/(() => {\n class ConfigValidationService {\n constructor() {\n this.loggerService = inject(LoggerService);\n }\n validateConfigs(passedConfigs) {\n return this.validateConfigsInternal(passedConfigs ?? [], allMultipleConfigRules);\n }\n validateConfig(passedConfig) {\n return this.validateConfigInternal(passedConfig, allRules);\n }\n validateConfigsInternal(passedConfigs, allRulesToUse) {\n if (passedConfigs.length === 0) {\n return false;\n }\n const allValidationResults = allRulesToUse.map(rule => rule(passedConfigs));\n let overallErrorCount = 0;\n passedConfigs.forEach(passedConfig => {\n const errorCount = this.processValidationResultsAndGetErrorCount(allValidationResults, passedConfig);\n overallErrorCount += errorCount;\n });\n return overallErrorCount === 0;\n }\n validateConfigInternal(passedConfig, allRulesToUse) {\n const allValidationResults = allRulesToUse.map(rule => rule(passedConfig));\n const errorCount = this.processValidationResultsAndGetErrorCount(allValidationResults, passedConfig);\n return errorCount === 0;\n }\n processValidationResultsAndGetErrorCount(allValidationResults, config) {\n const allMessages = allValidationResults.filter(x => x.messages.length > 0);\n const allErrorMessages = this.getAllMessagesOfType('error', allMessages);\n const allWarnings = this.getAllMessagesOfType('warning', allMessages);\n allErrorMessages.forEach(message => this.loggerService.logError(config, message));\n allWarnings.forEach(message => this.loggerService.logWarning(config, message));\n return allErrorMessages.length;\n }\n getAllMessagesOfType(type, results) {\n const allMessages = results.filter(x => x.level === type).map(result => result.messages);\n return allMessages.reduce((acc, val) => acc.concat(val), []);\n }\n static {\n this.ɵfac = function ConfigValidationService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || ConfigValidationService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ConfigValidationService,\n factory: ConfigValidationService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return ConfigValidationService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet ConfigurationService = /*#__PURE__*/(() => {\n class ConfigurationService {\n constructor() {\n this.loggerService = inject(LoggerService);\n this.publicEventsService = inject(PublicEventsService);\n this.storagePersistenceService = inject(StoragePersistenceService);\n this.platformProvider = inject(PlatformProvider);\n this.authWellKnownService = inject(AuthWellKnownService);\n this.loader = inject(StsConfigLoader);\n this.configValidationService = inject(ConfigValidationService);\n this.configsInternal = {};\n }\n hasManyConfigs() {\n return Object.keys(this.configsInternal).length > 1;\n }\n getAllConfigurations() {\n return Object.values(this.configsInternal);\n }\n getOpenIDConfiguration(configId) {\n if (this.configsAlreadySaved()) {\n return of(this.getConfig(configId));\n }\n return this.getOpenIDConfigurations(configId).pipe(map(result => result.currentConfig));\n }\n getOpenIDConfigurations(configId) {\n return this.loadConfigs().pipe(concatMap(allConfigs => this.prepareAndSaveConfigs(allConfigs)), map(allPreparedConfigs => ({\n allConfigs: allPreparedConfigs,\n currentConfig: this.getConfig(configId)\n })));\n }\n hasAtLeastOneConfig() {\n return Object.keys(this.configsInternal).length > 0;\n }\n saveConfig(readyConfig) {\n const {\n configId\n } = readyConfig;\n this.configsInternal[configId] = readyConfig;\n }\n loadConfigs() {\n return this.loader.loadConfigs();\n }\n configsAlreadySaved() {\n return this.hasAtLeastOneConfig();\n }\n getConfig(configId) {\n if (Boolean(configId)) {\n const config = this.configsInternal[configId];\n if (!config && isDevMode()) {\n console.warn(`[angular-auth-oidc-client] No configuration found for config id '${configId}'.`);\n }\n return config || null;\n }\n const [, value] = Object.entries(this.configsInternal)[0] || [[null, null]];\n return value || null;\n }\n prepareAndSaveConfigs(passedConfigs) {\n if (!this.configValidationService.validateConfigs(passedConfigs)) {\n return of([]);\n }\n this.createUniqueIds(passedConfigs);\n const allHandleConfigs$ = passedConfigs.map(x => this.handleConfig(x));\n const as = forkJoin(allHandleConfigs$).pipe(map(config => config.filter(conf => Boolean(conf))), map(c => c));\n return as;\n }\n createUniqueIds(passedConfigs) {\n passedConfigs.forEach((config, index) => {\n if (!config.configId) {\n config.configId = `${index}-${config.clientId}`;\n }\n });\n }\n handleConfig(passedConfig) {\n if (!this.configValidationService.validateConfig(passedConfig)) {\n this.loggerService.logError(passedConfig, 'Validation of config rejected with errors. Config is NOT set.');\n return of(null);\n }\n if (!passedConfig.authWellknownEndpointUrl) {\n passedConfig.authWellknownEndpointUrl = passedConfig.authority;\n }\n const usedConfig = this.prepareConfig(passedConfig);\n this.saveConfig(usedConfig);\n const configWithAuthWellKnown = this.enhanceConfigWithWellKnownEndpoint(usedConfig);\n this.publicEventsService.fireEvent(EventTypes.ConfigLoaded, configWithAuthWellKnown);\n return of(usedConfig);\n }\n enhanceConfigWithWellKnownEndpoint(configuration) {\n const alreadyExistingAuthWellKnownEndpoints = this.storagePersistenceService.read('authWellKnownEndPoints', configuration);\n if (!!alreadyExistingAuthWellKnownEndpoints) {\n configuration.authWellknownEndpoints = alreadyExistingAuthWellKnownEndpoints;\n return configuration;\n }\n const passedAuthWellKnownEndpoints = configuration.authWellknownEndpoints;\n if (!!passedAuthWellKnownEndpoints) {\n this.authWellKnownService.storeWellKnownEndpoints(configuration, passedAuthWellKnownEndpoints);\n configuration.authWellknownEndpoints = passedAuthWellKnownEndpoints;\n return configuration;\n }\n return configuration;\n }\n prepareConfig(configuration) {\n const openIdConfigurationInternal = {\n ...DEFAULT_CONFIG,\n ...configuration\n };\n this.setSpecialCases(openIdConfigurationInternal);\n return openIdConfigurationInternal;\n }\n setSpecialCases(currentConfig) {\n if (!this.platformProvider.isBrowser()) {\n currentConfig.startCheckSession = false;\n currentConfig.silentRenew = false;\n currentConfig.useRefreshToken = false;\n currentConfig.usePushedAuthorisationRequests = false;\n }\n }\n static {\n this.ɵfac = function ConfigurationService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || ConfigurationService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ConfigurationService,\n factory: ConfigurationService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return ConfigurationService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet IFrameService = /*#__PURE__*/(() => {\n class IFrameService {\n constructor() {\n this.document = inject(DOCUMENT);\n this.loggerService = inject(LoggerService);\n }\n getExistingIFrame(identifier) {\n const iFrameOnParent = this.getIFrameFromParentWindow(identifier);\n if (this.isIFrameElement(iFrameOnParent)) {\n return iFrameOnParent;\n }\n const iFrameOnSelf = this.getIFrameFromWindow(identifier);\n if (this.isIFrameElement(iFrameOnSelf)) {\n return iFrameOnSelf;\n }\n return null;\n }\n addIFrameToWindowBody(identifier, config) {\n const sessionIframe = this.document.createElement('iframe');\n sessionIframe.id = identifier;\n sessionIframe.title = identifier;\n this.loggerService.logDebug(config, sessionIframe);\n sessionIframe.style.display = 'none';\n this.document.body.appendChild(sessionIframe);\n return sessionIframe;\n }\n getIFrameFromParentWindow(identifier) {\n try {\n const iFrameElement = this.document.defaultView?.parent.document.getElementById(identifier);\n if (this.isIFrameElement(iFrameElement)) {\n return iFrameElement;\n }\n return null;\n } catch (e) {\n return null;\n }\n }\n getIFrameFromWindow(identifier) {\n const iFrameElement = this.document.getElementById(identifier);\n if (this.isIFrameElement(iFrameElement)) {\n return iFrameElement;\n }\n return null;\n }\n isIFrameElement(element) {\n return !!element && element instanceof HTMLIFrameElement;\n }\n static {\n this.ɵfac = function IFrameService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || IFrameService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: IFrameService,\n factory: IFrameService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return IFrameService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst IFRAME_FOR_SILENT_RENEW_IDENTIFIER = 'myiFrameForSilentRenew';\nlet SilentRenewService = /*#__PURE__*/(() => {\n class SilentRenewService {\n constructor() {\n this.refreshSessionWithIFrameCompletedInternal$ = new Subject();\n this.loggerService = inject(LoggerService);\n this.iFrameService = inject(IFrameService);\n this.flowsService = inject(FlowsService);\n this.resetAuthDataService = inject(ResetAuthDataService);\n this.flowsDataService = inject(FlowsDataService);\n this.authStateService = inject(AuthStateService);\n this.flowHelper = inject(FlowHelper);\n this.implicitFlowCallbackService = inject(ImplicitFlowCallbackService);\n this.intervalService = inject(IntervalService);\n }\n get refreshSessionWithIFrameCompleted$() {\n return this.refreshSessionWithIFrameCompletedInternal$.asObservable();\n }\n getOrCreateIframe(config) {\n const existingIframe = this.getExistingIframe();\n if (!existingIframe) {\n return this.iFrameService.addIFrameToWindowBody(IFRAME_FOR_SILENT_RENEW_IDENTIFIER, config);\n }\n return existingIframe;\n }\n isSilentRenewConfigured(configuration) {\n const {\n useRefreshToken,\n silentRenew\n } = configuration;\n return !useRefreshToken && Boolean(silentRenew);\n }\n codeFlowCallbackSilentRenewIframe(urlParts, config, allConfigs) {\n const params = new HttpParams({\n fromString: urlParts[1]\n });\n const errorParam = params.get('error');\n if (errorParam) {\n this.authStateService.updateAndPublishAuthState({\n isAuthenticated: false,\n validationResult: ValidationResult.LoginRequired,\n isRenewProcess: true\n });\n this.resetAuthDataService.resetAuthorizationData(config, allConfigs);\n this.flowsDataService.setNonce('', config);\n this.intervalService.stopPeriodicTokenCheck();\n return throwError(() => new Error(errorParam));\n }\n const code = params.get('code') ?? '';\n const state = params.get('state') ?? '';\n const sessionState = params.get('session_state');\n const callbackContext = {\n code,\n refreshToken: '',\n state,\n sessionState,\n authResult: null,\n isRenewProcess: true,\n jwtKeys: null,\n validationResult: null,\n existingIdToken: null\n };\n return this.flowsService.processSilentRenewCodeFlowCallback(callbackContext, config, allConfigs).pipe(catchError(error => {\n this.intervalService.stopPeriodicTokenCheck();\n this.resetAuthDataService.resetAuthorizationData(config, allConfigs);\n return throwError(() => new Error(error));\n }));\n }\n silentRenewEventHandler(e, config, allConfigs) {\n this.loggerService.logDebug(config, 'silentRenewEventHandler');\n if (!e.detail) {\n return;\n }\n let callback$;\n const isCodeFlow = this.flowHelper.isCurrentFlowCodeFlow(config);\n if (isCodeFlow) {\n const urlParts = e.detail.toString().split('?');\n callback$ = this.codeFlowCallbackSilentRenewIframe(urlParts, config, allConfigs);\n } else {\n callback$ = this.implicitFlowCallbackService.authenticatedImplicitFlowCallback(config, allConfigs, e.detail);\n }\n callback$.subscribe({\n next: callbackContext => {\n this.refreshSessionWithIFrameCompletedInternal$.next(callbackContext);\n this.flowsDataService.resetSilentRenewRunning(config);\n },\n error: err => {\n this.loggerService.logError(config, 'Error: ' + err);\n this.refreshSessionWithIFrameCompletedInternal$.next(null);\n this.flowsDataService.resetSilentRenewRunning(config);\n }\n });\n }\n getExistingIframe() {\n return this.iFrameService.getExistingIFrame(IFRAME_FOR_SILENT_RENEW_IDENTIFIER);\n }\n static {\n this.ɵfac = function SilentRenewService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || SilentRenewService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: SilentRenewService,\n factory: SilentRenewService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return SilentRenewService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet RefreshSessionIframeService = /*#__PURE__*/(() => {\n class RefreshSessionIframeService {\n constructor() {\n this.renderer = inject(RendererFactory2).createRenderer(null, null);\n this.loggerService = inject(LoggerService);\n this.urlService = inject(UrlService);\n this.silentRenewService = inject(SilentRenewService);\n this.document = inject(DOCUMENT);\n }\n refreshSessionWithIframe(config, allConfigs, customParams) {\n this.loggerService.logDebug(config, 'BEGIN refresh session Authorize Iframe renew');\n return this.urlService.getRefreshSessionSilentRenewUrl(config, customParams).pipe(switchMap(url => {\n return this.sendAuthorizeRequestUsingSilentRenew(url, config, allConfigs);\n }));\n }\n sendAuthorizeRequestUsingSilentRenew(url, config, allConfigs) {\n const sessionIframe = this.silentRenewService.getOrCreateIframe(config);\n this.initSilentRenewRequest(config, allConfigs);\n this.loggerService.logDebug(config, `sendAuthorizeRequestUsingSilentRenew for URL: ${url}`);\n return new Observable(observer => {\n const onLoadHandler = () => {\n sessionIframe.removeEventListener('load', onLoadHandler);\n this.loggerService.logDebug(config, 'removed event listener from IFrame');\n observer.next(true);\n observer.complete();\n };\n sessionIframe.addEventListener('load', onLoadHandler);\n sessionIframe.contentWindow?.location.replace(url ?? '');\n });\n }\n initSilentRenewRequest(config, allConfigs) {\n const instanceId = Math.random();\n const initDestroyHandler = this.renderer.listen('window', 'oidc-silent-renew-init', e => {\n if (e.detail !== instanceId) {\n initDestroyHandler();\n renewDestroyHandler();\n }\n });\n const renewDestroyHandler = this.renderer.listen('window', 'oidc-silent-renew-message', e => this.silentRenewService.silentRenewEventHandler(e, config, allConfigs));\n this.document.defaultView?.dispatchEvent(new CustomEvent('oidc-silent-renew-init', {\n detail: instanceId\n }));\n }\n static {\n this.ɵfac = function RefreshSessionIframeService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || RefreshSessionIframeService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RefreshSessionIframeService,\n factory: RefreshSessionIframeService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return RefreshSessionIframeService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet RefreshSessionRefreshTokenService = /*#__PURE__*/(() => {\n class RefreshSessionRefreshTokenService {\n constructor() {\n this.loggerService = inject(LoggerService);\n this.resetAuthDataService = inject(ResetAuthDataService);\n this.flowsService = inject(FlowsService);\n this.intervalService = inject(IntervalService);\n }\n refreshSessionWithRefreshTokens(config, allConfigs, customParamsRefresh) {\n this.loggerService.logDebug(config, 'BEGIN refresh session Authorize');\n let refreshTokenFailed = false;\n return this.flowsService.processRefreshToken(config, allConfigs, customParamsRefresh).pipe(catchError(error => {\n this.resetAuthDataService.resetAuthorizationData(config, allConfigs);\n refreshTokenFailed = true;\n return throwError(() => new Error(error));\n }), finalize(() => refreshTokenFailed && this.intervalService.stopPeriodicTokenCheck()));\n }\n static {\n this.ɵfac = function RefreshSessionRefreshTokenService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || RefreshSessionRefreshTokenService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RefreshSessionRefreshTokenService,\n factory: RefreshSessionRefreshTokenService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return RefreshSessionRefreshTokenService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet PeriodicallyTokenCheckService = /*#__PURE__*/(() => {\n class PeriodicallyTokenCheckService {\n constructor() {\n this.resetAuthDataService = inject(ResetAuthDataService);\n this.flowHelper = inject(FlowHelper);\n this.flowsDataService = inject(FlowsDataService);\n this.loggerService = inject(LoggerService);\n this.userService = inject(UserService);\n this.authStateService = inject(AuthStateService);\n this.refreshSessionIframeService = inject(RefreshSessionIframeService);\n this.refreshSessionRefreshTokenService = inject(RefreshSessionRefreshTokenService);\n this.intervalService = inject(IntervalService);\n this.storagePersistenceService = inject(StoragePersistenceService);\n this.publicEventsService = inject(PublicEventsService);\n this.configurationService = inject(ConfigurationService);\n }\n startTokenValidationPeriodically(allConfigs, currentConfig) {\n const configsWithSilentRenewEnabled = this.getConfigsWithSilentRenewEnabled(allConfigs);\n if (configsWithSilentRenewEnabled.length <= 0) {\n return;\n }\n if (this.intervalService.isTokenValidationRunning()) {\n return;\n }\n const refreshTimeInSeconds = this.getSmallestRefreshTimeFromConfigs(configsWithSilentRenewEnabled);\n const periodicallyCheck$ = this.intervalService.startPeriodicTokenCheck(refreshTimeInSeconds).pipe(switchMap(() => {\n const objectWithConfigIdsAndRefreshEvent = {};\n configsWithSilentRenewEnabled.forEach(config => {\n const identifier = config.configId;\n const refreshEvent = this.getRefreshEvent(config, allConfigs);\n objectWithConfigIdsAndRefreshEvent[identifier] = refreshEvent;\n });\n return forkJoin(objectWithConfigIdsAndRefreshEvent);\n }));\n this.intervalService.runTokenValidationRunning = periodicallyCheck$.pipe(catchError(error => throwError(() => new Error(error)))).subscribe({\n next: objectWithConfigIds => {\n for (const [configId, _] of Object.entries(objectWithConfigIds)) {\n this.configurationService.getOpenIDConfiguration(configId).subscribe(config => {\n this.loggerService.logDebug(config, 'silent renew, periodic check finished!');\n if (this.flowHelper.isCurrentFlowCodeFlowWithRefreshTokens(config)) {\n this.flowsDataService.resetSilentRenewRunning(config);\n }\n });\n }\n },\n error: error => {\n this.loggerService.logError(currentConfig, 'silent renew failed!', error);\n }\n });\n }\n getRefreshEvent(config, allConfigs) {\n const shouldStartRefreshEvent = this.shouldStartPeriodicallyCheckForConfig(config);\n if (!shouldStartRefreshEvent) {\n return of(null);\n }\n const refreshEvent$ = this.createRefreshEventForConfig(config, allConfigs);\n this.publicEventsService.fireEvent(EventTypes.SilentRenewStarted);\n return refreshEvent$.pipe(catchError(error => {\n this.loggerService.logError(config, 'silent renew failed!', error);\n this.publicEventsService.fireEvent(EventTypes.SilentRenewFailed, error);\n this.flowsDataService.resetSilentRenewRunning(config);\n return throwError(() => new Error(error));\n }));\n }\n getSmallestRefreshTimeFromConfigs(configsWithSilentRenewEnabled) {\n const result = configsWithSilentRenewEnabled.reduce((prev, curr) => (prev.tokenRefreshInSeconds ?? 0) < (curr.tokenRefreshInSeconds ?? 0) ? prev : curr);\n return result.tokenRefreshInSeconds ?? 0;\n }\n getConfigsWithSilentRenewEnabled(allConfigs) {\n return allConfigs.filter(x => x.silentRenew);\n }\n createRefreshEventForConfig(configuration, allConfigs) {\n this.loggerService.logDebug(configuration, 'starting silent renew...');\n return this.configurationService.getOpenIDConfiguration(configuration.configId).pipe(switchMap(config => {\n if (!config?.silentRenew) {\n this.resetAuthDataService.resetAuthorizationData(config, allConfigs);\n return of(null);\n }\n this.flowsDataService.setSilentRenewRunning(config);\n if (this.flowHelper.isCurrentFlowCodeFlowWithRefreshTokens(config)) {\n // Retrieve Dynamically Set Custom Params for refresh body\n const customParamsRefresh = this.storagePersistenceService.read('storageCustomParamsRefresh', config) || {};\n const {\n customParamsRefreshTokenRequest\n } = config;\n const mergedParams = {\n ...customParamsRefreshTokenRequest,\n ...customParamsRefresh\n };\n // Refresh Session using Refresh tokens\n return this.refreshSessionRefreshTokenService.refreshSessionWithRefreshTokens(config, allConfigs, mergedParams);\n }\n // Retrieve Dynamically Set Custom Params\n const customParams = this.storagePersistenceService.read('storageCustomParamsAuthRequest', config);\n return this.refreshSessionIframeService.refreshSessionWithIframe(config, allConfigs, customParams);\n }));\n }\n shouldStartPeriodicallyCheckForConfig(config) {\n const idToken = this.authStateService.getIdToken(config);\n const isSilentRenewRunning = this.flowsDataService.isSilentRenewRunning(config);\n const isCodeFlowInProgress = this.flowsDataService.isCodeFlowInProgress(config);\n const userDataFromStore = this.userService.getUserDataFromStore(config);\n this.loggerService.logDebug(config, `Checking: silentRenewRunning: ${isSilentRenewRunning}, isCodeFlowInProgress: ${isCodeFlowInProgress} - has idToken: ${!!idToken} - has userData: ${!!userDataFromStore}`);\n const shouldBeExecuted = !!userDataFromStore && !isSilentRenewRunning && !!idToken && !isCodeFlowInProgress;\n if (!shouldBeExecuted) {\n return false;\n }\n const idTokenExpired = this.authStateService.hasIdTokenExpiredAndRenewCheckIsEnabled(config);\n const accessTokenExpired = this.authStateService.hasAccessTokenExpiredIfExpiryExists(config);\n return idTokenExpired || accessTokenExpired;\n }\n static {\n this.ɵfac = function PeriodicallyTokenCheckService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || PeriodicallyTokenCheckService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: PeriodicallyTokenCheckService,\n factory: PeriodicallyTokenCheckService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return PeriodicallyTokenCheckService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst MAX_RETRY_ATTEMPTS = 3;\nlet RefreshSessionService = /*#__PURE__*/(() => {\n class RefreshSessionService {\n constructor() {\n this.flowHelper = inject(FlowHelper);\n this.flowsDataService = inject(FlowsDataService);\n this.loggerService = inject(LoggerService);\n this.silentRenewService = inject(SilentRenewService);\n this.authStateService = inject(AuthStateService);\n this.authWellKnownService = inject(AuthWellKnownService);\n this.refreshSessionIframeService = inject(RefreshSessionIframeService);\n this.storagePersistenceService = inject(StoragePersistenceService);\n this.refreshSessionRefreshTokenService = inject(RefreshSessionRefreshTokenService);\n this.userService = inject(UserService);\n }\n userForceRefreshSession(config, allConfigs, extraCustomParams) {\n if (!config) {\n return throwError(() => new Error('Please provide a configuration before setting up the module'));\n }\n this.persistCustomParams(extraCustomParams, config);\n return this.forceRefreshSession(config, allConfigs, extraCustomParams).pipe(tap(() => this.flowsDataService.resetSilentRenewRunning(config)));\n }\n forceRefreshSession(config, allConfigs, extraCustomParams) {\n const {\n customParamsRefreshTokenRequest,\n configId\n } = config;\n const mergedParams = {\n ...customParamsRefreshTokenRequest,\n ...extraCustomParams\n };\n if (this.flowHelper.isCurrentFlowCodeFlowWithRefreshTokens(config)) {\n return this.startRefreshSession(config, allConfigs, mergedParams).pipe(map(() => {\n const isAuthenticated = this.authStateService.areAuthStorageTokensValid(config);\n if (isAuthenticated) {\n return {\n idToken: this.authStateService.getIdToken(config),\n accessToken: this.authStateService.getAccessToken(config),\n userData: this.userService.getUserDataFromStore(config),\n isAuthenticated,\n configId\n };\n }\n return {\n isAuthenticated: false,\n errorMessage: '',\n userData: null,\n idToken: '',\n accessToken: '',\n configId\n };\n }));\n }\n const {\n silentRenewTimeoutInSeconds\n } = config;\n const timeOutTime = (silentRenewTimeoutInSeconds ?? 0) * 1000;\n return forkJoin([this.startRefreshSession(config, allConfigs, extraCustomParams), this.silentRenewService.refreshSessionWithIFrameCompleted$.pipe(take(1))]).pipe(timeout(timeOutTime), retryWhen(errors => {\n return errors.pipe(mergeMap((error, index) => {\n const scalingDuration = 1000;\n const currentAttempt = index + 1;\n if (!(error instanceof TimeoutError) || currentAttempt > MAX_RETRY_ATTEMPTS) {\n return throwError(() => new Error(error));\n }\n this.loggerService.logDebug(config, `forceRefreshSession timeout. Attempt #${currentAttempt}`);\n this.flowsDataService.resetSilentRenewRunning(config);\n return timer(currentAttempt * scalingDuration);\n }));\n }), map(([_, callbackContext]) => {\n const isAuthenticated = this.authStateService.areAuthStorageTokensValid(config);\n if (isAuthenticated) {\n return {\n idToken: callbackContext?.authResult?.id_token ?? '',\n accessToken: callbackContext?.authResult?.access_token ?? '',\n userData: this.userService.getUserDataFromStore(config),\n isAuthenticated,\n configId\n };\n }\n return {\n isAuthenticated: false,\n errorMessage: '',\n userData: null,\n idToken: '',\n accessToken: '',\n configId\n };\n }));\n }\n persistCustomParams(extraCustomParams, config) {\n const {\n useRefreshToken\n } = config;\n if (extraCustomParams) {\n if (useRefreshToken) {\n this.storagePersistenceService.write('storageCustomParamsRefresh', extraCustomParams, config);\n } else {\n this.storagePersistenceService.write('storageCustomParamsAuthRequest', extraCustomParams, config);\n }\n }\n }\n startRefreshSession(config, allConfigs, extraCustomParams) {\n const isSilentRenewRunning = this.flowsDataService.isSilentRenewRunning(config);\n this.loggerService.logDebug(config, `Checking: silentRenewRunning: ${isSilentRenewRunning}`);\n const shouldBeExecuted = !isSilentRenewRunning;\n if (!shouldBeExecuted) {\n return of(null);\n }\n return this.authWellKnownService.queryAndStoreAuthWellKnownEndPoints(config).pipe(switchMap(() => {\n this.flowsDataService.setSilentRenewRunning(config);\n if (this.flowHelper.isCurrentFlowCodeFlowWithRefreshTokens(config)) {\n // Refresh Session using Refresh tokens\n return this.refreshSessionRefreshTokenService.refreshSessionWithRefreshTokens(config, allConfigs, extraCustomParams);\n }\n return this.refreshSessionIframeService.refreshSessionWithIframe(config, allConfigs, extraCustomParams);\n }));\n }\n static {\n this.ɵfac = function RefreshSessionService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || RefreshSessionService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RefreshSessionService,\n factory: RefreshSessionService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return RefreshSessionService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst IFRAME_FOR_CHECK_SESSION_IDENTIFIER = 'myiFrameForCheckSession';\n// http://openid.net/specs/openid-connect-session-1_0-ID4.html\nlet CheckSessionService = /*#__PURE__*/(() => {\n class CheckSessionService {\n constructor() {\n this.loggerService = inject(LoggerService);\n this.storagePersistenceService = inject(StoragePersistenceService);\n this.iFrameService = inject(IFrameService);\n this.eventService = inject(PublicEventsService);\n this.zone = inject(NgZone);\n this.document = inject(DOCUMENT);\n this.checkSessionReceived = false;\n this.scheduledHeartBeatRunning = null;\n this.lastIFrameRefresh = 0;\n this.outstandingMessages = 0;\n this.heartBeatInterval = 3000;\n this.iframeRefreshInterval = 60000;\n this.checkSessionChangedInternal$ = new BehaviorSubject(false);\n }\n get checkSessionChanged$() {\n return this.checkSessionChangedInternal$.asObservable();\n }\n ngOnDestroy() {\n this.stop();\n const windowAsDefaultView = this.document.defaultView;\n if (windowAsDefaultView && this.iframeMessageEventListener) {\n windowAsDefaultView.removeEventListener('message', this.iframeMessageEventListener, false);\n }\n }\n isCheckSessionConfigured(configuration) {\n const {\n startCheckSession\n } = configuration;\n return Boolean(startCheckSession);\n }\n start(configuration) {\n if (!!this.scheduledHeartBeatRunning) {\n return;\n }\n const {\n clientId\n } = configuration;\n this.pollServerSession(clientId, configuration);\n }\n stop() {\n if (!this.scheduledHeartBeatRunning) {\n return;\n }\n this.clearScheduledHeartBeat();\n this.checkSessionReceived = false;\n }\n serverStateChanged(configuration) {\n const {\n startCheckSession\n } = configuration;\n return Boolean(startCheckSession) && this.checkSessionReceived;\n }\n getExistingIframe() {\n return this.iFrameService.getExistingIFrame(IFRAME_FOR_CHECK_SESSION_IDENTIFIER);\n }\n init(configuration) {\n if (this.lastIFrameRefresh + this.iframeRefreshInterval > Date.now()) {\n return of();\n }\n const authWellKnownEndPoints = this.storagePersistenceService.read('authWellKnownEndPoints', configuration);\n if (!authWellKnownEndPoints) {\n this.loggerService.logWarning(configuration, 'CheckSession - init check session: authWellKnownEndpoints is undefined. Returning.');\n return of();\n }\n const existingIframe = this.getOrCreateIframe(configuration);\n // https://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-EventTarget-addEventListener\n // If multiple identical EventListeners are registered on the same EventTarget with the same parameters the duplicate instances are discarded. They do not cause the EventListener to be called twice and since they are discarded they do not need to be removed with the removeEventListener method.\n // this is done even if iframe exists for HMR to work, since iframe exists on service init\n this.bindMessageEventToIframe(configuration);\n const checkSessionIframe = authWellKnownEndPoints.checkSessionIframe;\n const contentWindow = existingIframe.contentWindow;\n if (!checkSessionIframe) {\n this.loggerService.logWarning(configuration, 'CheckSession - init check session: checkSessionIframe is not configured to run');\n return of();\n }\n if (!contentWindow) {\n this.loggerService.logWarning(configuration, 'CheckSession - init check session: IFrame contentWindow does not exist');\n } else {\n contentWindow.location.replace(checkSessionIframe);\n }\n return new Observable(observer => {\n existingIframe.onload = () => {\n this.lastIFrameRefresh = Date.now();\n observer.next();\n observer.complete();\n };\n });\n }\n pollServerSession(clientId, configuration) {\n this.outstandingMessages = 0;\n const pollServerSessionRecur = () => {\n this.init(configuration).pipe(take(1)).subscribe(() => {\n const existingIframe = this.getExistingIframe();\n if (existingIframe && clientId) {\n this.loggerService.logDebug(configuration, `CheckSession - clientId : '${clientId}' - existingIframe: '${existingIframe}'`);\n const sessionState = this.storagePersistenceService.read('session_state', configuration);\n const authWellKnownEndPoints = this.storagePersistenceService.read('authWellKnownEndPoints', configuration);\n const contentWindow = existingIframe.contentWindow;\n if (sessionState && authWellKnownEndPoints?.checkSessionIframe && contentWindow) {\n const iframeOrigin = new URL(authWellKnownEndPoints.checkSessionIframe)?.origin;\n this.outstandingMessages++;\n contentWindow.postMessage(clientId + ' ' + sessionState, iframeOrigin);\n } else {\n this.loggerService.logDebug(configuration, `CheckSession - session_state is '${sessionState}' - AuthWellKnownEndPoints is '${JSON.stringify(authWellKnownEndPoints, null, 2)}'`);\n this.checkSessionChangedInternal$.next(true);\n }\n } else {\n this.loggerService.logWarning(configuration, `CheckSession - OidcSecurityCheckSession pollServerSession checkSession IFrame does not exist:\n clientId : '${clientId}' - existingIframe: '${existingIframe}'`);\n }\n // after sending three messages with no response, fail.\n if (this.outstandingMessages > 3) {\n this.loggerService.logError(configuration, `CheckSession - OidcSecurityCheckSession not receiving check session response messages.\n Outstanding messages: '${this.outstandingMessages}'. Server unreachable?`);\n }\n this.zone.runOutsideAngular(() => {\n this.scheduledHeartBeatRunning = this.document?.defaultView?.setTimeout(() => this.zone.run(pollServerSessionRecur), this.heartBeatInterval) ?? null;\n });\n });\n };\n pollServerSessionRecur();\n }\n clearScheduledHeartBeat() {\n if (this.scheduledHeartBeatRunning !== null) {\n clearTimeout(this.scheduledHeartBeatRunning);\n this.scheduledHeartBeatRunning = null;\n }\n }\n messageHandler(configuration, e) {\n const existingIFrame = this.getExistingIframe();\n const authWellKnownEndPoints = this.storagePersistenceService.read('authWellKnownEndPoints', configuration);\n const startsWith = !!authWellKnownEndPoints?.checkSessionIframe?.startsWith(e.origin);\n this.outstandingMessages = 0;\n if (existingIFrame && startsWith && e.source === existingIFrame.contentWindow) {\n if (e.data === 'error') {\n this.loggerService.logWarning(configuration, 'CheckSession - error from check session messageHandler');\n } else if (e.data === 'changed') {\n this.loggerService.logDebug(configuration, `CheckSession - ${e} from check session messageHandler`);\n this.checkSessionReceived = true;\n this.eventService.fireEvent(EventTypes.CheckSessionReceived, e.data);\n this.checkSessionChangedInternal$.next(true);\n } else {\n this.eventService.fireEvent(EventTypes.CheckSessionReceived, e.data);\n this.loggerService.logDebug(configuration, `CheckSession - ${e.data} from check session messageHandler`);\n }\n }\n }\n bindMessageEventToIframe(configuration) {\n this.iframeMessageEventListener = this.messageHandler.bind(this, configuration);\n const defaultView = this.document.defaultView;\n if (defaultView) {\n defaultView.addEventListener('message', this.iframeMessageEventListener, false);\n }\n }\n getOrCreateIframe(configuration) {\n return this.getExistingIframe() || this.iFrameService.addIFrameToWindowBody(IFRAME_FOR_CHECK_SESSION_IDENTIFIER, configuration);\n }\n static {\n this.ɵfac = function CheckSessionService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || CheckSessionService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: CheckSessionService,\n factory: CheckSessionService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return CheckSessionService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet PopUpService = /*#__PURE__*/(() => {\n class PopUpService {\n constructor() {\n this.loggerService = inject(LoggerService);\n this.storagePersistenceService = inject(StoragePersistenceService);\n this.document = inject(DOCUMENT);\n this.STORAGE_IDENTIFIER = 'popupauth';\n this.popUp = null;\n this.handle = -1;\n this.resultInternal$ = new Subject();\n }\n get result$() {\n return this.resultInternal$.asObservable();\n }\n get windowInternal() {\n return this.document.defaultView;\n }\n isCurrentlyInPopup(config) {\n if (this.canAccessSessionStorage()) {\n const popup = this.storagePersistenceService.read(this.STORAGE_IDENTIFIER, config);\n const windowIdentifier = this.windowInternal;\n if (!windowIdentifier) {\n return false;\n }\n return Boolean(windowIdentifier.opener) && windowIdentifier.opener !== windowIdentifier && Boolean(popup);\n }\n return false;\n }\n openPopUp(url, popupOptions, config) {\n const optionsToPass = this.getOptions(popupOptions);\n this.storagePersistenceService.write(this.STORAGE_IDENTIFIER, 'true', config);\n const windowIdentifier = this.windowInternal;\n if (!windowIdentifier) {\n return;\n }\n if (!url) {\n this.loggerService.logError(config, 'Could not open popup, url is empty');\n return;\n }\n this.popUp = windowIdentifier.open(url, '_blank', optionsToPass);\n if (!this.popUp) {\n this.storagePersistenceService.remove(this.STORAGE_IDENTIFIER, config);\n this.loggerService.logError(config, 'Could not open popup');\n return;\n }\n this.loggerService.logDebug(config, 'Opened popup with url ' + url);\n const listener = event => {\n if (!event?.data || typeof event.data !== 'string') {\n if (config.disableCleaningPopupOnInvalidMessage) {\n return;\n }\n this.cleanUp(listener, config);\n return;\n }\n this.loggerService.logDebug(config, 'Received message from popup with url ' + event.data);\n this.resultInternal$.next({\n userClosed: false,\n receivedUrl: event.data\n });\n this.cleanUp(listener, config);\n };\n windowIdentifier.addEventListener('message', listener, false);\n this.handle = windowIdentifier.setInterval(() => {\n if (this.popUp?.closed) {\n this.resultInternal$.next({\n userClosed: true,\n receivedUrl: ''\n });\n this.cleanUp(listener, config);\n }\n }, 200);\n }\n sendMessageToMainWindow(url, config) {\n const windowIdentifier = this.windowInternal;\n if (!windowIdentifier) {\n return;\n }\n if (windowIdentifier.opener) {\n const href = windowIdentifier.location.href;\n this.sendMessage(url, href, config);\n }\n }\n cleanUp(listener, config) {\n const windowIdentifier = this.windowInternal;\n if (!windowIdentifier) {\n return;\n }\n windowIdentifier.removeEventListener('message', listener, false);\n windowIdentifier.clearInterval(this.handle);\n if (this.popUp) {\n this.storagePersistenceService.remove(this.STORAGE_IDENTIFIER, config);\n this.popUp.close();\n this.popUp = null;\n }\n }\n sendMessage(url, href, config) {\n const windowIdentifier = this.windowInternal;\n if (!windowIdentifier) {\n return;\n }\n if (!url) {\n this.loggerService.logDebug(config, `Can not send message to parent, no url: '${url}'`);\n return;\n }\n windowIdentifier.opener.postMessage(url, href);\n }\n getOptions(popupOptions) {\n const popupDefaultOptions = {\n width: 500,\n height: 500,\n left: 50,\n top: 50\n };\n const options = {\n ...popupDefaultOptions,\n ...(popupOptions || {})\n };\n const windowIdentifier = this.windowInternal;\n if (!windowIdentifier) {\n return '';\n }\n const width = options.width || popupDefaultOptions.width;\n const height = options.height || popupDefaultOptions.height;\n const left = windowIdentifier.screenLeft + (windowIdentifier.outerWidth - width) / 2;\n const top = windowIdentifier.screenTop + (windowIdentifier.outerHeight - height) / 2;\n options.left = left;\n options.top = top;\n return Object.entries(options).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join(',');\n }\n canAccessSessionStorage() {\n return typeof navigator !== 'undefined' && navigator.cookieEnabled && typeof Storage !== 'undefined';\n }\n static {\n this.ɵfac = function PopUpService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || PopUpService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: PopUpService,\n factory: PopUpService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return PopUpService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet CurrentUrlService = /*#__PURE__*/(() => {\n class CurrentUrlService {\n constructor() {\n this.document = inject(DOCUMENT);\n }\n getStateParamFromCurrentUrl(url) {\n const currentUrl = url || this.getCurrentUrl();\n if (!currentUrl) {\n return null;\n }\n const parsedUrl = new URL(currentUrl);\n const urlParams = new URLSearchParams(parsedUrl.search);\n return urlParams.get('state');\n }\n getCurrentUrl() {\n return this.document?.defaultView?.location.toString() ?? null;\n }\n static {\n this.ɵfac = function CurrentUrlService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || CurrentUrlService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: CurrentUrlService,\n factory: CurrentUrlService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return CurrentUrlService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet CheckAuthService = /*#__PURE__*/(() => {\n class CheckAuthService {\n constructor() {\n this.checkSessionService = inject(CheckSessionService);\n this.currentUrlService = inject(CurrentUrlService);\n this.silentRenewService = inject(SilentRenewService);\n this.userService = inject(UserService);\n this.loggerService = inject(LoggerService);\n this.authStateService = inject(AuthStateService);\n this.callbackService = inject(CallbackService);\n this.refreshSessionService = inject(RefreshSessionService);\n this.periodicallyTokenCheckService = inject(PeriodicallyTokenCheckService);\n this.popupService = inject(PopUpService);\n this.autoLoginService = inject(AutoLoginService);\n this.storagePersistenceService = inject(StoragePersistenceService);\n this.publicEventsService = inject(PublicEventsService);\n }\n getConfig(configuration, url) {\n const stateParamFromUrl = this.currentUrlService.getStateParamFromCurrentUrl(url);\n return Boolean(stateParamFromUrl) ? this.getConfigurationWithUrlState([configuration], stateParamFromUrl) : configuration;\n }\n checkAuth(configuration, allConfigs, url) {\n if (!configuration) {\n return throwError(() => new Error('Please provide a configuration before setting up the module'));\n }\n this.publicEventsService.fireEvent(EventTypes.CheckingAuth);\n const stateParamFromUrl = this.currentUrlService.getStateParamFromCurrentUrl(url);\n const config = this.getConfig(configuration, url);\n if (!config) {\n return throwError(() => new Error(`could not find matching config for state ${stateParamFromUrl}`));\n }\n return this.checkAuthWithConfig(configuration, allConfigs, url);\n }\n checkAuthMultiple(allConfigs, url) {\n const stateParamFromUrl = this.currentUrlService.getStateParamFromCurrentUrl(url);\n if (stateParamFromUrl) {\n const config = this.getConfigurationWithUrlState(allConfigs, stateParamFromUrl);\n if (!config) {\n return throwError(() => new Error(`could not find matching config for state ${stateParamFromUrl}`));\n }\n return this.composeMultipleLoginResults(allConfigs, config, url);\n }\n const configs = allConfigs;\n const allChecks$ = configs.map(x => this.checkAuthWithConfig(x, configs, url));\n return forkJoin(allChecks$);\n }\n checkAuthIncludingServer(configuration, allConfigs) {\n if (!configuration) {\n return throwError(() => new Error('Please provide a configuration before setting up the module'));\n }\n return this.checkAuthWithConfig(configuration, allConfigs).pipe(switchMap(loginResponse => {\n const {\n isAuthenticated\n } = loginResponse;\n if (isAuthenticated) {\n return of(loginResponse);\n }\n return this.refreshSessionService.forceRefreshSession(configuration, allConfigs).pipe(tap(loginResponseAfterRefreshSession => {\n if (loginResponseAfterRefreshSession?.isAuthenticated) {\n this.startCheckSessionAndValidation(configuration, allConfigs);\n }\n }));\n }));\n }\n checkAuthWithConfig(config, allConfigs, url) {\n if (!config) {\n const errorMessage = 'Please provide at least one configuration before setting up the module';\n this.loggerService.logError(config, errorMessage);\n const result = {\n isAuthenticated: false,\n errorMessage,\n userData: null,\n idToken: '',\n accessToken: '',\n configId: ''\n };\n return of(result);\n }\n const currentUrl = url || this.currentUrlService.getCurrentUrl();\n if (!currentUrl) {\n const errorMessage = 'No URL found!';\n this.loggerService.logError(config, errorMessage);\n const result = {\n isAuthenticated: false,\n errorMessage,\n userData: null,\n idToken: '',\n accessToken: '',\n configId: ''\n };\n return of(result);\n }\n const {\n configId,\n authority\n } = config;\n this.loggerService.logDebug(config, `Working with config '${configId}' using '${authority}'`);\n if (this.popupService.isCurrentlyInPopup(config)) {\n this.popupService.sendMessageToMainWindow(currentUrl, config);\n const result = {\n isAuthenticated: false,\n errorMessage: '',\n userData: null,\n idToken: '',\n accessToken: '',\n configId: ''\n };\n return of(result);\n }\n const isCallback = this.callbackService.isCallback(currentUrl, config);\n this.loggerService.logDebug(config, `currentUrl to check auth with: '${currentUrl}'`);\n const callback$ = isCallback ? this.callbackService.handleCallbackAndFireEvents(currentUrl, config, allConfigs) : of({});\n return callback$.pipe(map(() => {\n const isAuthenticated = this.authStateService.areAuthStorageTokensValid(config);\n this.loggerService.logDebug(config, `checkAuth completed. Firing events now. isAuthenticated: ${isAuthenticated}`);\n if (isAuthenticated) {\n this.startCheckSessionAndValidation(config, allConfigs);\n if (!isCallback) {\n this.authStateService.setAuthenticatedAndFireEvent(allConfigs);\n this.userService.publishUserDataIfExists(config, allConfigs);\n }\n }\n this.publicEventsService.fireEvent(EventTypes.CheckingAuthFinished);\n const result = {\n isAuthenticated,\n userData: this.userService.getUserDataFromStore(config),\n accessToken: this.authStateService.getAccessToken(config),\n idToken: this.authStateService.getIdToken(config),\n configId\n };\n return result;\n }), tap(({\n isAuthenticated\n }) => {\n if (isAuthenticated) {\n this.autoLoginService.checkSavedRedirectRouteAndNavigate(config);\n }\n }), catchError(({\n message\n }) => {\n this.loggerService.logError(config, message);\n this.publicEventsService.fireEvent(EventTypes.CheckingAuthFinishedWithError, message);\n const result = {\n isAuthenticated: false,\n errorMessage: message,\n userData: null,\n idToken: '',\n accessToken: '',\n configId\n };\n return of(result);\n }));\n }\n startCheckSessionAndValidation(config, allConfigs) {\n if (this.checkSessionService.isCheckSessionConfigured(config)) {\n this.checkSessionService.start(config);\n }\n this.periodicallyTokenCheckService.startTokenValidationPeriodically(allConfigs, config);\n if (this.silentRenewService.isSilentRenewConfigured(config)) {\n this.silentRenewService.getOrCreateIframe(config);\n }\n }\n getConfigurationWithUrlState(configurations, stateFromUrl) {\n if (!stateFromUrl) {\n return null;\n }\n for (const config of configurations) {\n const storedState = this.storagePersistenceService.read('authStateControl', config);\n if (storedState === stateFromUrl) {\n return config;\n }\n }\n return null;\n }\n composeMultipleLoginResults(configurations, activeConfig, url) {\n const allOtherConfigs = configurations.filter(x => x.configId !== activeConfig.configId);\n const currentConfigResult = this.checkAuthWithConfig(activeConfig, configurations, url);\n const allOtherConfigResults = allOtherConfigs.map(config => {\n const {\n redirectUrl\n } = config;\n return this.checkAuthWithConfig(config, configurations, redirectUrl);\n });\n return forkJoin([currentConfigResult, ...allOtherConfigResults]);\n }\n static {\n this.ɵfac = function CheckAuthService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || CheckAuthService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: CheckAuthService,\n factory: CheckAuthService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return CheckAuthService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet RedirectService = /*#__PURE__*/(() => {\n class RedirectService {\n constructor() {\n this.document = inject(DOCUMENT);\n }\n redirectTo(url) {\n this.document.location.href = url;\n }\n static {\n this.ɵfac = function RedirectService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || RedirectService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RedirectService,\n factory: RedirectService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return RedirectService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet ResponseTypeValidationService = /*#__PURE__*/(() => {\n class ResponseTypeValidationService {\n constructor() {\n this.loggerService = inject(LoggerService);\n this.flowHelper = inject(FlowHelper);\n }\n hasConfigValidResponseType(configuration) {\n if (this.flowHelper.isCurrentFlowAnyImplicitFlow(configuration)) {\n return true;\n }\n if (this.flowHelper.isCurrentFlowCodeFlow(configuration)) {\n return true;\n }\n this.loggerService.logWarning(configuration, 'module configured incorrectly, invalid response_type. Check the responseType in the config');\n return false;\n }\n static {\n this.ɵfac = function ResponseTypeValidationService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || ResponseTypeValidationService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ResponseTypeValidationService,\n factory: ResponseTypeValidationService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return ResponseTypeValidationService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet ParService = /*#__PURE__*/(() => {\n class ParService {\n constructor() {\n this.loggerService = inject(LoggerService);\n this.urlService = inject(UrlService);\n this.dataService = inject(DataService);\n this.storagePersistenceService = inject(StoragePersistenceService);\n }\n postParRequest(configuration, authOptions) {\n let headers = new HttpHeaders();\n headers = headers.set('Content-Type', 'application/x-www-form-urlencoded');\n const authWellKnownEndpoints = this.storagePersistenceService.read('authWellKnownEndPoints', configuration);\n if (!authWellKnownEndpoints) {\n return throwError(() => new Error('Could not read PAR endpoint because authWellKnownEndPoints are not given'));\n }\n const parEndpoint = authWellKnownEndpoints.parEndpoint;\n if (!parEndpoint) {\n return throwError(() => new Error('Could not read PAR endpoint from authWellKnownEndpoints'));\n }\n return this.urlService.createBodyForParCodeFlowRequest(configuration, authOptions).pipe(switchMap(data => {\n return this.dataService.post(parEndpoint, data, configuration, headers).pipe(retry(2), map(response => {\n this.loggerService.logDebug(configuration, 'par response: ', response);\n return {\n expiresIn: response.expires_in,\n requestUri: response.request_uri\n };\n }), catchError(error => {\n const errorMessage = `There was an error on ParService postParRequest`;\n this.loggerService.logError(configuration, errorMessage, error);\n return throwError(() => new Error(errorMessage));\n }));\n }));\n }\n static {\n this.ɵfac = function ParService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || ParService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ParService,\n factory: ParService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return ParService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet ParLoginService = /*#__PURE__*/(() => {\n class ParLoginService {\n constructor() {\n this.loggerService = inject(LoggerService);\n this.responseTypeValidationService = inject(ResponseTypeValidationService);\n this.urlService = inject(UrlService);\n this.redirectService = inject(RedirectService);\n this.authWellKnownService = inject(AuthWellKnownService);\n this.popupService = inject(PopUpService);\n this.checkAuthService = inject(CheckAuthService);\n this.parService = inject(ParService);\n }\n loginPar(configuration, authOptions) {\n if (!this.responseTypeValidationService.hasConfigValidResponseType(configuration)) {\n this.loggerService.logError(configuration, 'Invalid response type!');\n return;\n }\n this.loggerService.logDebug(configuration, 'BEGIN Authorize OIDC Flow, no auth data');\n this.authWellKnownService.queryAndStoreAuthWellKnownEndPoints(configuration).pipe(switchMap(() => this.parService.postParRequest(configuration, authOptions))).subscribe(response => {\n this.loggerService.logDebug(configuration, 'par response: ', response);\n const url = this.urlService.getAuthorizeParUrl(response.requestUri, configuration);\n this.loggerService.logDebug(configuration, 'par request url: ', url);\n if (!url) {\n this.loggerService.logError(configuration, `Could not create URL with param ${response.requestUri}: '${url}'`);\n return;\n }\n if (authOptions?.urlHandler) {\n authOptions.urlHandler(url);\n } else {\n this.redirectService.redirectTo(url);\n }\n });\n }\n loginWithPopUpPar(configuration, allConfigs, authOptions, popupOptions) {\n const {\n configId\n } = configuration;\n if (!this.responseTypeValidationService.hasConfigValidResponseType(configuration)) {\n const errorMessage = 'Invalid response type!';\n this.loggerService.logError(configuration, errorMessage);\n return throwError(() => new Error(errorMessage));\n }\n this.loggerService.logDebug(configuration, 'BEGIN Authorize OIDC Flow with popup, no auth data');\n return this.authWellKnownService.queryAndStoreAuthWellKnownEndPoints(configuration).pipe(switchMap(() => this.parService.postParRequest(configuration, authOptions)), switchMap(response => {\n this.loggerService.logDebug(configuration, `par response: ${response}`);\n const url = this.urlService.getAuthorizeParUrl(response.requestUri, configuration);\n this.loggerService.logDebug(configuration, 'par request url: ', url);\n if (!url) {\n const errorMessage = `Could not create URL with param ${response.requestUri}: 'url'`;\n this.loggerService.logError(configuration, errorMessage);\n return throwError(() => new Error(errorMessage));\n }\n this.popupService.openPopUp(url, popupOptions, configuration);\n return this.popupService.result$.pipe(take(1), switchMap(result => {\n const {\n userClosed,\n receivedUrl\n } = result;\n if (userClosed) {\n return of({\n isAuthenticated: false,\n errorMessage: 'User closed popup',\n userData: null,\n idToken: '',\n accessToken: '',\n configId\n });\n }\n return this.checkAuthService.checkAuth(configuration, allConfigs, receivedUrl);\n }));\n }));\n }\n static {\n this.ɵfac = function ParLoginService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || ParLoginService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ParLoginService,\n factory: ParLoginService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return ParLoginService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet PopUpLoginService = /*#__PURE__*/(() => {\n class PopUpLoginService {\n constructor() {\n this.loggerService = inject(LoggerService);\n this.responseTypeValidationService = inject(ResponseTypeValidationService);\n this.urlService = inject(UrlService);\n this.authWellKnownService = inject(AuthWellKnownService);\n this.popupService = inject(PopUpService);\n this.checkAuthService = inject(CheckAuthService);\n }\n loginWithPopUpStandard(configuration, allConfigs, authOptions, popupOptions) {\n const {\n configId\n } = configuration;\n if (!this.responseTypeValidationService.hasConfigValidResponseType(configuration)) {\n const errorMessage = 'Invalid response type!';\n this.loggerService.logError(configuration, errorMessage);\n return throwError(() => new Error(errorMessage));\n }\n this.loggerService.logDebug(configuration, 'BEGIN Authorize OIDC Flow with popup, no auth data');\n return this.authWellKnownService.queryAndStoreAuthWellKnownEndPoints(configuration).pipe(switchMap(() => this.urlService.getAuthorizeUrl(configuration, authOptions)), tap(authUrl => this.popupService.openPopUp(authUrl, popupOptions, configuration)), switchMap(() => {\n return this.popupService.result$.pipe(take(1), switchMap(result => {\n const {\n userClosed,\n receivedUrl\n } = result;\n if (userClosed) {\n const response = {\n isAuthenticated: false,\n errorMessage: 'User closed popup',\n userData: null,\n idToken: '',\n accessToken: '',\n configId\n };\n return of(response);\n }\n return this.checkAuthService.checkAuth(configuration, allConfigs, receivedUrl);\n }));\n }));\n }\n static {\n this.ɵfac = function PopUpLoginService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || PopUpLoginService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: PopUpLoginService,\n factory: PopUpLoginService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return PopUpLoginService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet StandardLoginService = /*#__PURE__*/(() => {\n class StandardLoginService {\n constructor() {\n this.loggerService = inject(LoggerService);\n this.responseTypeValidationService = inject(ResponseTypeValidationService);\n this.urlService = inject(UrlService);\n this.redirectService = inject(RedirectService);\n this.authWellKnownService = inject(AuthWellKnownService);\n this.flowsDataService = inject(FlowsDataService);\n }\n loginStandard(configuration, authOptions) {\n if (!this.responseTypeValidationService.hasConfigValidResponseType(configuration)) {\n this.loggerService.logError(configuration, 'Invalid response type!');\n return;\n }\n this.loggerService.logDebug(configuration, 'BEGIN Authorize OIDC Flow, no auth data');\n this.flowsDataService.setCodeFlowInProgress(configuration);\n this.authWellKnownService.queryAndStoreAuthWellKnownEndPoints(configuration).subscribe(() => {\n const {\n urlHandler\n } = authOptions || {};\n this.flowsDataService.resetSilentRenewRunning(configuration);\n this.urlService.getAuthorizeUrl(configuration, authOptions).subscribe(url => {\n if (!url) {\n this.loggerService.logError(configuration, 'Could not create URL', url);\n return;\n }\n if (urlHandler) {\n urlHandler(url);\n } else {\n this.redirectService.redirectTo(url);\n }\n });\n });\n }\n static {\n this.ɵfac = function StandardLoginService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || StandardLoginService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: StandardLoginService,\n factory: StandardLoginService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return StandardLoginService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet LoginService = /*#__PURE__*/(() => {\n class LoginService {\n constructor() {\n this.parLoginService = inject(ParLoginService);\n this.popUpLoginService = inject(PopUpLoginService);\n this.standardLoginService = inject(StandardLoginService);\n this.storagePersistenceService = inject(StoragePersistenceService);\n this.popupService = inject(PopUpService);\n }\n login(configuration, authOptions) {\n if (!configuration) {\n throw new Error('Please provide a configuration before setting up the module');\n }\n const {\n usePushedAuthorisationRequests\n } = configuration;\n if (authOptions?.customParams) {\n this.storagePersistenceService.write('storageCustomParamsAuthRequest', authOptions.customParams, configuration);\n }\n if (usePushedAuthorisationRequests) {\n return this.parLoginService.loginPar(configuration, authOptions);\n } else {\n return this.standardLoginService.loginStandard(configuration, authOptions);\n }\n }\n loginWithPopUp(configuration, allConfigs, authOptions, popupOptions) {\n if (!configuration) {\n throw new Error('Please provide a configuration before setting up the module');\n }\n const isAlreadyInPopUp = this.popupService.isCurrentlyInPopup(configuration);\n if (isAlreadyInPopUp) {\n return of({\n errorMessage: 'There is already a popup open.'\n });\n }\n const {\n usePushedAuthorisationRequests\n } = configuration;\n if (authOptions?.customParams) {\n this.storagePersistenceService.write('storageCustomParamsAuthRequest', authOptions.customParams, configuration);\n }\n if (usePushedAuthorisationRequests) {\n return this.parLoginService.loginWithPopUpPar(configuration, allConfigs, authOptions, popupOptions);\n }\n return this.popUpLoginService.loginWithPopUpStandard(configuration, allConfigs, authOptions, popupOptions);\n }\n static {\n this.ɵfac = function LoginService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || LoginService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: LoginService,\n factory: LoginService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return LoginService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction removeNullAndUndefinedValues(obj) {\n const copy = {\n ...obj\n };\n for (const key in obj) {\n if (obj[key] === undefined || obj[key] === null) {\n delete copy[key];\n }\n }\n return copy;\n}\nlet LogoffRevocationService = /*#__PURE__*/(() => {\n class LogoffRevocationService {\n constructor() {\n this.loggerService = inject(LoggerService);\n this.dataService = inject(DataService);\n this.storagePersistenceService = inject(StoragePersistenceService);\n this.urlService = inject(UrlService);\n this.checkSessionService = inject(CheckSessionService);\n this.resetAuthDataService = inject(ResetAuthDataService);\n this.redirectService = inject(RedirectService);\n }\n // Logs out on the server and the local client.\n // If the server state has changed, check session, then only a local logout.\n logoff(config, allConfigs, logoutAuthOptions) {\n if (!config) {\n return throwError(() => new Error('Please provide a configuration before setting up the module'));\n }\n this.loggerService.logDebug(config, 'logoff, remove auth', logoutAuthOptions);\n const {\n urlHandler,\n customParams\n } = logoutAuthOptions || {};\n const endSessionUrl = this.urlService.getEndSessionUrl(config, customParams);\n if (!endSessionUrl) {\n this.loggerService.logDebug(config, 'No endsessionUrl present. Logoff was only locally. Returning.');\n return of(null);\n }\n if (this.checkSessionService.serverStateChanged(config)) {\n this.loggerService.logDebug(config, 'Server State changed. Logoff was only locally. Returning.');\n return of(null);\n }\n if (urlHandler) {\n this.loggerService.logDebug(config, `Custom UrlHandler found. Using this to handle logoff with url '${endSessionUrl}'`);\n urlHandler(endSessionUrl);\n this.resetAuthDataService.resetAuthorizationData(config, allConfigs);\n return of(null);\n }\n return this.logoffInternal(logoutAuthOptions, endSessionUrl, config, allConfigs);\n }\n logoffLocal(config, allConfigs) {\n this.resetAuthDataService.resetAuthorizationData(config, allConfigs);\n this.checkSessionService.stop();\n }\n logoffLocalMultiple(allConfigs) {\n allConfigs.forEach(configuration => this.logoffLocal(configuration, allConfigs));\n }\n // The refresh token and and the access token are revoked on the server. If the refresh token does not exist\n // only the access token is revoked. Then the logout run.\n logoffAndRevokeTokens(config, allConfigs, logoutAuthOptions) {\n if (!config) {\n return throwError(() => new Error('Please provide a configuration before setting up the module'));\n }\n const {\n revocationEndpoint\n } = this.storagePersistenceService.read('authWellKnownEndPoints', config) || {};\n if (!revocationEndpoint) {\n this.loggerService.logDebug(config, 'revocation endpoint not supported');\n return this.logoff(config, allConfigs, logoutAuthOptions);\n }\n if (this.storagePersistenceService.getRefreshToken(config)) {\n return this.revokeRefreshToken(config).pipe(switchMap(_ => this.revokeAccessToken(config)), catchError(error => {\n const errorMessage = `revoke token failed`;\n this.loggerService.logError(config, errorMessage, error);\n return throwError(() => new Error(errorMessage));\n }), concatMap(() => this.logoff(config, allConfigs, logoutAuthOptions)));\n } else {\n return this.revokeAccessToken(config).pipe(catchError(error => {\n const errorMessage = `revoke accessToken failed`;\n this.loggerService.logError(config, errorMessage, error);\n return throwError(() => new Error(errorMessage));\n }), concatMap(() => this.logoff(config, allConfigs, logoutAuthOptions)));\n }\n }\n // https://tools.ietf.org/html/rfc7009\n // revokes an access token on the STS. If no token is provided, then the token from\n // the storage is revoked. You can pass any token to revoke. This makes it possible to\n // manage your own tokens. The is a public API.\n revokeAccessToken(configuration, accessToken) {\n if (!configuration) {\n return throwError(() => new Error('Please provide a configuration before setting up the module'));\n }\n const accessTok = accessToken || this.storagePersistenceService.getAccessToken(configuration);\n const body = this.urlService.createRevocationEndpointBodyAccessToken(accessTok, configuration);\n return this.sendRevokeRequest(configuration, body);\n }\n // https://tools.ietf.org/html/rfc7009\n // revokes an refresh token on the STS. This is only required in the code flow with refresh tokens.\n // If no token is provided, then the token from the storage is revoked. You can pass any token to revoke.\n // This makes it possible to manage your own tokens.\n revokeRefreshToken(configuration, refreshToken) {\n if (!configuration) {\n return throwError(() => new Error('Please provide a configuration before setting up the module'));\n }\n const refreshTok = refreshToken || this.storagePersistenceService.getRefreshToken(configuration);\n const body = this.urlService.createRevocationEndpointBodyRefreshToken(refreshTok, configuration);\n return this.sendRevokeRequest(configuration, body);\n }\n logoffInternal(logoutAuthOptions, endSessionUrl, config, allConfigs) {\n const {\n logoffMethod,\n customParams\n } = logoutAuthOptions || {};\n if (!logoffMethod || logoffMethod === 'GET') {\n this.redirectService.redirectTo(endSessionUrl);\n this.resetAuthDataService.resetAuthorizationData(config, allConfigs);\n return of(null);\n }\n const {\n state,\n logout_hint,\n ui_locales\n } = customParams || {};\n const {\n clientId\n } = config;\n const idToken = this.storagePersistenceService.getIdToken(config);\n const postLogoutRedirectUrl = this.urlService.getPostLogoutRedirectUrl(config);\n const headers = this.getHeaders();\n const {\n url\n } = this.urlService.getEndSessionEndpoint(config);\n const body = {\n id_token_hint: idToken,\n client_id: clientId,\n post_logout_redirect_uri: postLogoutRedirectUrl,\n state,\n logout_hint,\n ui_locales\n };\n const bodyWithoutNullOrUndefined = removeNullAndUndefinedValues(body);\n this.resetAuthDataService.resetAuthorizationData(config, allConfigs);\n return this.dataService.post(url, bodyWithoutNullOrUndefined, config, headers);\n }\n sendRevokeRequest(configuration, body) {\n const url = this.urlService.getRevocationEndpointUrl(configuration);\n const headers = this.getHeaders();\n return this.dataService.post(url, body, configuration, headers).pipe(retry(2), switchMap(response => {\n this.loggerService.logDebug(configuration, 'revocation endpoint post response: ', response);\n return of(response);\n }), catchError(error => {\n const errorMessage = `Revocation request failed`;\n this.loggerService.logError(configuration, errorMessage, error);\n return throwError(() => new Error(errorMessage));\n }));\n }\n getHeaders() {\n let headers = new HttpHeaders();\n headers = headers.set('Content-Type', 'application/x-www-form-urlencoded');\n return headers;\n }\n static {\n this.ɵfac = function LogoffRevocationService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || LogoffRevocationService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: LogoffRevocationService,\n factory: LogoffRevocationService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return LogoffRevocationService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet OidcSecurityService = /*#__PURE__*/(() => {\n class OidcSecurityService {\n constructor() {\n this.checkSessionService = inject(CheckSessionService);\n this.checkAuthService = inject(CheckAuthService);\n this.userService = inject(UserService);\n this.tokenHelperService = inject(TokenHelperService);\n this.configurationService = inject(ConfigurationService);\n this.authStateService = inject(AuthStateService);\n this.flowsDataService = inject(FlowsDataService);\n this.callbackService = inject(CallbackService);\n this.logoffRevocationService = inject(LogoffRevocationService);\n this.loginService = inject(LoginService);\n this.refreshSessionService = inject(RefreshSessionService);\n this.urlService = inject(UrlService);\n this.authWellKnownService = inject(AuthWellKnownService);\n /**\n * Provides information about the user after they have logged in.\n *\n * @returns Returns an object containing either the user data directly (single config) or\n * the user data per config in case you are running with multiple configs\n */\n this.userData = toSignal(this.userData$, {\n requireSync: true\n });\n /**\n * Emits each time an authorization event occurs.\n *\n * @returns Returns an object containing if you are authenticated or not.\n * Single Config: true if config is authenticated, false if not.\n * Multiple Configs: true is all configs are authenticated, false if only one of them is not\n *\n * The `allConfigsAuthenticated` property contains the auth information _per config_.\n */\n this.authenticated = toSignal(this.isAuthenticated$, {\n requireSync: true\n });\n }\n /**\n * Provides information about the user after they have logged in.\n *\n * @returns Returns an object containing either the user data directly (single config) or\n * the user data per config in case you are running with multiple configs\n */\n get userData$() {\n return this.userService.userData$;\n }\n /**\n * Emits each time an authorization event occurs.\n *\n * @returns Returns an object containing if you are authenticated or not.\n * Single Config: true if config is authenticated, false if not.\n * Multiple Configs: true is all configs are authenticated, false if only one of them is not\n *\n * The `allConfigsAuthenticated` property contains the auth information _per config_.\n */\n get isAuthenticated$() {\n return this.authStateService.authenticated$;\n }\n /**\n * Emits each time the server sends a CheckSession event and the value changed. This property will always return\n * true.\n */\n get checkSessionChanged$() {\n return this.checkSessionService.checkSessionChanged$;\n }\n /**\n * Emits on a Security Token Service callback. The observable will never contain a value.\n */\n get stsCallback$() {\n return this.callbackService.stsCallback$;\n }\n preloadAuthWellKnownDocument(configId) {\n return this.configurationService.getOpenIDConfiguration(configId).pipe(concatMap(config => this.authWellKnownService.queryAndStoreAuthWellKnownEndPoints(config)));\n }\n /**\n * Returns the currently active OpenID configurations.\n *\n * @returns an array of OpenIdConfigurations.\n */\n getConfigurations() {\n return this.configurationService.getAllConfigurations();\n }\n /**\n * Returns a single active OpenIdConfiguration.\n *\n * @param configId The configId to identify the config. If not passed, the first one is being returned\n */\n getConfiguration(configId) {\n return this.configurationService.getOpenIDConfiguration(configId);\n }\n /**\n * Returns the userData for a configuration\n *\n * @param configId The configId to identify the config. If not passed, the first one is being used\n */\n getUserData(configId) {\n return this.configurationService.getOpenIDConfiguration(configId).pipe(map(config => this.userService.getUserDataFromStore(config)));\n }\n /**\n * Starts the complete setup flow for one configuration. Calling will start the entire authentication flow, and the returned observable\n * will denote whether the user was successfully authenticated including the user data, the access token, the configId and\n * an error message in case an error happened\n *\n * @param url The URL to perform the authorization on the behalf of.\n * @param configId The configId to perform the authorization on the behalf of. If not passed, the first configs will be taken\n *\n * @returns An object `LoginResponse` containing all information about the login\n */\n checkAuth(url, configId) {\n return this.configurationService.getOpenIDConfigurations(configId).pipe(concatMap(({\n allConfigs,\n currentConfig\n }) => this.checkAuthService.checkAuth(currentConfig, allConfigs, url)));\n }\n /**\n * Starts the complete setup flow for multiple configurations.\n * Calling will start the entire authentication flow, and the returned observable\n * will denote whether the user was successfully authenticated including the user data, the access token, the configId and\n * an error message in case an error happened in an array for each config which was provided\n *\n * @param url The URL to perform the authorization on the behalf of.\n *\n * @returns An array of `LoginResponse` objects containing all information about the logins\n */\n checkAuthMultiple(url) {\n return this.configurationService.getOpenIDConfigurations().pipe(concatMap(({\n allConfigs\n }) => this.checkAuthService.checkAuthMultiple(allConfigs, url)));\n }\n /**\n * Provides information about the current authenticated state\n *\n * @param configId The configId to check the information for. If not passed, the first configs will be taken\n *\n * @returns A boolean whether the config is authenticated or not.\n */\n isAuthenticated(configId) {\n return this.configurationService.getOpenIDConfiguration(configId).pipe(map(config => this.authStateService.isAuthenticated(config)));\n }\n /**\n * Checks the server for an authenticated session using the iframe silent renew if not locally authenticated.\n */\n checkAuthIncludingServer(configId) {\n return this.configurationService.getOpenIDConfigurations(configId).pipe(concatMap(({\n allConfigs,\n currentConfig\n }) => this.checkAuthService.checkAuthIncludingServer(currentConfig, allConfigs)));\n }\n /**\n * Returns the access token for the login scenario.\n *\n * @param configId The configId to check the information for. If not passed, the first configs will be taken\n *\n * @returns A string with the access token.\n */\n getAccessToken(configId) {\n return this.configurationService.getOpenIDConfiguration(configId).pipe(map(config => this.authStateService.getAccessToken(config)));\n }\n /**\n * Returns the ID token for the sign-in.\n *\n * @param configId The configId to check the information for. If not passed, the first configs will be taken\n *\n * @returns A string with the id token.\n */\n getIdToken(configId) {\n return this.configurationService.getOpenIDConfiguration(configId).pipe(map(config => this.authStateService.getIdToken(config)));\n }\n /**\n * Returns the refresh token, if present, for the sign-in.\n *\n * @param configId The configId to check the information for. If not passed, the first configs will be taken\n *\n * @returns A string with the refresh token.\n */\n getRefreshToken(configId) {\n return this.configurationService.getOpenIDConfiguration(configId).pipe(map(config => this.authStateService.getRefreshToken(config)));\n }\n /**\n * Returns the authentication result, if present, for the sign-in.\n *\n * @param configId The configId to check the information for. If not passed, the first configs will be taken\n *\n * @returns A object with the authentication result\n */\n getAuthenticationResult(configId) {\n return this.configurationService.getOpenIDConfiguration(configId).pipe(map(config => this.authStateService.getAuthenticationResult(config)));\n }\n /**\n * Returns the payload from the ID token.\n *\n * @param encode Set to true if the payload is base64 encoded\n * @param configId The configId to check the information for. If not passed, the first configs will be taken\n *\n * @returns The payload from the id token.\n */\n getPayloadFromIdToken(encode = false, configId) {\n return this.configurationService.getOpenIDConfiguration(configId).pipe(map(config => {\n const token = this.authStateService.getIdToken(config);\n return this.tokenHelperService.getPayloadFromToken(token, encode, config);\n }));\n }\n /**\n * Returns the payload from the access token.\n *\n * @param encode Set to true if the payload is base64 encoded\n * @param configId The configId to check the information for. If not passed, the first configs will be taken\n *\n * @returns The payload from the access token.\n */\n getPayloadFromAccessToken(encode = false, configId) {\n return this.configurationService.getOpenIDConfiguration(configId).pipe(map(config => {\n const token = this.authStateService.getAccessToken(config);\n return this.tokenHelperService.getPayloadFromToken(token, encode, config);\n }));\n }\n /**\n * Sets a custom state for the authorize request.\n *\n * @param state The state to set.\n * @param configId The configId to check the information for. If not passed, the first configs will be taken\n */\n setState(state, configId) {\n return this.configurationService.getOpenIDConfiguration(configId).pipe(map(config => this.flowsDataService.setAuthStateControl(state, config)));\n }\n /**\n * Gets the state value used for the authorize request.\n *\n * @param configId The configId to check the information for. If not passed, the first configs will be taken\n *\n * @returns The state value used for the authorize request.\n */\n getState(configId) {\n return this.configurationService.getOpenIDConfiguration(configId).pipe(map(config => this.flowsDataService.getAuthStateControl(config)));\n }\n /**\n * Redirects the user to the Security Token Service to begin the authentication process.\n *\n * @param configId The configId to perform the action in behalf of. If not passed, the first configs will be taken\n * @param authOptions The custom options for the the authentication request.\n */\n authorize(configId, authOptions) {\n this.configurationService.getOpenIDConfiguration(configId).subscribe(config => this.loginService.login(config, authOptions));\n }\n /**\n * Opens the Security Token Service in a new window to begin the authentication process.\n *\n * @param authOptions The custom options for the authentication request.\n * @param popupOptions The configuration for the popup window.\n * @param configId The configId to perform the action in behalf of. If not passed, the first configs will be taken\n *\n * @returns An `Observable` containing all information about the login\n */\n authorizeWithPopUp(authOptions, popupOptions, configId) {\n return this.configurationService.getOpenIDConfigurations(configId).pipe(concatMap(({\n allConfigs,\n currentConfig\n }) => this.loginService.loginWithPopUp(currentConfig, allConfigs, authOptions, popupOptions)));\n }\n /**\n * Manually refreshes the session.\n *\n * @param customParams Custom parameters to pass to the refresh request.\n * @param configId The configId to perform the action in behalf of. If not passed, the first configs will be taken\n *\n * @returns An `Observable` containing all information about the login\n */\n forceRefreshSession(customParams, configId) {\n return this.configurationService.getOpenIDConfigurations(configId).pipe(concatMap(({\n allConfigs,\n currentConfig\n }) => this.refreshSessionService.userForceRefreshSession(currentConfig, allConfigs, customParams)));\n }\n /**\n * Revokes the refresh token (if present) and the access token on the server and then performs the logoff operation.\n * The refresh token and and the access token are revoked on the server. If the refresh token does not exist\n * only the access token is revoked. Then the logout run.\n *\n * @param configId The configId to perform the action in behalf of. If not passed, the first configs will be taken\n * @param logoutAuthOptions The custom options for the request.\n *\n * @returns An observable when the action is finished\n */\n logoffAndRevokeTokens(configId, logoutAuthOptions) {\n return this.configurationService.getOpenIDConfigurations(configId).pipe(concatMap(({\n allConfigs,\n currentConfig\n }) => this.logoffRevocationService.logoffAndRevokeTokens(currentConfig, allConfigs, logoutAuthOptions)));\n }\n /**\n * Logs out on the server and the local client. If the server state has changed, confirmed via check session,\n * then only a local logout is performed.\n *\n * @param configId The configId to perform the action in behalf of. If not passed, the first configs will be taken\n * @param logoutAuthOptions with custom parameters and/or an custom url handler\n */\n logoff(configId, logoutAuthOptions) {\n return this.configurationService.getOpenIDConfigurations(configId).pipe(concatMap(({\n allConfigs,\n currentConfig\n }) => this.logoffRevocationService.logoff(currentConfig, allConfigs, logoutAuthOptions)));\n }\n /**\n * Logs the user out of the application without logging them out of the server.\n * Use this method if you have _one_ config enabled.\n *\n * @param configId The configId to perform the action in behalf of. If not passed, the first configs will be taken\n */\n logoffLocal(configId) {\n this.configurationService.getOpenIDConfigurations(configId).subscribe(({\n allConfigs,\n currentConfig\n }) => this.logoffRevocationService.logoffLocal(currentConfig, allConfigs));\n }\n /**\n * Logs the user out of the application for all configs without logging them out of the server.\n * Use this method if you have _multiple_ configs enabled.\n */\n logoffLocalMultiple() {\n this.configurationService.getOpenIDConfigurations().subscribe(({\n allConfigs\n }) => this.logoffRevocationService.logoffLocalMultiple(allConfigs));\n }\n /**\n * Revokes an access token on the Security Token Service. This is only required in the code flow with refresh tokens. If no token is\n * provided, then the token from the storage is revoked. You can pass any token to revoke.\n * https://tools.ietf.org/html/rfc7009\n *\n * @param accessToken The access token to revoke.\n * @param configId The configId to perform the action in behalf of. If not passed, the first configs will be taken\n *\n * @returns An observable when the action is finished\n */\n revokeAccessToken(accessToken, configId) {\n return this.configurationService.getOpenIDConfiguration(configId).pipe(concatMap(config => this.logoffRevocationService.revokeAccessToken(config, accessToken)));\n }\n /**\n * Revokes a refresh token on the Security Token Service. This is only required in the code flow with refresh tokens. If no token is\n * provided, then the token from the storage is revoked. You can pass any token to revoke.\n * https://tools.ietf.org/html/rfc7009\n *\n * @param refreshToken The access token to revoke.\n * @param configId The configId to perform the action in behalf of. If not passed, the first configs will be taken\n *\n * @returns An observable when the action is finished\n */\n revokeRefreshToken(refreshToken, configId) {\n return this.configurationService.getOpenIDConfiguration(configId).pipe(concatMap(config => this.logoffRevocationService.revokeRefreshToken(config, refreshToken)));\n }\n /**\n * Creates the end session URL which can be used to implement an alternate server logout.\n *\n * @param customParams\n * @param configId The configId to perform the action in behalf of. If not passed, the first configs will be taken\n *\n * @returns A string with the end session url or null\n */\n getEndSessionUrl(customParams, configId) {\n return this.configurationService.getOpenIDConfiguration(configId).pipe(map(config => this.urlService.getEndSessionUrl(config, customParams)));\n }\n /**\n * Creates the authorize URL based on your flow\n *\n * @param customParams\n * @param configId The configId to perform the action in behalf of. If not passed, the first configs will be taken\n *\n * @returns A string with the authorize URL or null\n */\n getAuthorizeUrl(customParams, configId) {\n return this.configurationService.getOpenIDConfiguration(configId).pipe(concatMap(config => this.urlService.getAuthorizeUrl(config, customParams ? {\n customParams\n } : undefined)));\n }\n static {\n this.ɵfac = function OidcSecurityService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || OidcSecurityService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: OidcSecurityService,\n factory: OidcSecurityService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return OidcSecurityService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet DefaultSessionStorageService = /*#__PURE__*/(() => {\n class DefaultSessionStorageService {\n read(key) {\n return sessionStorage.getItem(key);\n }\n write(key, value) {\n sessionStorage.setItem(key, value);\n }\n remove(key) {\n sessionStorage.removeItem(key);\n }\n clear() {\n sessionStorage.clear();\n }\n static {\n this.ɵfac = function DefaultSessionStorageService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || DefaultSessionStorageService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: DefaultSessionStorageService,\n factory: DefaultSessionStorageService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return DefaultSessionStorageService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction provideAuth(passedConfig, ...features) {\n const providers = _provideAuth(passedConfig);\n for (const feature of features) {\n providers.push(...feature.ɵproviders);\n }\n return makeEnvironmentProviders(providers);\n}\nfunction _provideAuth(passedConfig) {\n return [\n // Make the PASSED_CONFIG available through injection\n {\n provide: PASSED_CONFIG,\n useValue: passedConfig\n },\n // Create the loader: Either the one getting passed or a static one\n passedConfig?.loader || {\n provide: StsConfigLoader,\n useFactory: createStaticLoader,\n deps: [PASSED_CONFIG]\n }, {\n provide: AbstractSecurityStorage,\n useClass: DefaultSessionStorageService\n }, {\n provide: AbstractLoggerService,\n useClass: ConsoleLoggerService\n }];\n}\n/**\n * Configures an app initializer, which is called before the app starts, and\n * resolves any OAuth callback variables.\n * When used, it replaces the need to manually call\n * `OidcSecurityService.checkAuth(...)` or\n * `OidcSecurityService.checkAuthMultiple(...)`.\n *\n * @see https://angular.dev/api/core/APP_INITIALIZER\n */\nfunction withAppInitializerAuthCheck() {\n return {\n ɵproviders: [{\n provide: APP_INITIALIZER,\n useFactory: oidcSecurityService => () => oidcSecurityService.checkAuthMultiple(),\n multi: true,\n deps: [OidcSecurityService]\n }]\n };\n}\nlet AuthModule = /*#__PURE__*/(() => {\n class AuthModule {\n static forRoot(passedConfig) {\n return {\n ngModule: AuthModule,\n providers: [..._provideAuth(passedConfig)]\n };\n }\n static {\n this.ɵfac = function AuthModule_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || AuthModule)();\n };\n }\n static {\n this.ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: AuthModule\n });\n }\n static {\n this.ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({\n providers: [provideHttpClient(withInterceptorsFromDi())],\n imports: [CommonModule]\n });\n }\n }\n return AuthModule;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * @deprecated Please do not use the `AutoLoginAllRoutesGuard` anymore as it is not recommended anymore, deprecated and will be removed in future versions of this library. More information [Why is AutoLoginAllRoutesGuard not recommended?](https://github.com/damienbod/angular-auth-oidc-client/issues/1549)\n */\nlet AutoLoginAllRoutesGuard = /*#__PURE__*/(() => {\n class AutoLoginAllRoutesGuard {\n constructor() {\n this.autoLoginService = inject(AutoLoginService);\n this.checkAuthService = inject(CheckAuthService);\n this.loginService = inject(LoginService);\n this.configurationService = inject(ConfigurationService);\n this.router = inject(Router);\n }\n canLoad() {\n const url = this.router.getCurrentNavigation()?.extractedUrl.toString().substring(1) ?? '';\n return checkAuth$1(url, this.configurationService, this.checkAuthService, this.autoLoginService, this.loginService);\n }\n canActivate(route, state) {\n return checkAuth$1(state.url, this.configurationService, this.checkAuthService, this.autoLoginService, this.loginService);\n }\n canActivateChild(route, state) {\n return checkAuth$1(state.url, this.configurationService, this.checkAuthService, this.autoLoginService, this.loginService);\n }\n static {\n this.ɵfac = function AutoLoginAllRoutesGuard_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || AutoLoginAllRoutesGuard)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: AutoLoginAllRoutesGuard,\n factory: AutoLoginAllRoutesGuard.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return AutoLoginAllRoutesGuard;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction checkAuth$1(url, configurationService, checkAuthService, autoLoginService, loginService) {\n return configurationService.getOpenIDConfiguration().pipe(switchMap(config => {\n const allConfigs = configurationService.getAllConfigurations();\n return checkAuthService.checkAuth(config, allConfigs).pipe(take(1), map(({\n isAuthenticated\n }) => {\n if (isAuthenticated) {\n autoLoginService.checkSavedRedirectRouteAndNavigate(config);\n }\n if (!isAuthenticated) {\n autoLoginService.saveRedirectRoute(config, url);\n loginService.login(config);\n }\n return isAuthenticated;\n }));\n }));\n}\nlet AutoLoginPartialRoutesGuard = /*#__PURE__*/(() => {\n class AutoLoginPartialRoutesGuard {\n constructor() {\n this.autoLoginService = inject(AutoLoginService);\n this.authStateService = inject(AuthStateService);\n this.loginService = inject(LoginService);\n this.configurationService = inject(ConfigurationService);\n this.router = inject(Router);\n }\n canLoad() {\n const url = this.router.getCurrentNavigation()?.extractedUrl.toString().substring(1) ?? '';\n return checkAuth(url, this.configurationService, this.authStateService, this.autoLoginService, this.loginService);\n }\n canActivate(route, state) {\n const authOptions = route?.data ? {\n customParams: route.data\n } : undefined;\n return checkAuth(state.url, this.configurationService, this.authStateService, this.autoLoginService, this.loginService, authOptions);\n }\n canActivateChild(route, state) {\n const authOptions = route?.data ? {\n customParams: route.data\n } : undefined;\n return checkAuth(state.url, this.configurationService, this.authStateService, this.autoLoginService, this.loginService, authOptions);\n }\n static {\n this.ɵfac = function AutoLoginPartialRoutesGuard_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || AutoLoginPartialRoutesGuard)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: AutoLoginPartialRoutesGuard,\n factory: AutoLoginPartialRoutesGuard.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return AutoLoginPartialRoutesGuard;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction autoLoginPartialRoutesGuard(route, state, configId) {\n const configurationService = inject(ConfigurationService);\n const authStateService = inject(AuthStateService);\n const loginService = inject(LoginService);\n const autoLoginService = inject(AutoLoginService);\n const router = inject(Router);\n const authOptions = route?.data ? {\n customParams: route.data\n } : undefined;\n const url = router.getCurrentNavigation()?.extractedUrl.toString().substring(1) ?? '';\n return checkAuth(url, configurationService, authStateService, autoLoginService, loginService, authOptions, configId);\n}\nfunction autoLoginPartialRoutesGuardWithConfig(configId) {\n return (route, state) => autoLoginPartialRoutesGuard(route, state, configId);\n}\nfunction checkAuth(url, configurationService, authStateService, autoLoginService, loginService, authOptions, configId) {\n return configurationService.getOpenIDConfiguration(configId).pipe(map(configuration => {\n const isAuthenticated = authStateService.areAuthStorageTokensValid(configuration);\n if (isAuthenticated) {\n autoLoginService.checkSavedRedirectRouteAndNavigate(configuration);\n }\n if (!isAuthenticated) {\n autoLoginService.saveRedirectRoute(configuration, url);\n if (authOptions) {\n loginService.login(configuration, authOptions);\n } else {\n loginService.login(configuration);\n }\n }\n return isAuthenticated;\n }));\n}\nfunction flattenArray(array) {\n return array.reduce((flattened, elem) => flattened.concat(Array.isArray(elem) ? flattenArray(elem) : elem), []);\n}\nlet ClosestMatchingRouteService = /*#__PURE__*/(() => {\n class ClosestMatchingRouteService {\n getConfigIdForClosestMatchingRoute(route, configurations) {\n for (const config of configurations) {\n const {\n secureRoutes\n } = config;\n for (const configuredRoute of secureRoutes ?? []) {\n if (route.startsWith(configuredRoute)) {\n return {\n matchingRoute: configuredRoute,\n matchingConfig: config\n };\n }\n }\n }\n return {\n matchingRoute: null,\n matchingConfig: null\n };\n }\n static {\n this.ɵfac = function ClosestMatchingRouteService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || ClosestMatchingRouteService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ClosestMatchingRouteService,\n factory: ClosestMatchingRouteService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return ClosestMatchingRouteService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet AuthInterceptor = /*#__PURE__*/(() => {\n class AuthInterceptor {\n constructor() {\n this.authStateService = inject(AuthStateService);\n this.configurationService = inject(ConfigurationService);\n this.loggerService = inject(LoggerService);\n this.closestMatchingRouteService = inject(ClosestMatchingRouteService);\n }\n intercept(req, next) {\n return interceptRequest(req, next.handle, {\n configurationService: this.configurationService,\n authStateService: this.authStateService,\n closestMatchingRouteService: this.closestMatchingRouteService,\n loggerService: this.loggerService\n });\n }\n static {\n this.ɵfac = function AuthInterceptor_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || AuthInterceptor)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: AuthInterceptor,\n factory: AuthInterceptor.ɵfac\n });\n }\n }\n return AuthInterceptor;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction authInterceptor() {\n return (req, next) => {\n return interceptRequest(req, next, {\n configurationService: inject(ConfigurationService),\n authStateService: inject(AuthStateService),\n closestMatchingRouteService: inject(ClosestMatchingRouteService),\n loggerService: inject(LoggerService)\n });\n };\n}\nfunction interceptRequest(req, next, deps) {\n if (!deps.configurationService.hasAtLeastOneConfig()) {\n return next(req);\n }\n const allConfigurations = deps.configurationService.getAllConfigurations();\n const allRoutesConfigured = allConfigurations.map(x => x.secureRoutes || []);\n const allRoutesConfiguredFlat = flattenArray(allRoutesConfigured);\n if (allRoutesConfiguredFlat.length === 0) {\n deps.loggerService.logDebug(allConfigurations[0], `No routes to check configured`);\n return next(req);\n }\n const {\n matchingConfig,\n matchingRoute\n } = deps.closestMatchingRouteService.getConfigIdForClosestMatchingRoute(req.url, allConfigurations);\n if (!matchingConfig) {\n deps.loggerService.logDebug(allConfigurations[0], `Did not find any configured route for route ${req.url}`);\n return next(req);\n }\n deps.loggerService.logDebug(matchingConfig, `'${req.url}' matches configured route '${matchingRoute}'`);\n const token = deps.authStateService.getAccessToken(matchingConfig);\n if (!token) {\n deps.loggerService.logDebug(matchingConfig, `Wanted to add token to ${req.url} but found no token: '${token}'`);\n return next(req);\n }\n deps.loggerService.logDebug(matchingConfig, `'${req.url}' matches configured route '${matchingRoute}', adding token`);\n req = req.clone({\n headers: req.headers.set('Authorization', 'Bearer ' + token)\n });\n return next(req);\n}\nlet DefaultLocalStorageService = /*#__PURE__*/(() => {\n class DefaultLocalStorageService {\n read(key) {\n return localStorage.getItem(key);\n }\n write(key, value) {\n localStorage.setItem(key, value);\n }\n remove(key) {\n localStorage.removeItem(key);\n }\n clear() {\n localStorage.clear();\n }\n static {\n this.ɵfac = function DefaultLocalStorageService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || DefaultLocalStorageService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: DefaultLocalStorageService,\n factory: DefaultLocalStorageService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return DefaultLocalStorageService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// Public classes.\n\n/*\n * Public API Surface of angular-auth-oidc-client\n */\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { AbstractLoggerService, AbstractSecurityStorage, AuthInterceptor, AuthModule, AutoLoginAllRoutesGuard, AutoLoginPartialRoutesGuard, ConfigurationService, DefaultLocalStorageService, DefaultSessionStorageService, EventTypes, LogLevel, OidcSecurityService, OpenIdConfigLoader, PopUpService, PublicEventsService, StateValidationResult, StsConfigHttpLoader, StsConfigLoader, StsConfigStaticLoader, ValidationResult, _provideAuth, authInterceptor, autoLoginPartialRoutesGuard, autoLoginPartialRoutesGuardWithConfig, provideAuth, withAppInitializerAuthCheck };\n"],"mappings":"kYAqBA,IAAIA,GAAoB,CACtB,MAAO,mEACP,KAAM,CACR,EAoCA,IAAIC,GAAY,CACd,MAAO,SAAeC,EAAQC,EAAM,CAClC,OAAOC,GAAOF,EAAQG,GAAmBF,CAAI,CAC/C,EACA,UAAW,SAAmBG,EAAMH,EAAM,CACxC,OAAOI,GAAWD,EAAMD,GAAmBF,CAAI,CACjD,CACF,EAUA,SAASK,GAAOC,EAAQC,EAAUC,EAAM,CACtC,IAAIC,EAKJ,GAJID,IAAS,SACXA,EAAO,CAAC,GAGN,CAACD,EAAS,MAAO,CACnBA,EAAS,MAAQ,CAAC,EAClB,QAASG,EAAI,EAAGA,EAAIH,EAAS,MAAM,OAAQ,EAAEG,EAC3CH,EAAS,MAAMA,EAAS,MAAMG,CAAC,CAAC,EAAIA,CAExC,CAGA,GAAI,CAACF,EAAK,OAASF,EAAO,OAASC,EAAS,KAAO,EACjD,MAAM,IAAI,YAAY,iBAAiB,EAKzC,QADII,EAAML,EAAO,OACVA,EAAOK,EAAM,CAAC,IAAM,KAIzB,GAHA,EAAEA,EAGE,CAACH,EAAK,OAAS,GAAGF,EAAO,OAASK,GAAOJ,EAAS,KAAO,GAC3D,MAAM,IAAI,YAAY,iBAAiB,EAW3C,QANIK,EAAM,KAAMH,EAAYD,EAAK,MAAQ,KAAOC,EAAY,YAAYE,EAAMJ,EAAS,KAAO,EAAI,CAAC,EAG/FM,EAAO,EACPC,EAAS,EACTC,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oBD,EAAK,qBAAqB,qBAAqB,EACnEE,EAAsBD,EAAkB,IAAIE,GAAKA,EAAE,cAAgB,CAAC,CAAC,EAE3E,GADgCC,GAAaF,CAAmB,EACpC,SAAW,EACrC,OAAAF,EAAK,cAAc,SAASC,EAAkB,CAAC,EAAG,+BAA+B,EAC1ER,EAAKD,CAAG,EAEjB,GAAM,CACJ,eAAAa,EACA,cAAAC,CACF,EAAIN,EAAK,4BAA4B,mCAAmCR,EAAI,IAAKS,CAAiB,EAClG,GAAI,CAACI,EACH,OAAAL,EAAK,cAAc,SAASC,EAAkB,CAAC,EAAG,+CAA+CT,EAAI,GAAG,EAAE,EACnGC,EAAKD,CAAG,EAEjBQ,EAAK,cAAc,SAASK,EAAgB,IAAIb,EAAI,GAAG,+BAA+Bc,CAAa,GAAG,EACtG,IAAMC,EAAQP,EAAK,iBAAiB,eAAeK,CAAc,EACjE,OAAKE,GAILP,EAAK,cAAc,SAASK,EAAgB,IAAIb,EAAI,GAAG,+BAA+Bc,CAAa,iBAAiB,EACpHd,EAAMA,EAAI,MAAM,CACd,QAASA,EAAI,QAAQ,IAAI,gBAAiB,UAAYe,CAAK,CAC7D,CAAC,EACMd,EAAKD,CAAG,IAPbQ,EAAK,cAAc,SAASK,EAAgB,0BAA0Bb,EAAI,GAAG,yBAAyBe,CAAK,GAAG,EACvGd,EAAKD,CAAG,EAOnB","names":["base64UrlEncoding","base64url","string","opts","_parse","base64UrlEncoding","data","_stringify","_parse","string","encoding","opts","_opts$out","i","end","out","bits","buffer","written","_i","value","_stringify","data","_opts","_opts$pad","pad","mask","StsConfigLoader","StsConfigStaticLoader","passedConfigs","of","createStaticLoader","passedConfig","StsConfigStaticLoader","PASSED_CONFIG","InjectionToken","AbstractLoggerService","__ngFactoryType__","ɵɵdefineInjectable","ConsoleLoggerService","message","args","LogLevel","LoggerService","inject","configuration","configId","messageToLog","logLevelToCompare","logLevel","possibleObject","EventTypes","PublicEventsService","ReplaySubject","type","value","AbstractSecurityStorage","BrowserStorageService","key","storedConfig","StoragePersistenceService","config","refreshToken","JwkExtractor","keys","spec","throwOnEmpty","JwkExtractorInvalidArgumentError","foundKeys","k","JwkExtractorNoMatchingKeysError","JwkExtractorSeveralMatchingKeysError","buildErrorName","name","PARTS_OF_TOKEN","TokenHelperService","DOCUMENT","dataIdToken","date","token","encoded","header","payload","index","partOfToken","result","str","output","decoded","c","CryptoService","JwkWindowCryptoService","algorithm","verifyAlgorithm","cryptoKey","signature","signingInput","JwtWindowCryptoService","codeVerifier","map","challengeRaw","accessToken","tokenHash","substr","valueToHash","msgBuffer","from","hashBuffer","buffer","hashArray","byteArray","e","getVerifyAlg","alg","alg2kty","getImportAlg","TokenValidationService","offsetSeconds","decodedIdToken","tokenExpirationDate","tokenExpirationValue","nowWithOffset","tokenNotExpired","accessTokenExpiresAt","accessTokenExpirationValue","validated","maxOffsetAllowedInSeconds","disableIatOffsetValidation","dateTimeIatIdToken","diff","maxOffsetAllowedInMilliseconds","localNonce","ignoreNonceAfterRefresh","authWellKnownEndpointsIssuer","aud","clientId","state","localState","idToken","jwtkeys","of","headerData","kid","kty","use","rawSignature","mergeMap","base64url","tap","isValid","atHash","idTokenAlg","sha","hash","newHash","millis","minutes","seconds","DEFAULT_AUTHRESULT","AuthStateService","BehaviorSubject","distinctUntilChanged","allConfigs","currentConfig","authenticationResult","authResult","renewTimeBeforeTokenExpiresInSeconds","triggerRefreshWhenIdTokenExpired","disableIdTokenValidation","tokenToCheck","idTokenExpired","accessTokenExpiresIn","hasExpired","throwError","hasAccessToken","hasIdToken","accessTokenExpiryTime","allConfigsAuthenticated","isAuthenticated","x","STORAGE_KEY","AutoLoginService","Router","savedRouteForRedirect","url","FlowHelper","useRefreshToken","flowTypes","responseType","RandomService","requiredLength","length","arr","crypto","dec","characters","values","i","FlowsDataService","nonce","authStateControl","sessionState","silentRenewTimeoutInSeconds","storageObject","timeOutInMilliseconds","dateOfLaunchedProcessUtc","currentDateUtc","storageEntry","UriEncoder","CALLBACK_PARAMS_TO_CHECK","AUTH0_ENDPOINT","UrlService","urlToCheck","results","u","expected","actual","v","currentUrl","currentUrlInstance","redirectUrl","redirectUriUrlInstance","redirectUriWithoutQueryParams","currentUrlWithoutQueryParams","redirectUriQueryParamsArePresentInCurrentUrl","customParams","requestUri","authWellKnownEndPoints","authorizationEndpoint","urlParts","authorizationUrl","existingParams","params","authOptions","endSessionEndpoint","customParamsEndSessionRequest","mergedParams","__spreadValues","revocationEndpoint","code","customTokenParams","silentRenewUrl","customParamsRefresh","codeChallenge","scope","hdParam","customParamsAuthRequest","postLogoutRedirectUri","idTokenHint","customParamsEndSession","prompt","customRequestParams","HttpParams","authority","useCustomAuth0Domain","postLogoutRedirectUrl","HttpBaseService","HttpClient","body","NGSW_CUSTOM_PARAM","DataService","headers","headersParams","HttpHeaders","ngswBypass","isNetworkError","error","HttpErrorResponse","CodeFlowCallbackHandlerService","callbackContext","tokenEndpoint","bodyForCodeFlow","switchMap","response","__spreadProps","retryWhen","catchError","errorMessage","errors","refreshTokenRetryInSeconds","timer","ValidationResult","DEFAULT_USERRESULT","UserService","currentConfiguration","isRenewProcess","existingUserDataFromStorage","haveUserData","isCurrentFlowImplicitFlowWithAccessToken","isCurrentFlowCodeFlow","renewUserInfoAfterTokenRenew","userData","idTokenSub","data","userInfoEndpoint","retry","userDataSub","passedUserData","currentConfigId","alreadySavedUserData","ResetAuthDataService","SigninKeyDataService","jwksUri","errorResponse","errMsg","HttpResponse","err","status","statusText","JWT_KEYS","HistoryJwtKeysCallbackHandlerService","toWrite","existingIdToken","jwtKeys","storedJwtKeys","validationResult","historyCleanupOff","ImplicitFlowCallbackHandlerService","isRenewProcessData","resultData","item","parts","RefreshSessionCallbackHandlerService","stateData","RefreshTokenCallbackHandlerService","EqualityService","value1","value2","arr1","arr2","val","StateValidationResult","authResponseIsValid","StateValidationService","hasError","toReturn","isInRefreshTokenFlow","issValidationOff","maxIdTokenIatOffsetAllowedInSeconds","isSignatureIdTokenValid","authNonce","idTokenHeader","valid","newIdToken","disableRefreshIdTokenAuthTimeValidation","autoCleanStateAfterAuthentication","StateValidationCallbackHandlerService","stateValidationResult","UserCallbackHandlerService","autoUserInfo","FlowsService","concatMap","firstContext","IntervalService","NgZone","repeatAfterSeconds","millisecondsDelayBetweenTokenCheck","Observable","subscriber","intervalId","CodeFlowCallbackService","triggerAuthorizationResultEvent","postLoginRoute","unauthorizedRoute","ImplicitFlowCallbackService","CallbackService","Subject","currentCallbackUrl","callback$","PlatformProvider","PLATFORM_ID","isPlatformBrowser","WELL_KNOWN_SUFFIX","AuthWellKnownDataService","authWellknownEndpointUrl","authWellknownEndpoints","wellKnownEndpoints","mappedWellKnownEndpoints","wellKnownEndpoint","wellKnownSuffix","AuthWellKnownService","DEFAULT_CONFIG","POSITIVE_VALIDATION_RESULT","ensureAuthority","ensureClientId","createIdentifierToCheck","arrayHasDuplicates","array","ensureNoDuplicatedConfigsRule","passedConfigs","allIdentifiers","ensureRedirectRule","ensureSilentRenewUrlWhenNoRefreshTokenUsed","usesSilentRenew","usesRefreshToken","hasSilentRenewUrl","useOfflineScopeWithSilentRenew","hasRefreshToken","hasSilentRenew","hasOfflineScope","allRules","allMultipleConfigRules","ConfigValidationService","allRulesToUse","allValidationResults","rule","overallErrorCount","errorCount","allMessages","allErrorMessages","allWarnings","acc","ConfigurationService","StsConfigLoader","allPreparedConfigs","readyConfig","isDevMode","allHandleConfigs$","forkJoin","conf","usedConfig","configWithAuthWellKnown","alreadyExistingAuthWellKnownEndpoints","passedAuthWellKnownEndpoints","openIdConfigurationInternal","IFrameService","identifier","iFrameOnParent","iFrameOnSelf","sessionIframe","iFrameElement","element","IFRAME_FOR_SILENT_RENEW_IDENTIFIER","SilentRenewService","existingIframe","silentRenew","errorParam","RefreshSessionIframeService","RendererFactory2","observer","onLoadHandler","instanceId","initDestroyHandler","renewDestroyHandler","RefreshSessionRefreshTokenService","refreshTokenFailed","finalize","PeriodicallyTokenCheckService","configsWithSilentRenewEnabled","refreshTimeInSeconds","periodicallyCheck$","objectWithConfigIdsAndRefreshEvent","refreshEvent","objectWithConfigIds","_","refreshEvent$","prev","curr","customParamsRefreshTokenRequest","isSilentRenewRunning","isCodeFlowInProgress","userDataFromStore","accessTokenExpired","MAX_RETRY_ATTEMPTS","RefreshSessionService","extraCustomParams","timeOutTime","take","timeout","currentAttempt","TimeoutError","IFRAME_FOR_CHECK_SESSION_IDENTIFIER","CheckSessionService","windowAsDefaultView","startCheckSession","checkSessionIframe","contentWindow","pollServerSessionRecur","iframeOrigin","existingIFrame","startsWith","defaultView","PopUpService","popup","windowIdentifier","popupOptions","optionsToPass","listener","event","href","popupDefaultOptions","options","width","height","left","top","CurrentUrlService","parsedUrl","CheckAuthService","stateParamFromUrl","configs","allChecks$","loginResponse","loginResponseAfterRefreshSession","isCallback","configurations","stateFromUrl","activeConfig","allOtherConfigs","currentConfigResult","allOtherConfigResults","RedirectService","ResponseTypeValidationService","ParService","authWellKnownEndpoints","parEndpoint","ParLoginService","userClosed","receivedUrl","PopUpLoginService","authUrl","StandardLoginService","urlHandler","LoginService","usePushedAuthorisationRequests","removeNullAndUndefinedValues","obj","copy","LogoffRevocationService","logoutAuthOptions","endSessionUrl","accessTok","refreshTok","logoffMethod","logout_hint","ui_locales","bodyWithoutNullOrUndefined","OidcSecurityService","toSignal","encode","DefaultSessionStorageService","provideAuth","features","providers","_provideAuth","feature","makeEnvironmentProviders","withAppInitializerAuthCheck","APP_INITIALIZER","oidcSecurityService","AutoLoginPartialRoutesGuard","inject","AutoLoginService","AuthStateService","LoginService","ConfigurationService","Router","url","checkAuth","route","state","authOptions","__ngFactoryType__","ɵɵdefineInjectable","checkAuth","url","configurationService","authStateService","autoLoginService","loginService","authOptions","configId","map","configuration","isAuthenticated","flattenArray","array","flattened","elem","ClosestMatchingRouteService","route","configurations","config","secureRoutes","configuredRoute","__ngFactoryType__","ɵɵdefineInjectable","authInterceptor","req","next","interceptRequest","inject","ConfigurationService","AuthStateService","ClosestMatchingRouteService","LoggerService","deps","allConfigurations","allRoutesConfigured","x","flattenArray","matchingConfig","matchingRoute","token"],"x_google_ignoreList":[0,1]}