Angular 5 Active Directory Authentication Library (ADAL) wrapper package. Can be used to authenticate Angular 5 applications to Azure Active Directory.
Based on https://github.com/benbaran/adal-angular4.
IMPORTANT!
Don't use Http and HttpModule, You definitely must use HttpClient and HttpClientModule instead of them.
The new interceptor is used only for request made by HttpClient.
When old Http used request will be untouched (no authorization header).
In app.module.ts
import{HttpClient,HttpClientModule}from'@angular/common/http';
...
imports: [...,HttpClientModule],// important! HttpClientModule replaces HttpModuleproviders: [Adal5Service,{provide: Adal5HTTPService,useFactory: Adal5HTTPService.factory,deps: [HttpClient,Adal5Service]}// // important! HttpClient replaces Http]import{Adal5HTTPService,Adal5Service}from'adal-angular5';
...
exportclassHttpService{constructor(privateadal5HttpService: Adal5HTTPService,privateadal5Service: Adal5Service){}publicget(url: string): Observable<any>{constoptions=this.prepareOptions();returnthis.adal5HttpService.get(url,options)}privateprepareOptions():any{letheaders=newHttpHeaders();headers=headers.set('Content-Type','application/json').set('Authorization',`Bearer ${this.adal5Service.userInfo.token}`);return{ headers };}