OIDC: Persist details in session storage, create store (#11302)

* utils to persist clientId and issuer after oidc authentication

* add dep oidc-client-ts

* persist issuer and clientId after successful oidc auth

* add OidcClientStore

* comments and tidy

* format
This commit is contained in:
Kerry 2023-07-21 09:30:19 +12:00 committed by GitHub
parent 882c85a028
commit 0b0d77cbcc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 446 additions and 2 deletions

View file

@ -31,6 +31,7 @@ import TypingStore from "../stores/TypingStore";
import { UserProfilesStore } from "../stores/UserProfilesStore";
import { WidgetLayoutStore } from "../stores/widgets/WidgetLayoutStore";
import { WidgetPermissionStore } from "../stores/widgets/WidgetPermissionStore";
import { OidcClientStore } from "../stores/oidc/OidcClientStore";
import WidgetStore from "../stores/WidgetStore";
import {
VoiceBroadcastPlaybacksStore,
@ -80,6 +81,7 @@ export class SdkContextClass {
protected _VoiceBroadcastPlaybacksStore?: VoiceBroadcastPlaybacksStore;
protected _AccountPasswordStore?: AccountPasswordStore;
protected _UserProfilesStore?: UserProfilesStore;
protected _OidcClientStore?: OidcClientStore;
/**
* Automatically construct stores which need to be created eagerly so they can register with
@ -203,6 +205,18 @@ export class SdkContextClass {
return this._UserProfilesStore;
}
public get oidcClientStore(): OidcClientStore {
if (!this.client) {
throw new Error("Unable to create OidcClientStore without a client");
}
if (!this._OidcClientStore) {
this._OidcClientStore = new OidcClientStore(this.client);
}
return this._OidcClientStore;
}
public onLoggedOut(): void {
this._UserProfilesStore = undefined;
}