Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 4x 12x 12x | import { HttpHandler, HttpRequest } from '@angular/common/http'; import { ModuleWithProviders, NgModule } from '@angular/core'; import { OAuthModule, OAuthStorage } from 'angular-oauth2-oidc'; import { noop } from 'rxjs'; import { PunchoutIdentityProviderModule } from '../extensions/punchout/identity-provider/punchout-identity-provider.module'; import { Auth0IdentityProvider } from './identity-provider/auth0.identity-provider'; import { CoBrowseIdentityProvider } from './identity-provider/co-browse.identity-provider'; import { ICMIdentityProvider } from './identity-provider/icm.identity-provider'; import { IDENTITY_PROVIDER_IMPLEMENTOR, IdentityProviderFactory } from './identity-provider/identity-provider.factory'; import { IdentityProviderCapabilities } from './identity-provider/identity-provider.interface'; /** * provider factory for storage * We need a factory, since localStorage is not available during AOT build time. */ export function storageFactory(): OAuthStorage { Iif (!SSR) { return localStorage; } } @NgModule({ imports: [OAuthModule.forRoot({ resourceServer: { sendAccessToken: false } }), PunchoutIdentityProviderModule], providers: [ { provide: OAuthStorage, useFactory: storageFactory }, { provide: IDENTITY_PROVIDER_IMPLEMENTOR, multi: true, useValue: { type: 'ICM', implementor: ICMIdentityProvider, }, }, { provide: IDENTITY_PROVIDER_IMPLEMENTOR, multi: true, useValue: { type: 'auth0', implementor: Auth0IdentityProvider, }, }, { provide: IDENTITY_PROVIDER_IMPLEMENTOR, multi: true, useValue: { type: 'cobrowse', implementor: CoBrowseIdentityProvider, }, }, ], }) export class IdentityProviderModule { static forTesting( capabilities: IdentityProviderCapabilities = { editEmail: true, editPassword: true, editProfile: true } ): ModuleWithProviders<IdentityProviderModule> { return { ngModule: IdentityProviderModule, providers: [ { provide: IdentityProviderFactory, useValue: { getInstance: () => ({ init: noop, intercept: (req: HttpRequest<unknown>, next: HttpHandler) => next.handle(req), triggerLogin: () => true, triggerLogout: () => true, triggerInvite: () => true, getCapabilities: () => capabilities, }), getType: () => 'ICM', }, }, ], }; } } |