@azure/msal-angular 4.0.13 → 4.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/IMsalService.d.ts +17 -0
  2. package/README.md +1 -1
  3. package/constants.d.ts +5 -0
  4. package/esm2020/IMsalService.mjs +6 -0
  5. package/esm2020/azure-msal-angular.mjs +5 -0
  6. package/esm2020/constants.mjs +10 -0
  7. package/esm2020/msal.broadcast.config.mjs +6 -0
  8. package/esm2020/msal.broadcast.service.mjs +66 -0
  9. package/esm2020/msal.guard.config.mjs +6 -0
  10. package/esm2020/msal.guard.mjs +218 -0
  11. package/esm2020/msal.interceptor.config.mjs +6 -0
  12. package/esm2020/msal.interceptor.mjs +270 -0
  13. package/esm2020/msal.module.mjs +46 -0
  14. package/esm2020/msal.navigation.client.mjs +53 -0
  15. package/esm2020/msal.redirect.component.mjs +31 -0
  16. package/esm2020/msal.service.mjs +88 -0
  17. package/esm2020/packageMetadata.mjs +4 -0
  18. package/esm2020/public-api.mjs +18 -0
  19. package/fesm2015/azure-msal-angular.mjs +762 -0
  20. package/fesm2015/azure-msal-angular.mjs.map +1 -0
  21. package/fesm2020/azure-msal-angular.mjs +758 -0
  22. package/fesm2020/azure-msal-angular.mjs.map +1 -0
  23. package/index.d.ts +5 -0
  24. package/msal.broadcast.config.d.ts +3 -0
  25. package/msal.broadcast.service.d.ts +19 -0
  26. package/msal.guard.config.d.ts +9 -0
  27. package/msal.guard.d.ts +43 -0
  28. package/msal.interceptor.config.d.ts +13 -0
  29. package/msal.interceptor.d.ts +70 -0
  30. package/msal.module.d.ts +13 -0
  31. package/msal.navigation.client.d.ts +19 -0
  32. package/msal.redirect.component.d.ts +15 -0
  33. package/msal.service.d.ts +33 -0
  34. package/package.json +26 -56
  35. package/packageMetadata.d.ts +2 -0
  36. package/{src/public-api.ts → public-api.d.ts} +17 -35
  37. package/.beachballrc +0 -3
  38. package/.editorconfig +0 -16
  39. package/.eslintrc.json +0 -3
  40. package/CHANGELOG.json +0 -2315
  41. package/CHANGELOG.md +0 -869
  42. package/FAQ.md +0 -182
  43. package/angular.json +0 -51
  44. package/docs/angular-universal.md +0 -64
  45. package/docs/configuration.md +0 -609
  46. package/docs/errors.md +0 -89
  47. package/docs/events.md +0 -262
  48. package/docs/initialization.md +0 -206
  49. package/docs/known-issues.md +0 -19
  50. package/docs/logging.md +0 -47
  51. package/docs/msal-guard.md +0 -208
  52. package/docs/msal-interceptor.md +0 -160
  53. package/docs/multi-tenant.md +0 -90
  54. package/docs/performance.md +0 -50
  55. package/docs/public-apis.md +0 -29
  56. package/docs/redirects.md +0 -257
  57. package/docs/security.md +0 -4
  58. package/docs/ssosilent.md +0 -84
  59. package/docs/v0-v1-upgrade-guide.md +0 -61
  60. package/docs/v1-v2-upgrade-guide.md +0 -70
  61. package/docs/v2-v3-upgrade-guide.md +0 -52
  62. package/docs/v3-v4-upgrade-guide.md +0 -36
  63. package/karma.conf.js +0 -44
  64. package/ng-package.json +0 -7
  65. package/src/IMsalService.ts +0 -34
  66. package/src/constants.ts +0 -20
  67. package/src/msal.broadcast.config.ts +0 -8
  68. package/src/msal.broadcast.service.spec.ts +0 -471
  69. package/src/msal.broadcast.service.ts +0 -84
  70. package/src/msal.guard.config.ts +0 -27
  71. package/src/msal.guard.spec.ts +0 -525
  72. package/src/msal.guard.ts +0 -290
  73. package/src/msal.interceptor.config.ts +0 -39
  74. package/src/msal.interceptor.spec.ts +0 -1168
  75. package/src/msal.interceptor.ts +0 -388
  76. package/src/msal.module.ts +0 -51
  77. package/src/msal.navigation.client.spec.ts +0 -96
  78. package/src/msal.navigation.client.ts +0 -59
  79. package/src/msal.redirect.component.spec.ts +0 -64
  80. package/src/msal.redirect.component.ts +0 -26
  81. package/src/msal.service.spec.ts +0 -468
  82. package/src/msal.service.ts +0 -104
  83. package/src/packageMetadata.ts +0 -3
  84. package/src/test.ts +0 -19
  85. package/tsconfig.json +0 -25
  86. package/tsconfig.lib.json +0 -27
  87. package/tsconfig.lib.prod.json +0 -10
  88. package/tsconfig.spec.json +0 -17
  89. package/typedoc.json +0 -10
