Angular 5 和 ADAL - 工作 npm 包(包括 AOT)

Angular 5 and ADAL - working npm package (incl. AOT)

是否有适用于 ADAL 和 Angular 5(AOT 构建)的有效 npm 包?

我确实尝试了一些,但每个人都有一些问题。

adal-angular4plus

ERROR in node_modules/adal-angular4plus/adal4.service.d.ts(40,25): error TS2503: Cannot find namespace 'adal'. node_modules/adal-angular4plus/adal4.service.d.ts(48,22): error TS2503: Cannot find namespace 'adal'. Installing @types/adal-angular nor @types/adal helped.

ng2-adal

Did not work in AOT

ng2-adal-aot

acquireToken() after injecting the iframe it refreshes automatically the appModule. Hard to explain. But imagine the situation where you do a http request in ngOnInit of a component which is hosrted by appModule and there is a httpInterceptor which calls inside acquireToken() - the appModule gets refreshed so it is neverending cycle.

为了使 adal-angular4plus 正常工作,请在定义配置的 .ts 文件中添加 import { adal } from 'adal-angular';

你检查过ezcode-adal-angular5了吗?此组件:

  • 是从 angular 5 cli 项目创建的,并在内部利用 adal.js。
  • 支持 Angular 5 个项目。
  • 能够使用 Azure AD 对用户进行身份验证。
  • 能够保护与 adaljs 相同的路由组件,用于 angularjs。

您还可以查看 https://github.com/frankchen76/EZCode-Adal-Angular5-Sample

中的示例

您可能还想检查 adal-angular5,Angular 的 Active Directory 身份验证库 (ADAL) 包装程序包 5. 使用 HttpClient 和 HttpClientModule。

A working example 使用 adal-angular5.