{"version":3,"file":"idocskz-identity-connector.mjs","sources":["../../../libraries/identity-connector/src/lib/services/navigate-helper.ts","../../../libraries/identity-connector/src/lib/services/identity-connector.service.ts","../../../libraries/identity-connector/src/lib/services/tokens.ts","../../../libraries/identity-connector/src/lib/services/identity-connector.actions.ts","../../../libraries/identity-connector/src/lib/services/identity-connector.client.ts","../../../libraries/identity-connector/src/lib/services/identity-connector.server.ts","../../../libraries/identity-connector/src/lib/components/identity-connector-server/identity-connector-server.component.ts","../../../libraries/identity-connector/src/lib/components/identity-connector-server/identity-connector-server.component.html","../../../libraries/identity-connector/src/lib/components/identity-connector-client/identity-connector-client.component.ts","../../../libraries/identity-connector/src/lib/components/identity-connector-client/identity-connector-client.component.html","../../../libraries/identity-connector/src/lib/identity-connector-server.routing.ts","../../../libraries/identity-connector/src/lib/identity-connector-client.routing.ts","../../../libraries/identity-connector/src/lib/identity-connector.module.ts","../../../libraries/identity-connector/src/idocskz-identity-connector.ts"],"sourcesContent":["import { HttpParams } from '@angular/common/http';\r\n\r\nexport function navigateTo(\r\n    link: { url: string; openInNewWindow?: boolean },\r\n    config?: {\r\n        queryParams?: HttpParams;\r\n        fragment?: string;\r\n    }\r\n) {\r\n    if (config?.queryParams) {\r\n        link.url += `?${config.queryParams.toString()}`;\r\n    }\r\n\r\n    if (config?.fragment) {\r\n        link.url += `#${config.fragment}`;\r\n    }\r\n\r\n    if (link.openInNewWindow) {\r\n        window.open(link.url, '_blank');\r\n    } else {\r\n        window.location.assign(link.url);\r\n    }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { BaseModel } from '@dev-stream/utils';\r\nimport { HttpParams } from '@angular/common/http';\r\nimport { IIdentityConnectorAction } from './identity-connector.actions';\r\nimport { navigateTo } from './navigate-helper';\r\n\r\n@Injectable()\r\nexport class IdentityConnectorService {\r\n    navigateTo(\r\n        link: { url: string; openInNewWindow?: boolean },\r\n        action: (IIdentityConnectorAction & BaseModel<any>) | HttpParams\r\n    ) {\r\n        navigateTo(link, {\r\n            queryParams:\r\n                action instanceof HttpParams\r\n                    ? action\r\n                    : new HttpParams()\r\n                          .set('action', this.createAction(action))\r\n                          .set('redirectTo', window.location.pathname)\r\n                          .set('host', `${window.location.protocol}//${window.location.host}`),\r\n        });\r\n    }\r\n\r\n    public createAction(action: IIdentityConnectorAction & BaseModel<any>) {\r\n        return JSON.stringify(action.ToPlainObject());\r\n    }\r\n}\r\n","import { InjectionToken } from '@angular/core';\r\nimport { IBaseModelConstructor } from '@dev-stream/utils';\r\nimport { IIdentityConnectorAccount } from './identity-connector.account';\r\nimport { IIdentityServerUrls } from './idenitty-connector.server-urls';\r\nimport { IAuthenticationHandler } from './identity-connector.authentication-handler';\r\nimport { IAuthenticationChecker } from './identity-connector.authentication-checker';\r\n\r\nexport const IDENTITY_SERVER_URLS = new InjectionToken<IIdentityServerUrls>('identity-connector.server-urls');\r\nexport const IDENTITY_URL = new InjectionToken('identity-connector.identity-url');\r\nexport const ACCOUNT_CLASS = new InjectionToken<IBaseModelConstructor<IIdentityConnectorAccount>>(\r\n    'identity-connector.account-constructor'\r\n);\r\nexport const AUTHENTICATION_HANDLER = new InjectionToken<IAuthenticationHandler<IIdentityConnectorAccount>>(\r\n    'identity-connector.authentication-handler'\r\n);\r\n\r\nexport const AUTHENTICATION_CHECKER = new InjectionToken<IAuthenticationChecker<IIdentityConnectorAccount>>(\r\n    'identity-connector.authentication-checker'\r\n);\r\n","import { BaseModel, IBaseModelConstructor, StrictBaseModelPart } from '@dev-stream/utils';\r\nimport { IIdentityConnectorAccount } from './identity-connector.account';\r\n\r\nexport type IdentityConnectorActionType =\r\n    | 'SWITCH_ACCOUNT'\r\n    | 'REGISTER'\r\n    | 'LOGOUT'\r\n    | 'NAVIGATE'\r\n    | 'AUTHENTICATE'\r\n    | 'AUTHENTICATED';\r\n\r\nexport interface IIdentityConnectorAction {\r\n    readonly type: IdentityConnectorActionType;\r\n}\r\n\r\nexport class NavigateIdentityConnectorAction\r\n    extends BaseModel<NavigateIdentityConnectorAction, 'type'>\r\n    implements IIdentityConnectorAction\r\n{\r\n    protected BASE_TYPE = NavigateIdentityConnectorAction;\r\n    readonly type: IdentityConnectorActionType = 'NAVIGATE';\r\n    accountId?: string;\r\n    baseAddress!: string;\r\n    url!: string;\r\n\r\n    GetDefaultValue(): StrictBaseModelPart<NavigateIdentityConnectorAction, 'type'> {\r\n        return { baseAddress: `https://${window.location.host}`, url: '/' };\r\n    }\r\n\r\n    static is(obj: any): obj is NavigateIdentityConnectorAction {\r\n        return obj instanceof NavigateIdentityConnectorAction || obj?.type == 'NAVIGATE';\r\n    }\r\n}\r\n\r\nexport class SwitchAccountIdentityConnectorAction\r\n    extends BaseModel<SwitchAccountIdentityConnectorAction, 'type'>\r\n    implements IIdentityConnectorAction\r\n{\r\n    protected BASE_TYPE = SwitchAccountIdentityConnectorAction;\r\n    readonly type: IdentityConnectorActionType = 'SWITCH_ACCOUNT';\r\n\r\n    GetDefaultValue(): StrictBaseModelPart<SwitchAccountIdentityConnectorAction, 'type'> {\r\n        return {};\r\n    }\r\n\r\n    static is(obj: any): obj is SwitchAccountIdentityConnectorAction {\r\n        return obj instanceof SwitchAccountIdentityConnectorAction || obj?.type == 'SWITCH_ACCOUNT';\r\n    }\r\n}\r\n\r\nexport class RegisterIdentityConnectorAction\r\n    extends BaseModel<RegisterIdentityConnectorAction, 'type'>\r\n    implements IIdentityConnectorAction\r\n{\r\n    protected BASE_TYPE = RegisterIdentityConnectorAction;\r\n    readonly type: IdentityConnectorActionType = 'REGISTER';\r\n\r\n    GetDefaultValue(): StrictBaseModelPart<RegisterIdentityConnectorAction, 'type'> {\r\n        return {};\r\n    }\r\n\r\n    static is(obj: any): obj is RegisterIdentityConnectorAction {\r\n        return obj instanceof RegisterIdentityConnectorAction || obj?.type == 'REGISTER';\r\n    }\r\n}\r\n\r\nexport class LogoutIdentityConnectorAction\r\n    extends BaseModel<LogoutIdentityConnectorAction, 'type'>\r\n    implements IIdentityConnectorAction\r\n{\r\n    protected BASE_TYPE = LogoutIdentityConnectorAction;\r\n    readonly type: IdentityConnectorActionType = 'LOGOUT';\r\n\r\n    accountId?: string;\r\n\r\n    GetDefaultValue(): StrictBaseModelPart<LogoutIdentityConnectorAction, 'type'> {\r\n        return {};\r\n    }\r\n\r\n    static is(obj: any): obj is LogoutIdentityConnectorAction {\r\n        return obj instanceof LogoutIdentityConnectorAction || obj?.type == 'LOGOUT';\r\n    }\r\n}\r\n\r\nexport class AuthenticateIdentityConnectorAction<TAuthenticateIdentityActionData = any>\r\n    extends BaseModel<AuthenticateIdentityConnectorAction, 'type'>\r\n    implements IIdentityConnectorAction\r\n{\r\n    protected BASE_TYPE = AuthenticateIdentityConnectorAction;\r\n    readonly type: IdentityConnectorActionType = 'AUTHENTICATE';\r\n\r\n    GetDefaultValue(): StrictBaseModelPart<AuthenticateIdentityConnectorAction, 'type'> {\r\n        return {\r\n            notRegistered: false,\r\n        };\r\n    }\r\n\r\n    public accountId?: string;\r\n    public notRegistered!: boolean;\r\n    public data?: TAuthenticateIdentityActionData;\r\n\r\n    static is<TData>(obj: any): obj is AuthenticateIdentityConnectorAction<TData> {\r\n        return obj instanceof AuthenticateIdentityConnectorAction || obj?.type == 'AUTHENTICATE';\r\n    }\r\n}\r\n\r\nexport class AuthenticatedIdentityConnectorAction<TAccount extends IIdentityConnectorAccount>\r\n    extends BaseModel<AuthenticatedIdentityConnectorAction<TAccount>, 'type'>\r\n    implements IIdentityConnectorAction\r\n{\r\n    protected BASE_TYPE = AuthenticatedIdentityConnectorAction;\r\n\r\n    GetDefaultValue(): StrictBaseModelPart<AuthenticatedIdentityConnectorAction<TAccount>, 'type'> {\r\n        return {\r\n            account: null,\r\n        };\r\n    }\r\n\r\n    type: IdentityConnectorActionType = 'AUTHENTICATED';\r\n    account!: TAccount | null;\r\n\r\n    static is<TAccount extends IIdentityConnectorAccount>(obj: any): obj is AuthenticatedIdentityConnectorAction<TAccount> {\r\n        return obj instanceof AuthenticatedIdentityConnectorAction || obj?.type == 'AUTHENTICATED';\r\n    }\r\n\r\n    static create<TAccount extends IIdentityConnectorAccount>(obj: any, ctr: IBaseModelConstructor<TAccount>) {\r\n        if (AuthenticatedIdentityConnectorAction.is<TAccount>(obj)) {\r\n            const action = new AuthenticatedIdentityConnectorAction<TAccount>(obj);\r\n            if (action.account) {\r\n                action.account = new ctr(action.account);\r\n            }\r\n            return action;\r\n        }\r\n        throw new Error('Invalid');\r\n    }\r\n}\r\n","import { Inject, Injectable } from '@angular/core';\r\nimport { IDENTITY_URL } from './tokens';\r\nimport {\r\n    AuthenticateIdentityConnectorAction,\r\n    LogoutIdentityConnectorAction,\r\n    NavigateIdentityConnectorAction,\r\n    RegisterIdentityConnectorAction,\r\n} from './identity-connector.actions';\r\n\r\nimport { IdentityConnectorService } from './identity-connector.service';\r\nimport { IIdentityConnectorAccount } from './identity-connector.account';\r\nimport { SynchronizationConfiguration, Synchronize } from '@dev-stream/utils';\r\n\r\nconst SELECTED_ACCOUNT_CONFIG = new SynchronizationConfiguration({\r\n    storage: sessionStorage,\r\n    prefix: 'IdentityConnector.client',\r\n});\r\n\r\n@Injectable()\r\nexport class IdentityConnectorClient<TAccount extends IIdentityConnectorAccount> {\r\n    protected connectorUrl: string;\r\n\r\n    @Synchronize(SELECTED_ACCOUNT_CONFIG)\r\n    public selectedAccount?: TAccount;\r\n\r\n    constructor(@Inject(IDENTITY_URL) identityUrl: string, protected service: IdentityConnectorService) {\r\n        this.connectorUrl = `${identityUrl}/identity-connector`;\r\n    }\r\n\r\n    navigateTo(action: { baseAddress: string; url: string; accountId?: string; openInNewWindow?: boolean }) {\r\n        this.service.navigateTo(\r\n            { url: this.connectorUrl, openInNewWindow: action.openInNewWindow },\r\n            new NavigateIdentityConnectorAction({\r\n                baseAddress: action.baseAddress,\r\n                url: action.url,\r\n                accountId: action.accountId,\r\n            })\r\n        );\r\n    }\r\n\r\n    authenticate<TData = any>(\r\n        action?: { accountId?: string; notRegistered?: boolean; data?: TData },\r\n        openInNewWindow = false\r\n    ) {\r\n        this.service.navigateTo(\r\n            { url: this.connectorUrl, openInNewWindow },\r\n            new AuthenticateIdentityConnectorAction<TData>(action ?? {})\r\n        );\r\n    }\r\n\r\n    register(openInNewWindow = false): void {\r\n        this.service.navigateTo({ url: this.connectorUrl, openInNewWindow }, new RegisterIdentityConnectorAction());\r\n    }\r\n\r\n    logout(): void {\r\n        const accountId = this.selectedAccount?.id;\r\n        SELECTED_ACCOUNT_CONFIG.clear();\r\n        this.service.navigateTo({ url: this.connectorUrl }, new LogoutIdentityConnectorAction({ accountId }));\r\n    }\r\n\r\n    async authenticated(account: TAccount | null) {\r\n        if (account) {\r\n            this.selectedAccount = account;\r\n        } else {\r\n            SELECTED_ACCOUNT_CONFIG.clear();\r\n        }\r\n    }\r\n}\r\n","import { IIdentityConnectorAccount } from './identity-connector.account';\r\nimport { Router } from '@angular/router';\r\nimport { Inject, Injectable } from '@angular/core';\r\nimport { IdentityConnectorService } from './identity-connector.service';\r\nimport { AuthenticatedIdentityConnectorAction } from './identity-connector.actions';\r\nimport { ACCOUNT_CLASS } from './tokens';\r\nimport { IBaseModelConstructor, SynchronizationConfiguration, Synchronize } from '@dev-stream/utils';\r\n\r\nconst ACCOUNT_SCONFIG = new SynchronizationConfiguration({\r\n    prefix: 'identity-connector.server.account',\r\n    storage: localStorage,\r\n});\r\n\r\n@Injectable()\r\nexport class IdentityConnectorServer<TAccount extends IIdentityConnectorAccount> {\r\n    constructor(\r\n        protected router: Router,\r\n        private service: IdentityConnectorService,\r\n        @Inject(ACCOUNT_CLASS) private accountClass: IBaseModelConstructor<TAccount>\r\n    ) {}\r\n\r\n    @Synchronize(ACCOUNT_SCONFIG)\r\n    selectedAccount?: TAccount;\r\n\r\n    // addAccount(account: TAccount) {\r\n    //     this.accounts.push(account);\r\n    // }\r\n\r\n    // removeAccount(id: string): void {\r\n    //     remove(this.accounts, (a) => a.id == id);\r\n    // }\r\n\r\n    // getAccount(id?: string) {\r\n    //     return this.accounts.find((a) => id == null || a.id == id) ?? this.selectedAccount;\r\n    // }\r\n\r\n    async authenticated(account: TAccount | undefined = this.selectedAccount) {\r\n        if (!account) {\r\n            throw new Error('Can not be called when account not selected');\r\n        }\r\n\r\n        const action = AuthenticatedIdentityConnectorAction.create<TAccount>(\r\n            { type: 'AUTHENTICATED', account: account },\r\n            this.accountClass\r\n        );\r\n\r\n        await this.router.navigate(['/identity-connector'], {\r\n            queryParamsHandling: 'merge',\r\n            queryParams: { action: this.service.createAction(action) },\r\n        });\r\n    }\r\n\r\n    logout() {\r\n        ACCOUNT_SCONFIG.clear();\r\n    }\r\n}\r\n","import { Component, Inject, OnDestroy, OnInit } from '@angular/core';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport {\n    AuthenticatedIdentityConnectorAction,\n    AuthenticateIdentityConnectorAction,\n    LogoutIdentityConnectorAction,\n    NavigateIdentityConnectorAction,\n    RegisterIdentityConnectorAction,\n    SwitchAccountIdentityConnectorAction,\n} from '../../services/identity-connector.actions';\nimport { IdentityConnectorServer } from '../../services/identity-connector.server';\nimport { IIdentityConnectorAccount } from '../../services/identity-connector.account';\nimport {\n    ACCOUNT_CLASS,\n    AUTHENTICATION_CHECKER,\n    IDENTITY_SERVER_URLS,\n} from '../../services/tokens';\nimport { IBaseModelConstructor } from '@dev-stream/utils';\nimport { IdentityConnectorService } from './../../services/identity-connector.service';\nimport { IIdentityServerUrls } from './../../services/idenitty-connector.server-urls';\nimport { takeUntil } from 'rxjs/operators';\nimport { HttpParams } from '@angular/common/http';\nimport { IAuthenticationChecker } from './../../services/identity-connector.authentication-checker';\nimport { Subject } from 'rxjs';\n\n@Component({\n    selector: 'lib-identity-connector-server',\n    templateUrl: './identity-connector-server.component.html',\n    styleUrls: ['./identity-connector-server.component.scss'],\n})\nexport class IdentityConnectorServerComponent<\n    TAccount extends IIdentityConnectorAccount\n> implements OnInit, OnDestroy\n{\n    constructor(\n        private router: Router,\n        private activatedRoute: ActivatedRoute,\n        private server: IdentityConnectorServer<TAccount>,\n        private identityConnector: IdentityConnectorService,\n        @Inject(IDENTITY_SERVER_URLS) private urls: IIdentityServerUrls,\n        @Inject(ACCOUNT_CLASS)\n        private accountClass: IBaseModelConstructor<TAccount>,\n        @Inject(AUTHENTICATION_CHECKER)\n        private authenticationChecker: IAuthenticationChecker<TAccount>\n    ) {}\n\n    private destroyedSubject = new Subject();\n    private destroyed = this.destroyedSubject.asObservable();\n\n    ngOnDestroy() {\n        this.destroyedSubject.next();\n        this.destroyedSubject.complete();\n    }\n\n    queryParamsSnapshot = this.activatedRoute.snapshot.queryParams;\n\n    async handle() {\n        const actionStr = this.activatedRoute.snapshot.queryParams.action;\n        if (actionStr == null) {\n            throw new Error('Empty action');\n        }\n\n        const actionRaw = JSON.parse(actionStr);\n\n        if (NavigateIdentityConnectorAction.is(actionRaw)) {\n            this.handleNavigationAction(\n                new NavigateIdentityConnectorAction(actionRaw)\n            );\n        }\n        if (SwitchAccountIdentityConnectorAction.is(actionRaw)) {\n            this.handleSwitchAccountAction(\n                new SwitchAccountIdentityConnectorAction(actionRaw)\n            );\n        }\n        if (RegisterIdentityConnectorAction.is(actionRaw)) {\n            await this.handleRegisterAction(\n                new RegisterIdentityConnectorAction(actionRaw)\n            );\n        }\n        if (LogoutIdentityConnectorAction.is(actionRaw)) {\n            await this.handleLogoutAction(\n                new LogoutIdentityConnectorAction(actionRaw)\n            );\n        }\n        if (AuthenticateIdentityConnectorAction.is(actionRaw)) {\n            await this.handleAuthenticateAction(\n                new AuthenticateIdentityConnectorAction(actionRaw)\n            );\n        }\n        if (AuthenticatedIdentityConnectorAction.is<TAccount>(actionRaw)) {\n            await this.handleAuthenticatedAction(actionRaw);\n        }\n    }\n\n    async ngOnInit() {\n        this.activatedRoute.queryParams\n            .pipe(takeUntil(this.destroyed))\n            .subscribe((qp) => {\n                this.queryParamsSnapshot = qp;\n                this.handle();\n            });\n    }\n\n    private handleNavigationAction(action: NavigateIdentityConnectorAction) {\n        this.identityConnector.navigateTo(\n            {\n                url: `${window.location.protocol}//${window.location.host}/identity-connector`,\n            },\n            new HttpParams({\n                fromObject: {\n                    ...this.activatedRoute.snapshot.queryParams,\n                    action: this.identityConnector.createAction(\n                        new AuthenticateIdentityConnectorAction({\n                            accountId: action.accountId,\n                        })\n                    ),\n                    host: action.baseAddress,\n                    redirectTo: action.url,\n                },\n            })\n        );\n    }\n\n    private handleSwitchAccountAction(\n        _: SwitchAccountIdentityConnectorAction\n    ) {}\n\n    private async handleRegisterAction(_: RegisterIdentityConnectorAction) {\n        await this.router.navigate([this.urls.registerUrl], {\n            queryParamsHandling: 'preserve',\n        });\n    }\n\n    private async handleLogoutAction(_: LogoutIdentityConnectorAction) {\n        this.server.logout();\n        await this.router.navigate([this.urls.loginUrl], {\n            queryParamsHandling: 'preserve',\n        });\n    }\n\n    private async handleAuthenticateAction(\n        action: AuthenticateIdentityConnectorAction\n    ) {\n        if (action.notRegistered) {\n            await this.router.navigate([this.urls.notRegisteredLoginUrl], {\n                queryParamsHandling: 'preserve',\n            });\n            return;\n        }\n        if (\n            action.accountId &&\n            this.server.selectedAccount?.id == action.accountId\n        ) {\n            const account = await this.authenticationChecker.check(\n                this.server.selectedAccount\n            );\n            if (account) {\n                this.server.selectedAccount = account;\n                await this.server.authenticated(account);\n            } else {\n                await this.router.navigate([this.urls.loginUrl], {\n                    queryParamsHandling: 'preserve',\n                });\n            }\n        } else if (action.accountId) {\n            await this.router.navigate([this.urls.loginUrl], {\n                queryParamsHandling: 'preserve',\n            });\n        } else if (this.server.selectedAccount?.id) {\n            await this.router.navigate([this.urls.accountListUrl], {\n                queryParamsHandling: 'preserve',\n            });\n        } else {\n            await this.router.navigate([this.urls.loginUrl], {\n                queryParamsHandling: 'preserve',\n            });\n        }\n    }\n\n    private async handleAuthenticatedAction(\n        _: AuthenticatedIdentityConnectorAction<TAccount>\n    ) {\n        if (this.queryParamsSnapshot.host) {\n            if (\n                window.location.origin.startsWith(this.queryParamsSnapshot.host)\n            ) {\n                const redirectTo = this.queryParamsSnapshot.redirectTo;\n                if (redirectTo) {\n                    await this.router.navigateByUrl(redirectTo);\n                } else {\n                    await this.router.navigateByUrl('/');\n                }\n            } else {\n                this.identityConnector.navigateTo(\n                    {\n                        url: `${this.queryParamsSnapshot.host}/identity-connector`,\n                    },\n                    new HttpParams({ fromObject: this.queryParamsSnapshot })\n                );\n            }\n        } else {\n            await this.router.navigate(['/']);\n        }\n    }\n}\n","<!--<h1 class=\"text-header-1\">Server</h1>-->\r\n<!--<pre>{{ queryParamsSnapshot | json }}</pre>-->\r\n<!--<button (click)=\"handle()\">Handle</button>-->\r\n","import { Component, Inject, OnDestroy, OnInit, Optional } from '@angular/core';\r\nimport { takeUntil } from 'rxjs/operators';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\nimport { IBaseModelConstructor } from '@dev-stream/utils';\r\nimport { IIdentityConnectorAccount } from './../../services/identity-connector.account';\r\nimport { IdentityConnectorClient } from './../../services/identity-connector.client';\r\nimport { IdentityConnectorService } from './../../services/identity-connector.service';\r\nimport { ACCOUNT_CLASS, AUTHENTICATION_HANDLER } from './../../services/tokens';\r\nimport { IAuthenticationHandler } from '../../services/identity-connector.authentication-handler';\r\nimport { AuthenticatedIdentityConnectorAction } from '../../services';\r\nimport { Subject } from 'rxjs';\r\n\r\n@Component({\r\n    selector: 'lib-identity-connector-client',\r\n    templateUrl: './identity-connector-client.component.html',\r\n    styleUrls: ['./identity-connector-client.component.scss'],\r\n})\r\nexport class IdentityConnectorClientComponent<TAccount extends IIdentityConnectorAccount> implements OnInit, OnDestroy {\r\n    constructor(\r\n        private router: Router,\r\n        private activatedRoute: ActivatedRoute,\r\n        private client: IdentityConnectorClient<TAccount>,\r\n        private identityConnector: IdentityConnectorService,\r\n        @Inject(ACCOUNT_CLASS) private accountClass: IBaseModelConstructor<TAccount>,\r\n        @Optional() @Inject(AUTHENTICATION_HANDLER) private authenticationHandler: IAuthenticationHandler<TAccount> | null\r\n    ) {}\r\n\r\n    private destroyedSubject = new Subject();\r\n    private destroyed = this.destroyedSubject.asObservable();\r\n\r\n    ngOnDestroy() {\r\n        this.destroyedSubject.next();\r\n        this.destroyedSubject.complete();\r\n    }\r\n\r\n    snapshot: any = null;\r\n\r\n    async ngOnInit() {\r\n        this.activatedRoute.queryParams.pipe(takeUntil(this.destroyed)).subscribe((qp) => {\r\n            this.snapshot = qp;\r\n            this.handle();\r\n        });\r\n    }\r\n\r\n    async handle() {\r\n        const actionStr = this.activatedRoute.snapshot.queryParams.action;\r\n        if (actionStr == null) {\r\n            throw new Error('Empty action');\r\n        }\r\n\r\n        const actionRaw = JSON.parse(actionStr);\r\n\r\n        if (AuthenticatedIdentityConnectorAction.is<TAccount>(actionRaw)) {\r\n            await this.handleAuthenticatedAction(actionRaw);\r\n        }\r\n    }\r\n\r\n    async handleAuthenticatedAction(action: AuthenticatedIdentityConnectorAction<TAccount>) {\r\n        await this.client.authenticated(action.account);\r\n        if (this.authenticationHandler) {\r\n            await this.authenticationHandler.handle(action);\r\n        }\r\n    }\r\n}\r\n","<!--<h1 class=\"text-header-1\">Client</h1>-->\r\n<!--<pre>{{ snapshot | json }}</pre>-->\r\n<!--<button (click)=\"handle()\">Handle</button>-->\r\n","import { NgModule } from '@angular/core';\r\nimport { RouterModule, Routes } from '@angular/router';\r\nimport { IdentityConnectorServerComponent } from './components/identity-connector-server/identity-connector-server.component';\r\n\r\nconst routes: Routes = [\r\n    {\r\n        path: 'identity-connector',\r\n        component: IdentityConnectorServerComponent,\r\n    },\r\n];\r\n\r\n@NgModule({\r\n    imports: [RouterModule.forChild(routes)],\r\n    exports: [RouterModule],\r\n})\r\nexport class IdentityConnectorServerRoutingModule {}\r\n","import { NgModule } from '@angular/core';\r\nimport { RouterModule, Routes } from '@angular/router';\r\nimport { IdentityConnectorClientComponent } from './components/identity-connector-client/identity-connector-client.component';\r\n\r\nconst routes: Routes = [\r\n    {\r\n        path: 'identity-connector',\r\n        component: IdentityConnectorClientComponent,\r\n    },\r\n];\r\n\r\n@NgModule({\r\n    imports: [RouterModule.forChild(routes)],\r\n    exports: [RouterModule],\r\n})\r\nexport class IdentityConnectorClientRoutingModule {}\r\n","import { ModuleWithProviders, Type } from '@angular/core';\r\nimport { NgModule } from '@angular/core';\r\nimport {\r\n    AUTHENTICATION_HANDLER,\r\n    AUTHENTICATION_CHECKER,\r\n    IDENTITY_SERVER_URLS,\r\n    IdentityConnectorService,\r\n    IIdentityServerUrls,\r\n} from './services';\r\nimport { IdentityConnectorServerComponent } from './components/identity-connector-server/identity-connector-server.component';\r\nimport { IdentityConnectorClientComponent } from './components/identity-connector-client/identity-connector-client.component';\r\nimport { IdentityConnectorServerRoutingModule } from './identity-connector-server.routing';\r\nimport { IdentityConnectorClientRoutingModule } from './identity-connector-client.routing';\r\nimport { IBaseModelConstructor } from '@dev-stream/utils';\r\nimport { IIdentityConnectorAccount } from './services/identity-connector.account';\r\nimport { ACCOUNT_CLASS, IDENTITY_URL } from './services/tokens';\r\nimport { IdentityConnectorClient } from './services/identity-connector.client';\r\nimport { IdentityConnectorServer } from './services/identity-connector.server';\r\nimport { CommonModule } from '@angular/common';\r\nimport { IAuthenticationHandler } from './services/identity-connector.authentication-handler';\r\nimport { IAuthenticationChecker } from './services/identity-connector.authentication-checker';\r\n\r\n@NgModule({\r\n    imports: [CommonModule],\r\n    exports: [],\r\n})\r\nexport class IdentityConnectorModule {\r\n    static client(config: {\r\n        identityUrl: string;\r\n        accountClass: () => IBaseModelConstructor<IIdentityConnectorAccount>;\r\n        authenticationHandler: Type<IAuthenticationHandler<IIdentityConnectorAccount>>;\r\n    }): ModuleWithProviders<IdentityConnectorClientModule> {\r\n        return {\r\n            ngModule: IdentityConnectorClientModule,\r\n            providers: [\r\n                { provide: ACCOUNT_CLASS, useValue: config.accountClass() },\r\n                { provide: IDENTITY_URL, useValue: config.identityUrl },\r\n                { provide: AUTHENTICATION_HANDLER, useClass: config.authenticationHandler },\r\n            ],\r\n        };\r\n    }\r\n\r\n    static server(config: {\r\n        accountClass: () => IBaseModelConstructor<IIdentityConnectorAccount>;\r\n        urls: IIdentityServerUrls;\r\n        authenticationChecker: Type<IAuthenticationChecker<IIdentityConnectorAccount>>;\r\n    }): ModuleWithProviders<IdentityConnectorServerModule> {\r\n        return {\r\n            ngModule: IdentityConnectorServerModule,\r\n            providers: [\r\n                { provide: ACCOUNT_CLASS, useValue: config.accountClass() },\r\n                { provide: IDENTITY_SERVER_URLS, useValue: config.urls },\r\n                { provide: AUTHENTICATION_CHECKER, useClass: config.authenticationChecker },\r\n            ],\r\n        };\r\n    }\r\n}\r\n\r\n@NgModule({\r\n    providers: [IdentityConnectorService, IdentityConnectorServer],\r\n    declarations: [IdentityConnectorServerComponent],\r\n    imports: [IdentityConnectorServerRoutingModule, IdentityConnectorModule, CommonModule],\r\n    exports: [IdentityConnectorModule],\r\n})\r\nexport class IdentityConnectorServerModule {}\r\n\r\n@NgModule({\r\n    providers: [IdentityConnectorService, IdentityConnectorClient],\r\n    declarations: [IdentityConnectorClientComponent],\r\n    imports: [IdentityConnectorClientRoutingModule, IdentityConnectorModule, CommonModule],\r\n    exports: [IdentityConnectorModule],\r\n})\r\nexport class IdentityConnectorClientModule {}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["routes"],"mappings":";;;;;;;;;;;SAEgB,UAAU,CACtB,IAAgD,EAChD,MAGC;IAED,IAAI,MAAM,EAAE,WAAW,EAAE;QACrB,IAAI,CAAC,GAAG,IAAI,IAAI,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC;KACnD;IAED,IAAI,MAAM,EAAE,QAAQ,EAAE;QAClB,IAAI,CAAC,GAAG,IAAI,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;KACrC;IAED,IAAI,IAAI,CAAC,eAAe,EAAE;QACtB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;KACnC;SAAM;QACH,MAAM,CAAC,QAAQ,CAAC,MAAM,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