New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

adal-angular8

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adal-angular8

ADAL wrapper for Angular 8+

latest
Source
npmnpm
Version
8.1.1
Version published
Weekly downloads
46
58.62%
Maintainers
1
Weekly downloads
 
Created
Source

adal-angular8

build status

Angular 8+ Active Directory Authentication Library (ADAL) wrapper package. Can be used to authenticate Angular 8+ applications to Azure Active Directory.

Based on https://github.com/benbaran/adal-angular4.

How to use it

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 HttpModule
    providers: [
        Adal8Service,
        { provide: Adal8HTTPService, useFactory: Adal8HTTPService.factory, deps: [HttpClient, Adal8Service] } //  // important! HttpClient replaces Http
  ]

Example

import { Adal8HTTPService, Adal8Service } from 'adal-angular8';
...
export class HttpService {
    constructor(
        private adal8HttpService: Adal8HTTPService,
        private adal8Service: Adal8Service) { }

public get(url: string): Observable<any> {
        const options = this.prepareOptions();
        return this.adal8HttpService.get(url, options)
    }
    
private prepareOptions():any{
 let headers = new HttpHeaders();
        headers = headers
            .set('Content-Type', 'application/json')
            .set('Authorization', `Bearer ${this.adal8Service.userInfo.token}`);
        return { headers };
}

Keywords

adal

FAQs

Package last updated on 02 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts