()
| 48 | } |
| 49 | |
| 50 | public async getMetadata(): Promise<Partial<OidcMetadata>> { |
| 51 | const logger = this._logger.create("getMetadata"); |
| 52 | if (this._metadata) { |
| 53 | logger.debug("using cached values"); |
| 54 | return this._metadata; |
| 55 | } |
| 56 | |
| 57 | if (!this._metadataUrl) { |
| 58 | logger.throw(new Error("No authority or metadataUrl configured on settings")); |
| 59 | // eslint-disable-next-line @typescript-eslint/only-throw-error |
| 60 | throw null; // https://github.com/microsoft/TypeScript/issues/46972 |
| 61 | } |
| 62 | |
| 63 | logger.debug("getting metadata from", this._metadataUrl); |
| 64 | const metadata = await this._jsonService.getJson(this._metadataUrl, { credentials: this._fetchRequestCredentials, timeoutInSeconds: this._settings.requestTimeoutInSeconds }); |
| 65 | |
| 66 | logger.debug("merging remote JSON with seed metadata"); |
| 67 | this._metadata = Object.assign({}, metadata, this._settings.metadataSeed); |
| 68 | return this._metadata; |
| 69 | } |
| 70 | |
| 71 | public getIssuer(): Promise<string> { |
| 72 | return this._getMetadataProperty("issuer") as Promise<string>; |
no test coverage detected