npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

modular-adal-angular

v2.1.0

Published

Module shim for Azure AD's azure-activedirectory-library-for-js

Downloads

63

Readme

modular-adal-angular

This is a shim to bring module support to AzureAD's azure-activedirectory-library-for-js.

New in version 2.0

adal-angular is now a peerDependency, to allow future versions to be used with this shim (1.x).

Installation and Usage

First, install the package from npm into your application.

npm install --save modular-adal-angular adal-angular

Then import it into your application's code.

// ES5 require
var adalAngular = require('modular-adal-angular');

// ES6 import
import adalAngular from 'modular-adal-angular';

Finally, add it as a module dependency on your Angular application.

angular.module('myApp', [adalAngular]);

If you're not using Angular

If you're only using the AuthenticationContext (adal.js) part of the library, and do not need the Angular module (adal-angular.js), use the official adal-angular package. You can simply import it and assign it to window.AuthenticationContext.

window.AuthenticationContext = require('adal-angular');

Old versions of this shim

In versions <=0.3.0, this shim was a fork of the AzureAD library, with module support added inline. While this worked, it was difficult to maintain, especially as Microsoft updated their library.

Starting with version 1.0.0 of this shim, it now imports the official adal-angular library from npm and exports the Angular module name. This should allow easier updating of the underlying library, without rebases.

It also removes the dependency on Webpack's expose-loader, directly assigning the imported libary to window.AuthenticationContext. This should allow it to work with other bundlers.

Why do I need this, and why is AuthenticationContext on my window object?

The adal-angular library, at the time of this shims conception, did not support modules or expose any exports. This made it difficult to use with bundlers, such as Webpack. In anger, the library was forked, and module support was added inline, allowing it to be used with require(...) and import statements.

The Angular module in the library expects AuthenticationContext to be available on the window object. Additionally, at times during the authentication process, iframes may be also be spawned. These attempt to call window.parent.AuthenticationContext. As such, this module exposes AuthenticationContext on the window object, to prevent things breaking.