UNPKG

oidc-client-rx

Version:

ReactiveX enhanced OIDC and OAuth2 protocol support for browser-based JavaScript applications

34 lines (33 loc) 929 B
import { forkJoin, of } from "rxjs"; import { map } from "rxjs/operators"; class OpenIdConfigLoader { } class StsConfigLoader { } class StsConfigStaticLoader { loadConfigs() { if (Array.isArray(this.passedConfigs)) return of(this.passedConfigs); return of([ this.passedConfigs ]); } constructor(passedConfigs){ this.passedConfigs = passedConfigs; } } class StsConfigHttpLoader { loadConfigs() { if (Array.isArray(this.configs$)) return forkJoin(this.configs$); const singleConfigOrArray = this.configs$; return singleConfigOrArray.pipe(map((value)=>{ if (Array.isArray(value)) return value; return [ value ]; })); } constructor(configs$){ this.configs$ = configs$; } } export { OpenIdConfigLoader, StsConfigHttpLoader, StsConfigLoader, StsConfigStaticLoader };