adal-typescript
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

npm version npm license

adal-typescript

A typescript library that allows you to authenticate against Azure Active Directory

aka adal.js typescript rewrite

Forked from adal-ts to fix bug.

Installation

npm install adal-typescript --save

adal-typescript does 4 things:

  1. login to Azure Active Directory
  2. get the logged in user
  3. logout to Azure Active Directory
  4. allow to retrieve the token from storage (ex: apply it to header)

Example Usage

login

let config = new AdalConfig('clientID', 'unittest.onmicrosoft.com', 'http://localhost');
let context = Authentication.getContext(config);
context.login();
...
//to process the redirect after login, place this inside your root component  (ex: NG2 AppComponent.ngOnInit)
Authentication.getAadRedirectProcessor().process();

get the currently logged in user

let config = new AdalConfig('clientID', 'unittest.onmicrosoft.com', 'http://localhost');
let context = Authentication.getContext(config);
let user = context.getUser();

logout

let config = new AdalConfig('clientID', 'unittest.onmicrosoft.com', 'http://localhost');
let context = Authentication.getContext(config);
context.logout();

getToken

let config = new AdalConfig('clientID', 'unittest.onmicrosoft.com', 'http://localhost');
let context = Authentication.getContext(config);
let token = context.getToken();

Building

Use webpack to compile and build. A /dist folder is generated.

npm run webpack

Unit testing

Use npm test cmd to compile and run all tests. Test runner is configured with autowatching and 'progress' as test reporter.

Readme

Keywords

Package Sidebar

Install

npm i adal-typescript

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • dawolf82