package/docs/redirects.md DELETED
@@ -1,257 +0,0 @@
1
- # Using redirects in MSAL Angular
2
-
3
- When using redirects with MSAL, it is **mandatory** to handle redirects with either the `MsalRedirectComponent` or `handleRedirectObservable`. While we recommend `MsalRedirectComponent` as the best approach, both approaches are detailed below.
4
-
5
- Note that specific guidance has been added for using MSAL Angular with Angular standalone components below.
6
-
7
- 1. [`MsalRedirectComponent`](#msalredirectcomponent-a-dedicated-handleredirectobservable-component)
8
- 1. [Subscribing to `handleRedirectObservable` manually](#subscribing-to-handleredirectobservable-manually)
9
- 1. [Redirects with standalone components](#redirects-with-standalone-components)
10
-
11
- ## `MsalRedirectComponent`: A dedicated `handleRedirectObservable` component
12
-
13
- This is our recommended approach for handling redirects:
14
-
15
- - `@azure/msal-angular` provides a dedicated redirect component that can be imported into your application. We recommend importing the `MsalRedirectComponent` and bootstrapping this alongside `AppComponent` in your application on the `app.module.ts`, as this will handle all redirects without your components needing to subscribe to `handleRedirectObservable()` manually.
16
- - Pages that wish to perform functions following redirects (e.g. user account functions, UI changes, etc) should subscribe to the `inProgress$` observable, filtering for `InteractionStatus.None`. This will ensure that there are no interactions in progress when performing the functions. Note that the last / most recent `InteractionStatus` will also be available when subscribing to the `inProgress$` observable. Please see our documentation on [events](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/docs/events.md#the-inprogress-observable) for more information on checking for interactions.
17
- - If you do not wish to use the `MsalRedirectComponent`, you **must** handle redirects with `handleRedirectObservable()` yourself, as laid out in the approach below.
18
- - See our [Angular 15 sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/msal-angular-samples/angular-modules-sample/src/app/app.module.ts#L110) for an example of this approach.
19
-
20
- Note that although this is our recommendation for most Angular applications, this approach may not work with Angular standalone components. See the section on [redirects with standalone components below](#redirects-with-standalone-components) for further guidance.
21
-
22
- msal.redirect.component.ts
23
- ```js
24
- // This component is part of @azure/msal-angular and can be imported and bootstrapped
25
- import { Component, OnInit } from "@angular/core";
26
- import { MsalService } from "./msal.service.ts";
27
-
28
- @Component({
29
- selector: 'app-redirect', // Selector to be added to index.html
30
- template: ''
31
- })
32
- export class MsalRedirectComponent implements OnInit {
33
-
34
- constructor(private authService: MsalService) { }
35
-
36
- ngOnInit(): void {
37
- this.authService.handleRedirectObservable().subscribe();
38
- }
39
-
40
- }
41
-
42
- ```
43
-
44
- index.html
45
- ```js
46
- <body>
47
- <app-root></app-root>
48
- <app-redirect></app-redirect> <!-- Selector for additional bootstrapped component -->
49
- </body>
50
- ```
51
-
52
- app.module.ts
53
-
54
- ```js
55
- import { BrowserModule } from '@angular/platform-browser';
56
- import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
57
- import { NgModule } from '@angular/core';
58
-
59
- import { MatButtonModule } from '@angular/material/button';
60
- import { MatToolbarModule } from '@angular/material/toolbar';
61
- import { MatListModule } from '@angular/material/list';
62
-
63
- import { AppRoutingModule } from './app-routing.module';
64
- import { AppComponent } from './app.component';
65
- import { HomeComponent } from './home/home.component';
66
- import { ProfileComponent } from './profile/profile.component';
67
-
68
- import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
69
- import { IPublicClientApplication, PublicClientApplication, InteractionType, BrowserCacheLocation, LogLevel } from '@azure/msal-browser';
70
- import { MsalGuard, MsalInterceptor, MsalBroadcastService, MsalInterceptorConfiguration, MsalModule, MsalService, MSAL_GUARD_CONFIG, MSAL_INSTANCE, MSAL_INTERCEPTOR_CONFIG, MsalGuardConfiguration, MsalRedirectComponent } from '@azure/msal-angular'; // Redirect component imported from msal-angular
71
-
72
- export function loggerCallback(logLevel: LogLevel, message: string) {
73
- console.log(message);
74
- }
75
-
76
- export function MSALInstanceFactory(): IPublicClientApplication {
77
- return new PublicClientApplication({
78
- auth: {
79
- clientId: 'b5c2e510-4a17-4feb-b219-e55aa5b74144',
80
- redirectUri: 'http://localhost:4200',
81
- postLogoutRedirectUri: 'http://localhost:4200'
82
- },
83
- cache: {
84
- cacheLocation: BrowserCacheLocation.LocalStorage
85
- },
86
- system: {
87
- loggerOptions: {
88
- loggerCallback,
89
- logLevel: LogLevel.Info,
90
- piiLoggingEnabled: false
91
- }
92
- }
93
- });
94
- }
95
-
96
- export function MSALInterceptorConfigFactory(): MsalInterceptorConfiguration {
97
- const protectedResourceMap = new Map<string, Array<string>>();
98
- protectedResourceMap.set('https://graph.microsoft.com/v1.0/me', ['user.read']);
99
-
100
- return {
101
- interactionType: InteractionType.Redirect,
102
- protectedResourceMap
103
- };
104
- }
105
-
106
- export function MSALGuardConfigFactory(): MsalGuardConfiguration {
107
- return { interactionType: InteractionType.Redirect };
108
- }
109
-
110
- @NgModule({
111
- declarations: [
112
- AppComponent,
113
- HomeComponent,
114
- ProfileComponent
115
- ],
116
- imports: [
117
- BrowserModule,
118
- BrowserAnimationsModule,
119
- AppRoutingModule,
120
- MatButtonModule,
121
- MatToolbarModule,
122
- MatListModule,
123
- HttpClientModule,
124
- MsalModule
125
- ],
126
- providers: [
127
- {
128
- provide: HTTP_INTERCEPTORS,
129
- useClass: MsalInterceptor,
130
- multi: true
131
- },
132
- {
133
- provide: MSAL_INSTANCE,
134
- useFactory: MSALInstanceFactory
135
- },
136
- {
137
- provide: MSAL_GUARD_CONFIG,
138
- useFactory: MSALGuardConfigFactory
139
- },
140
- {
141
- provide: MSAL_INTERCEPTOR_CONFIG,
142
- useFactory: MSALInterceptorConfigFactory
143
- },
144
- MsalService,
145
- MsalGuard,
146
- MsalBroadcastService
147
- ],
148
- bootstrap: [AppComponent, MsalRedirectComponent] // Redirect component bootstrapped here
149
- })
150
- export class AppModule { }
151
-
152
- ```
153
-
154
- app.component.ts
155
- ```js
156
- import { Component, OnInit, Inject, OnDestroy } from '@angular/core';
157
- import { MsalBroadcastService, InteractionStatus } from '@azure/msal-angular';
158
- import { Subject } from 'rxjs';
159
- import { filter, takeUntil } from 'rxjs/operators';
160
-
161
- @Component({
162
- selector: 'app-root',
163
- templateUrl: './app.component.html',
164
- styleUrls: ['./app.component.css']
165
- })
166
-
167
- export class AppComponent implements OnInit, OnDestroy {
168
- private readonly _destroying$ = new Subject<void>();
169
-
170
- constructor(
171
- private msalBroadcastService: MsalBroadcastService
172
- ) {}
173
-
174
- ngOnInit(): void {
175
- this.msalBroadcastService.inProgress$
176
- .pipe(
177
- filter((status: InteractionStatus) => status === InteractionStatus.None),
178
- takeUntil(this._destroying$)
179
- )
180
- .subscribe(() => {
181
- // Do user account/UI functions here
182
- })
183
- }
184
- ```
185
-
186
- ## Subscribing to `handleRedirectObservable` manually
187
-
188
- This is not our recommended approach, but if you are unable to bootstrap the `MsalRedirectComponent`, you **must** handle redirects using the `handleRedirectObservable` as follows:
189
-
190
- - `handleRedirectObservable()` should be subscribed to on **every** page to which a redirect may occur. Pages protected by the MSAL Guard do not need to subscribe to `handleRedirectObservable()`, as redirects are processed in the Guard.
191
- - Accessing or performing any action related to user accounts should not be done until `handleRedirectObservable()` is complete, as it may not be fully populated until then. Additionally, if interactive APIs are called while `handleRedirectObservables()` is in progress, it will result in an `interaction_in_progress` error. See our document on [events](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/docs/events.md#the-inprogress-observable) for more information on checking for interactions, and our document on [errors](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/docs/errors.md) for details about the `interaction_in_progress` error.
192
- - See our [older MSAL Angular v2 Angular 9 sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/msal-lts/samples/msal-angular-v2-samples/angular9-v2-sample-app) for examples of this approach.
193
-
194
- Example of home.component.ts file:
195
- ```js
196
- import { Component, OnInit } from '@angular/core';
197
- import { MsalBroadcastService, MsalService } from '@azure/msal-angular';
198
- import { AuthenticationResult } from '@azure/msal-browser';
199
-
200
- @Component({
201
- selector: 'app-home',
202
- templateUrl: './home.component.html',
203
- styleUrls: ['./home.component.css']
204
- })
205
- export class HomeComponent implements OnInit {
206
-
207
- constructor(private authService: MsalService) { }
208
-
209
- ngOnInit(): void {
210
- this.authService.handleRedirectObservable().subscribe({
211
- next: (result: AuthenticationResult) => {
212
- // Perform actions related to user accounts here
213
- },
214
- error: (error) => console.log(error)
215
- });
216
- }
217
-
218
- }
219
- ```
220
-
221
- ## Redirects with standalone components
222
-
223
- As many Angular applications using standalone components are unable to bootstrap the `MsalRedirectComponent`, `handleRedirectObservable` must be subscribed to directly. Our recommendation is to subscribe to it in the `app.component.ts` file.
224
-
225
- - Depending on your application architecture, you may have to subscribe to `handleRedirectObservable()` in other areas as well.
226
- - Checking for interactions in progress still applies, please see our document on [events](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/docs/events.md#the-inprogress-observable) for more information on checking for interactions.
227
- - See our [Angular standalone sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/msal-angular-samples/angular-standalone-sample) for examples of this approach.
228
-
229
- Example of `app.component.ts` file
230
-
231
- ```js
232
- import { Component, OnInit, Inject } from '@angular/core';
233
- import { CommonModule } from '@angular/common';
234
- import { RouterModule} from '@angular/router';
235
- import { MsalService, MsalBroadcastService, MSAL_GUARD_CONFIG, MsalGuardConfiguration } from '@azure/msal-angular';
236
-
237
- @Component({
238
- selector: 'app-root',
239
- templateUrl: './app.component.html',
240
- styleUrls: ['./app.component.css'],
241
- standalone: true,
242
- imports: [CommonModule, RouterModule]
243
- })
244
- export class AppComponent implements OnInit {
245
-
246
- constructor(
247
- @Inject(MSAL_GUARD_CONFIG) private msalGuardConfig: MsalGuardConfiguration,
248
- private authService: MsalService,
249
- private msalBroadcastService: MsalBroadcastService
250
- ) {}
251
-
252
- ngOnInit(): void {
253
- this.authService.handleRedirectObservable().subscribe(); // Subscribing to handleRedirectObservable before any other functions both initializes the application and ensures redirects are handled
254
- }
255
- }
256
-
257
- ```
package/docs/security.md DELETED
@@ -1,4 +0,0 @@
1
- # Security
2
-
3
- Tokens are accessible from JavaScript since MSAL is using HTML5 storage. Default storage option is `sessionStorage`, which keeps the tokens per session. You should ask user to login again for important operations on your app.
4
- You should protect your site for XSS. Please check the article here: [Cross Site Scripting Prevention Cheat Sheet](<https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html>)
package/docs/ssosilent.md DELETED
@@ -1,84 +0,0 @@
1
- # Silent login with ssoSilent()
2
-
3
- If you already have a session that exists with the authentication server, you can use the `ssoSilent()` API to make a request for tokens without interaction.
4
-
5
- ## With User Hint
6
-
7
- If you already have the user's sign-in information, you can pass this into the API to improve performance and ensure that the authorization server will look for the correct account session. You can pass one of the following into the request object in order to successfully obtain a token silently.
8
-
9
- - `account` (which can be retrieved using on of the [account APIs](./accounts.md))
10
- - `sid` (which can be retrieved from the `idTokenClaims` of an `account` object)
11
- - `login_hint` (which can be retrieved from the account object `username` property or the `upn` claim in the ID token)
12
-
13
- Passing an account will look for sid in the token claims, then fall back to loginHint (if provided) or account username.
14
-
15
- ```js
16
- const silentRequest: SsoSilentRequest = {
17
- scopes: ["User.Read", "Mail.Read"],
18
- loginHint: "user@contoso.com"
19
- };
20
-
21
- this.authService.ssoSilent(silentRequest)
22
- .subscribe({
23
- next: (result) => console.log("Success!"), // Handle result
24
- error: (error) => console.log(error) // Handle error
25
- });
26
- ```
27
-
28
- ## Without User Hint
29
-
30
- If there is not enough information available about the user, you can attempt to use the `ssoSilent` API **without** passing an `account`, `sid` or `login_hint`.
31
-
32
- ```javascript
33
- const silentRequest = {
34
- scopes: ["User.Read", "Mail.Read"]
35
- };
36
- ```
37
-
38
- However, be aware that if your application has code paths for multiple users in a single browser session, or if the user has multiple accounts for that single browser session, then there is a higher likelihood of silent sign-in errors. You may see the following error show up in the event of multiple account sessions found by the authorization server:
39
-
40
- ```txt
41
- InteractionRequiredAuthError: interaction_required: AADSTS16000: Either multiple user identities are available for the current request or selected account is not supported for the scenario.
42
- ```
43
-
44
- This indicates that the server could not determine which account to sign into, and will require either one of the parameters above (`account`, `login_hint`, `sid`) or an interactive sign-in to choose the account.
45
-
46
- ## Handling Failures
47
-
48
- If ssoSilent() fails, we recommend handling this error by logging in interactively. Here is an example of ssoSilent() being used in an application's `app.component.ts`:
49
-
50
- ```js
51
- import { Component, OnInit } from '@angular/core';
52
- import { MsalService } from '@azure/msal-angular';
53
- import { SilentRequest, SsoSilentRequest } from '@azure/msal-browser';
54
-
55
- @Component({
56
- selector: 'app-root',
57
- templateUrl: './app.component.html',
58
- styleUrls: ['./app.component.css']
59
- })
60
- export class AppComponent implements OnInit {
61
-
62
- constructor(
63
- private authService: MsalService,
64
- ) {}
65
-
66
- ngOnInit(): void {
67
- const silentRequest: SsoSilentRequest = {
68
- scopes: ["User.Read"],
69
- loginHint: "user@contoso.com"
70
- }
71
-
72
- this.authService.ssoSilent(silentRequest)
73
- .subscribe({
74
- next: (result: AuthenticationResult) => {
75
- console.log("SsoSilent succeeded!"); // Handle result
76
- },
77
- error: (error) => {
78
- this.authService.loginRedirect(); // Handle error by logging in interactively
79
- }
80
- });
81
- }
82
- }
83
-
84
- ```
@@ -1,61 +0,0 @@
1
- # Upgrading from MSAL Angular v0 to v1
2
-
3
- MSAL Angular v1 brings our Angular wrapper up-to-date with the latest version of MSAL core, and with out-of-the-box support for modern versions of Angular (6+) and rxjs (6).
4
-
5
- This guide will demonstrate changes needed to migrate an existing application from `@azure/msal-angular@0.x` to `@azure/msal-angular@1.0.0`.
6
-
7
- A detailed list of changes can be found in the [CHANGELOG](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/CHANGELOG.md).
8
-
9
- Documentation for MSAL Angular v1 can be found [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/msal-lts/lib/msal-angular/docs/v1-docs/).
10
-
11
- ## Installation
12
-
13
- The first fundamental change to MSAL Angular is that the core `msal` package is no longer a regular dependency, and instead a [peer dependency](https://nodejs.org/en/blog/npm/peer-dependencies/). This means your application must also include `msal` as a normal dependency, instead of relying on MSAL Angular to include it. This allows for your application to either use the latest version of `msal` (recommended), or you can pick a custom version/range, while still using the latest version of MSAL Angular itself. Note, you should still provide a version that satisfies the semver range provided for the peer dependency, or else MSAL Angular may not function as intended.
14
-
15
- Steps:
16
- 1. Install `msal` and `@azure/msal-angular`: `npm install msal@beta @azure/msal-angular@beta`.
17
-
18
- ## Breaking changes in MSAL.js v1
19
-
20
- `msal@1` includes a number of breaking changes from `msal@0.2.x`. Many of these should be abstracted away from your application, but there are a few which will require code changes.
21
-
22
- ### MsalModule.forRoot now takes two arguments.
23
-
24
- Previously, MSAL Angular accepted one configuration object via `MsalModule.forRoot()`. To more closely align with `msal@1` and to provide more flexibility to MSAL Angular, this has been split into two objects, one for the core library and one for the wrapper.
25
-
26
- Steps:
27
- 1. The first argument is the configuration object, which is the [same `Configuration` object](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/msal-lts/lib/msal-core/src/Configuration.ts) you would pass to `msal`.
28
- 2. The second argument is a [`MsalAngularConfiguration object`](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/msal-angular-v1/lib/msal-angular/src/msal-angular.configuration.ts), containing the values for `consentScopes`, `popUp`, `extraQueryParameters`, and `protectedResourceMap`. `unprotectedResources` has been deprecated.
29
-
30
- See the [sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/msal-lts/samples/msal-angular-samples/angular6-sample-app/src/app/app.module.ts) for an example of how to pass these configuration objects.
31
-
32
- ### Mitigations for AOT mode errors
33
-
34
- The new `msal` configuration object takes a function for `system.logger` and `framework.protectedResourceMap`, which does not work properly when running in `aot` mode. There are now two workarounds available:
35
-
36
- 1. `protectedResourceMap` has been moved to `MsalAngularConfiguration` object, and can be passed as `[string, string[]][]` or as a `Map`. `framework.protectedResourceMap` still works, but has been deprecated. See the [updated samples](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/msal-lts/samples/msal-angular-samples/angular6-sample-app/src/app/app.module.ts) for usage.
37
- 2. `logger` can now be set dynamically by using `MsalService.setLogger()`. See the [updated samples](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/msal-lts/samples/msal-angular-samples/angular6-sample-app/src/app/app.component.ts) for usage.
38
-
39
- ### Other breaking changes
40
-
41
- * The `acquireToken` and `login` methods now take a single `AuthenticationParameters` object as parameters.
42
- * `getUser()` is now `getAccount()`.
43
- * Broadcast events now emit objects, instead of just strings.
44
- * Applications using `Redirect` methods must implement the `handleRedirectCallback` method (and have it run on every page load), which will capture the result of redirect operations. See the [Angular sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/msal-lts/samples/msal-angular-samples/angular6-sample-app/src/app/app.component.ts) for an example of how to implement.
45
-
46
- ## Angular 6+ and rxjs@6
47
-
48
- MSAL Angular now expects that your application is built with `@angular/core@>=6`, `@angular/common@>=6`, `rxjs@6`. And `rxjs-compat` is no longer required.
49
-
50
- Steps:
51
- 1. Install newer versions of Angular and rxjs: `npm install @angular/core @angular/common rxjs`
52
- 2. Uninstall `rxjs-compat` (assuming it is not needed for other libraries): `npm uninstall rxjs-compat`
53
-
54
- ## Samples
55
-
56
- We have put together basic sample applications for Angular 6, 7, 8, and 9. These samples demonstrate basic configuration and usage, and will be improved and added to incrementally. We also are planning to include more samples for more scenarios and use cases.
57
-
58
- * [Angular 6](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/msal-lts/samples/msal-angular-samples/angular6-sample-app)
59
- * [Angular 7](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/msal-lts/samples/msal-angular-samples/angular7-sample-app)
60
- * [Angular 8](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/msal-lts/samples/msal-angular-samples/angular8-sample-app)
61
- * [Angular 9](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/msal-lts/samples/msal-angular-samples/angular9-sample-app)
@@ -1,70 +0,0 @@
1
- # Upgrading from MSAL Angular v1 to v2
2
-
3
- MSAL Angular v2 brings our Angular wrapper up-to-date with the latest version of MSAL common, and with out-of-the-box support for modern versions of Angular (9 - 12) and rxjs (6).
4
-
5
- This guide will demonstrate changes needed to migrate an existing application from `@azure/msal-angular` v1 to v2.
6
-
7
- Documentation specifically for MSAL Angular v2 can be found [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/msal-lts/lib/msal-angular/docs/v2-docs/).
8
-
9
- ## Installation
10
-
11
- The first fundamental change to MSAL Angular v2 is that is no longer uses the core `msal` package, but wraps the `@azure/msal-browser` package as a [peer dependency](https://nodejs.org/en/blog/npm/peer-dependencies/).
12
-
13
- First, uninstall any previous versions of MSAL currently being used.
14
-
15
- To install `@azure/msal-browser` and `@azure/msal-angular`:
16
- ```
17
- npm install @azure/msal-browser @azure/msal-angular@latest
18
- ```
19
-
20
- ## Breaking changes in `@azure/msal-browser@2`
21
-
22
- `@azure/msal-browser@2` includes a number of breaking changes from `msal@1.x`. Many of these should be abstracted away from your application, but there are a few which will require code changes.
23
-
24
- ### MsalModule.forRoot now takes three arguments
25
-
26
- Previously, `@azure/msal-angular` accepted two configuration objects via `MsalModule.forRoot()`, one for the core library, and one for `@azure/msal-angular`. This has been changed to take in an instance of MSAL, as well as two Angular-specific configuration objects.
27
-
28
- 1. The first argument is the MSAL instance. This can be provided as a factory which instantiates MSAL, or by passing the instance of MSAL in with configurations.
29
- 2. The second argument is a [`MsalGuardConfiguration`](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/msal-lts/lib/msal-angular/src/msal.guard.config.ts) object, which specifies the `interactionType` as well as an optional `authRequest` and an optional `loginFailedRoute`.
30
- 3. The third argument is a [`MsalInterceptorConfiguration`](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/msal-lts/lib/msal-angular/src/msal.interceptor.config.ts) object, which contain the values for `interactionType`, a `protectedResourceMap`, and an optional `authRequest`. `unprotectedResourceMap` has been deprecated.
31
-
32
- See our [configuration doc](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/msal-lts/lib/msal-angular/docs/v2-docs/configuration.md) and specific docs for [MsalInterceptor](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/msal-lts/lib/msal-angular/docs/v2-docs/msal-interceptor.md) and [MsalGuard](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/msal-lts/lib/msal-angular/docs/v2-docs/msal-guard.md) for more information. You can also see our [updated samples](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/msal-lts/samples/msal-angular-v2-samples/angular10-sample-app/src/app/app.module.ts) for examples of how to pass these configuration objects.
33
-
34
- ### Logger
35
-
36
- * The `logger` is now set through configurations for the MSAL instance, under `system.loggerOptions`, which include a `loggerCallback`, `piiLoggingEnabled` and `logLevel`, instead of an instance of a `logger`. The `logger` can also be set dynamically by using `MsalService.setLogger()`. See the [`logger documentation`](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/msal-lts/lib/msal-angular/docs/v2-docs/logging.md) for more information and [sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/msal-lts/samples/msal-angular-v2-samples/angular10-sample-app/src/app/app.module.ts) for usage.
37
-
38
- ### API changes
39
-
40
- * The `acquireToken` and `login` methods now take different request objects as parameters. See the [msal.service.ts](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/msal-lts/lib/msal-angular/src/msal.service.ts) for details.
41
- * Broadcast events now emit an `EventMessage` object, instead of just strings. See the [Angular sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/msal-lts/samples/msal-angular-v2-samples/angular10-sample-app/src/app/app.component.ts) for an example of how to implement.
42
- * Applications using `Redirect` methods should import the `MsalRedirectComponent` and bootstrap along with `AppComponent` in their app.component.ts, which will handle all redirects. Applications are unable to do this should implement the `handleRedirectObservable` method (and have it run on every page load), which will capture the result of redirect operations. See the [redirect documentation](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/msal-lts/lib/msal-angular/docs/v2-docs/redirects.md) for more details.
43
-
44
- ### MSAL Interceptor
45
- * Please our [MsalInterceptor doc](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/msal-lts/lib/msal-angular/docs/v2-docs/msal-interceptor.md) for more details on configuring the current `MsalInterceptor`, and differences between v1 and v2.
46
-
47
- ### MSAL Guard
48
-
49
- * Please our [MsalGuard doc](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/msal-lts/lib/msal-angular/docs/v2-docs/msal-guard.md) for more details on configuring the current `MsalGuard`, and differences between v1 and v2.
50
-
51
- ### Accounts
52
-
53
- * We recommend subscribing to the `inProgress$` observable and filtering for `InteractionStatus.None` before retrieving account information. This ensures that all interactions have completed before getting account information. See [our sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/msal-lts/samples/msal-angular-v2-samples/angular10-sample-app/src/app/app.component.ts#L27) for an example of this use.
54
- * When getting accounts, we recommend using `getAccountByHomeId()` and `getAccountByLocalId()`, available on the MSAL instance. `getAccount()` is now `getAccountByUsername()`, but should be a secondary choice, as it may be less reliable and is for convenience only.
55
- * `getAllAccounts()` is also available on the MSAL instance. Please see [docs](https://azuread.github.io/microsoft-authentication-library-for-js/ref/classes/_azure_msal_browser.publicclientapplication.html) for `@azure/msal-browser` for more details on account methods.
56
- * Additionally, you can now get and set active acccounts using `getActiveAccount()` and `setActiveAccount()`. See our [FAQ](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/msal-lts/lib/msal-angular/docs/v2-docs/FAQ.md#how-do-i-get-and-set-active-accounts) for more information.
57
-
58
- ## Angular 9+ and rxjs@6
59
-
60
- MSAL Angular now expects that your application is built with `@angular/core@>=9`, `@angular/common@>=9`, `rxjs@6`. As with MSAL Angular v1, `rxjs-compat` is not required.
61
-
62
- Steps:
63
- 1. Install newer versions of Angular and rxjs: `npm install @angular/core @angular/common rxjs`
64
- 2. Uninstall `rxjs-compat` (assuming it is not needed for other libraries): `npm uninstall rxjs-compat`
65
-
66
- ## Samples
67
-
68
- We have put together basic sample applications for Angular 9, 10, 11, and 12. These samples demonstrate basic configuration and usage, and will be improved and added to incrementally.
69
-
70
- See [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/msal-lts/samples/msal-angular-v2-samples/README.md) for a list of the MSAL Angular v2 samples and the features demonstrated.
@@ -1,52 +0,0 @@
1
- # Upgrading from MSAL Angular v2 to v3
2
-
3
- MSAL Angular v3 brings our Angular wrapper up-to-date with the latest version of MSAL Browser, and with out-of-the-box support for Angular 15, 16, 17, 18 and rxjs 7.
4
-
5
- This guide will demonstrate changes needed to migrate an existing application from `@azure/msal-angular` v2 to v3.
6
-
7
- If you are migrating from `@azure/msal-angular` v1, please refer to the [v1-v2 migration guide](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular/docs/v1-v2-upgrade-guide.md) first to migrate to MSAL v2.
8
-
9
- Please also see the [MSAL Browser Migration Doc](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-browser/docs/v2-migration.md) for browser support and other key changes.
10
-
11
- ## Breaking changes in `@azure/msal-angular@3`
12
-
13
- ### Initialization
14
-
15
- #### Applications using redirects
16
-
17
- MSAL v3.x now requires initializing the application object. Initialization has been built into the `MsalRedirectComponent` and `handleRedirectObservable` API, and applications that have implemented redirect strategies do not have to make changes. Additional changes may need to be made if your application is using standalone components.
18
-
19
- See the [guide to redirects](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular/docs/redirects.md) for details on handling redirects in your application.
20
-
21
- #### Applications using popups
22
-
23
- Due to initialization being built into `MsalRedirectComponent` and `handleRedirectObservable`, applications that only use popups will also have to either bootstrap the `MsalRedirectComponent` or call `handleRedirectObservable` manually once to initialize the application object.
24
-
25
- See the [guide to redirects](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular/docs/redirects.md) for set up details.
26
-
27
- ## Angular 15, 16, 17, 18 and rxjs@7
28
-
29
- MSAL Angular now expects that your application is built with:
30
-
31
- - `@angular/core@15` or `@angular/core@16` or `@angular/core@17` or `@angular/core@18`
32
- - `@angular/common@15` or `@angular/common@16` or `@angular/common@17` or `@angular/common@18`
33
- - `rxjs@7`
34
-
35
- Due to this change, MSAL Angular v3 is not backwards compatible with earlier versions of Angular and RxJS and you may need to update your application. Please follow the [Angular Update Guide](https://update.angular.io/) to update your application to Angular 15, 16, 17 or 18.
36
-
37
- As with MSAL Angular v2, `rxjs-compat` is not required.
38
-
39
- ## Samples
40
-
41
- The following developer samples are now available:
42
-
43
- - [Angular 15 sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/v3-lts/samples/msal-angular-v3-samples/angular15-sample-app)
44
- - [Angular 16 sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/v3-lts/samples/msal-angular-v3-samples/angular16-sample-app)
45
- - [Angular 16 sample using B2C](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/v3-lts/samples/msal-angular-v3-samples/angular-b2c-sample-app)
46
- - [Angular 16 sample using Angular standalone components](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/v3-lts/samples/msal-angular-v3-samples/angular-standalone-sample)
47
- - [Angular 17 Standalone Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/v3-lts/samples/msal-angular-v3-samples/angular17-standalone-sample)
48
- - [Angular 18 Standalone Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/v3-lts/samples/msal-angular-v3-samples/angular18-standalone-sample)
49
-
50
- The samples demonstrates basic configuration and usage, and may be improved and added to incrementally.
51
-
52
- See [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/v3-lts/samples/msal-angular-v3-samples/README.md) for a list of the MSAL Angular v3 samples and the features demonstrated.
@@ -1,36 +0,0 @@
1
- # Upgrading from MSAL Angular v3 to v4
2
-
3
- MSAL Angular v4 includes security updates from MSAL Browser and adds Angular 19 support to the existing Angular 15-18 support.
4
-
5
- Please see the [MSAL Browser v3 migration guide](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/v3-migration.md) for browser support and other key changes.
6
-
7
- ## Changes in `@azure/msal-angular@4`
8
-
9
- ### Using local storage
10
-
11
- Due to changes in MSAL Browser related to local storage encryption, please ensure you are checking that initialization has completed and that interaction status is None before calling any account APIs.
12
-
13
- ```js
14
- this.msalBroadcastService.inProgress$
15
- .pipe(
16
- filter(
17
- (status: InteractionStatus) => status === InteractionStatus.None
18
- ),
19
- takeUntil(this._destroying$)
20
- )
21
- .subscribe(() => {
22
- this.loginDisplay = this.authService.instance.getAllAccounts().length > 0;
23
- });
24
- ```
25
-
26
- ## Samples
27
-
28
- The following developer samples are now available:
29
-
30
- - [Angular B2C Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-samples/angular-b2c-sample)
31
- - [Angular Modules Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-samples/angular-modules-sample)
32
- - [Angular Standalone Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-samples/angular-standalone-sample)
33
-
34
- The samples demonstrates basic configuration and usage, and may be improved and added to incrementally.
35
-
36
- See [here](hhttps://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-samples) for a list of the current MSAL Angular samples and the features demonstrated.
package/karma.conf.js DELETED
@@ -1,44 +0,0 @@
1
- /*
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
-
6
- module.exports = function (config) {
7
- config.set({
8
- basePath: "",
9
- frameworks: ["jasmine", "@angular-devkit/build-angular"],
10
- plugins: [
11
- require("karma-jasmine"),
12
- require("karma-chrome-launcher"),
13
- require("karma-jasmine-html-reporter"),
14
- require("karma-coverage-istanbul-reporter"),
15
- require("@angular-devkit/build-angular/plugins/karma")
16
- ],
17
- client: {
18
- jasmine: {
19
- failSpecWithNoExpectations: true
20
- },
21
- clearContext: false, // leave Jasmine Spec Runner output visible in browser
22
- captureConsole: true // turns on console logging for test debugging
23
- },
24
- coverageIstanbulReporter: {
25
- dir: require("path").join(__dirname, "./coverage"),
26
- reports: ["html", "lcovonly", "text-summary"],
27
- "report-config":{
28
- lcovonly: {
29
- projectRoot: "../.."
30
- }
31
- },
32
- fixWebpackSourcePaths: true
33
- },
34
- reporters: ["progress", "kjhtml", "coverage-istanbul"],
35
- port: 9876,
36
- colors: true,
37
- logLevel: config.LOG_INFO,
38
- autoWatch: true,
39
- browsers: ["ChromeHeadless"],
40
- singleRun: true,
41
- restartOnFileChange: true,
42
- concurrency: 1
43
- });
44
- };
package/ng-package.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "$schema": "./node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "./dist",
4
- "lib": {
5
- "entryFile": "src/public-api.ts"
6
- }
7
- }