MCPcopy
hub / github.com/authts/oidc-client-ts / readSignoutResponseState

Method readSignoutResponseState

src/OidcClient.ts:377–401  ·  view source on GitHub ↗
(url: string, removeState = false)

Source from the content-addressed store, hash-verified

375 }
376
377 public async readSignoutResponseState(url: string, removeState = false): Promise<{ state: State | undefined; response: SignoutResponse }> {
378 const logger = this._logger.create("readSignoutResponseState");
379
380 const response = new SignoutResponse(UrlUtils.readParams(url, this.settings.response_mode));
381 if (!response.state) {
382 logger.debug("No state in response");
383
384 if (response.error) {
385 logger.warn("Response was error:", response.error);
386 throw new ErrorResponse(response);
387 }
388
389 return { state: undefined, response };
390 }
391
392 const storedStateString = await this.settings.stateStore[removeState ? "remove" : "get"](response.state);
393 if (!storedStateString) {
394 logger.throw(new Error("No matching state found in storage"));
395 // eslint-disable-next-line @typescript-eslint/only-throw-error
396 throw null; // https://github.com/microsoft/TypeScript/issues/46972
397 }
398
399 const state = await State.fromStorageString(storedStateString);
400 return { state, response };
401 }
402
403 public async processSignoutResponse(url: string): Promise<SignoutResponse> {
404 const logger = this._logger.create("processSignoutResponse");

Callers 3

signoutCallbackMethod · 0.80
OidcClient.test.tsFile · 0.80

Calls 6

readParamsMethod · 0.80
throwMethod · 0.80
debugMethod · 0.65
warnMethod · 0.65
createMethod · 0.45
fromStorageStringMethod · 0.45

Tested by

no test coverage detected