{ "version": 3, "sources": ["libs/core/src/lib/auth.interceptor.ts", "libs/core/src/lib/core.module.ts"], "sourcesContent": ["import { Injectable, Injector } from '@angular/core';\nimport { HttpEvent, HttpInterceptor, HttpHandler, HttpRequest } from '@angular/common/http';\nimport { Observable } from 'rxjs';\nimport { switchMap, first } from 'rxjs/operators';\nimport { SessionService } from './session.service';\n\n@Injectable()\nexport class AuthInterceptor implements HttpInterceptor {\n constructor(private inj: Injector) {}\n\n intercept(req: HttpRequest, next: HttpHandler): Observable> {\n if (!req.withCredentials) {\n return next.handle(req);\n }\n const auth = this.inj.get(SessionService); // Work around for cyclic dependency with app config service\n return auth.getSessionId().pipe(\n first(),\n switchMap((sessionId) => {\n if (sessionId) {\n return next.handle(req.clone({ headers: req.headers.set('Authorization', `Bearer ${sessionId}`) }));\n }\n return next.handle(req);\n }),\n );\n }\n}\n", "import { HTTP_INTERCEPTORS } from '@angular/common/http';\nimport { NgModule } from '@angular/core';\nimport { AuthInterceptor } from './auth.interceptor';\n\n@NgModule({\n imports: [],\n providers: [\n {\n provide: HTTP_INTERCEPTORS,\n useClass: AuthInterceptor,\n multi: true,\n },\n ],\n})\nexport class CoreModule {}\n"], "mappings": "wKAOA,IAAaA,GAAe,IAAA,CAAtB,IAAOA,EAAP,MAAOA,CAAe,CAC1BC,YAAoBC,EAAa,CAAb,KAAAA,IAAAA,CAAgB,CAEpCC,UAAUC,EAA2BC,EAAiB,CACpD,OAAKD,EAAIE,gBAGI,KAAKJ,IAAIK,IAAIC,CAAc,EAC5BC,aAAY,EAAGC,KACzBC,EAAK,EACLC,EAAWC,GACLA,EACKR,EAAKS,OAAOV,EAAIW,MAAM,CAAEC,QAASZ,EAAIY,QAAQC,IAAI,gBAAiB,UAAUJ,CAAS,EAAE,CAAC,CAAE,CAAC,EAE7FR,EAAKS,OAAOV,CAAG,CACvB,CAAC,EAVKC,EAAKS,OAAOV,CAAG,CAY1B,yCAjBWJ,GAAekB,EAAAC,CAAA,CAAA,CAAA,wBAAfnB,EAAeoB,QAAfpB,EAAeqB,SAAA,CAAA,EAAtB,IAAOrB,EAAPsB,SAAOtB,CAAe,GAAA,ECO5B,IAAauB,GAAU,IAAA,CAAjB,IAAOA,EAAP,MAAOA,CAAU,yCAAVA,EAAU,sBAAVA,CAAU,CAAA,2BARV,CACT,CACEC,QAASC,EACTC,SAAUC,EACVC,MAAO,GACR,CACF,CAAA,EAEG,IAAOL,EAAPM,SAAON,CAAU,GAAA", "names": ["AuthInterceptor", "constructor", "inj", "intercept", "req", "next", "withCredentials", "get", "SessionService", "getSessionId", "pipe", "first", "switchMap", "sessionId", "handle", "clone", "headers", "set", "\u0275\u0275inject", "Injector", "factory", "\u0275fac", "_AuthInterceptor", "CoreModule", "provide", "HTTP_INTERCEPTORS", "useClass", "AuthInterceptor", "multi", "_CoreModule"] }