@azure/msal-angular 5.3.1 → 6.0.1
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.
- package/README.md +3 -1
- package/fesm2022/azure-msal-angular.mjs +73 -56
- package/fesm2022/azure-msal-angular.mjs.map +1 -1
- package/package.json +6 -5
- package/types/azure-msal-angular.d.ts +292 -0
- package/IMsalService.d.ts +0 -20
- package/constants.d.ts +0 -9
- package/index.d.ts +0 -5
- package/msal.broadcast.config.d.ts +0 -3
- package/msal.broadcast.service.d.ts +0 -19
- package/msal.guard.config.d.ts +0 -9
- package/msal.guard.d.ts +0 -43
- package/msal.interceptor.config.d.ts +0 -26
- package/msal.interceptor.d.ts +0 -94
- package/msal.module.d.ts +0 -13
- package/msal.navigation.client.d.ts +0 -19
- package/msal.redirect.component.d.ts +0 -15
- package/msal.service.d.ts +0 -43
- package/packageMetadata.d.ts +0 -2
- package/public-api.d.ts +0 -17
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injector, NgZone, InjectionToken, OnInit, ModuleWithProviders } from '@angular/core';
|
|
3
|
+
import * as i2 from '@angular/common';
|
|
4
|
+
import { Location } from '@angular/common';
|
|
5
|
+
import { PopupRequest, AuthenticationResult, RedirectRequest, SilentRequest, HandleRedirectPromiseOptions, EndSessionRequest, EndSessionPopupRequest, SsoSilentRequest, Logger, IPublicClientApplication, InteractionType, EventMessage, InteractionStatus, NavigationClient, NavigationOptions } from '@azure/msal-browser';
|
|
6
|
+
import { Observable } from 'rxjs';
|
|
7
|
+
import { RouterStateSnapshot, Router, UrlTree, ActivatedRouteSnapshot } from '@angular/router';
|
|
8
|
+
import { HttpRequest, HttpInterceptor, HttpHandler, HttpEvent } from '@angular/common/http';
|
|
9
|
+
|
|
10
|
+
interface IMsalService {
|
|
11
|
+
initialize(): Observable<void>;
|
|
12
|
+
acquireTokenPopup(request: PopupRequest): Observable<AuthenticationResult>;
|
|
13
|
+
acquireTokenRedirect(request: RedirectRequest): Observable<void>;
|
|
14
|
+
acquireTokenSilent(silentRequest: SilentRequest): Observable<AuthenticationResult>;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Pass options object instead of hash string. Use handleRedirectObservable({ hash: "#..." }) instead.
|
|
17
|
+
*/
|
|
18
|
+
handleRedirectObservable(hash: string): Observable<AuthenticationResult | null>;
|
|
19
|
+
handleRedirectObservable(options?: HandleRedirectPromiseOptions): Observable<AuthenticationResult | null>;
|
|
20
|
+
loginPopup(request?: PopupRequest): Observable<AuthenticationResult>;
|
|
21
|
+
loginRedirect(request?: RedirectRequest): Observable<void>;
|
|
22
|
+
logoutRedirect(logoutRequest?: EndSessionRequest): Observable<void>;
|
|
23
|
+
logoutPopup(logoutRequest?: EndSessionPopupRequest): Observable<void>;
|
|
24
|
+
ssoSilent(request: SsoSilentRequest): Observable<AuthenticationResult>;
|
|
25
|
+
getLogger(): Logger;
|
|
26
|
+
setLogger(logger: Logger): void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare class MsalService implements IMsalService {
|
|
30
|
+
instance: IPublicClientApplication;
|
|
31
|
+
private location;
|
|
32
|
+
private injector;
|
|
33
|
+
private redirectHash?;
|
|
34
|
+
private logger?;
|
|
35
|
+
constructor(instance: IPublicClientApplication, location: Location, injector: Injector);
|
|
36
|
+
initialize(): Observable<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Ensures the PublicClientApplication has been initialized.
|
|
39
|
+
*/
|
|
40
|
+
private withInitialize;
|
|
41
|
+
acquireTokenPopup(request: PopupRequest): Observable<AuthenticationResult>;
|
|
42
|
+
acquireTokenRedirect(request: RedirectRequest): Observable<void>;
|
|
43
|
+
acquireTokenSilent(silentRequest: SilentRequest): Observable<AuthenticationResult>;
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated Pass options object instead of hash string. Use handleRedirectObservable({ hash: "#..." }) instead.
|
|
46
|
+
*/
|
|
47
|
+
handleRedirectObservable(hash: string): Observable<AuthenticationResult | null>;
|
|
48
|
+
/**
|
|
49
|
+
* Handles the redirect response from authentication. Call this on every page load after a redirect-based login.
|
|
50
|
+
* If no options are provided, the service will attempt to use the cached redirect hash captured during construction.
|
|
51
|
+
*
|
|
52
|
+
* @param options - Optional configuration for redirect handling, such as an explicit hash value to process.
|
|
53
|
+
* @returns Observable that emits the AuthenticationResult when a redirect is successfully handled.
|
|
54
|
+
*/
|
|
55
|
+
handleRedirectObservable(options?: HandleRedirectPromiseOptions): Observable<AuthenticationResult | null>;
|
|
56
|
+
loginPopup(request?: PopupRequest): Observable<AuthenticationResult>;
|
|
57
|
+
loginRedirect(request?: RedirectRequest): Observable<void>;
|
|
58
|
+
logoutRedirect(logoutRequest?: EndSessionRequest): Observable<void>;
|
|
59
|
+
logoutPopup(logoutRequest?: EndSessionPopupRequest): Observable<void>;
|
|
60
|
+
ssoSilent(request: SsoSilentRequest): Observable<AuthenticationResult>;
|
|
61
|
+
/**
|
|
62
|
+
* Gets logger for msal-angular.
|
|
63
|
+
* If no logger set, returns logger instance created with same options as msal-browser
|
|
64
|
+
*/
|
|
65
|
+
getLogger(): Logger;
|
|
66
|
+
setLogger(logger: Logger): void;
|
|
67
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MsalService, never>;
|
|
68
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MsalService>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
declare type MsalGuardAuthRequest = Partial<PopupRequest> | Partial<Omit<RedirectRequest, "redirectStartPage">>;
|
|
72
|
+
type MsalGuardConfiguration = {
|
|
73
|
+
interactionType: InteractionType.Popup | InteractionType.Redirect;
|
|
74
|
+
authRequest?: MsalGuardAuthRequest | ((authService: MsalService, state: RouterStateSnapshot) => MsalGuardAuthRequest);
|
|
75
|
+
loginFailedRoute?: string;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
type MsalBroadcastConfiguration = {
|
|
79
|
+
eventsToReplay: number;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
declare class MsalBroadcastService {
|
|
83
|
+
private msalInstance;
|
|
84
|
+
private ngZone;
|
|
85
|
+
private msalBroadcastConfig?;
|
|
86
|
+
private _msalSubject;
|
|
87
|
+
msalSubject$: Observable<EventMessage>;
|
|
88
|
+
private _inProgress;
|
|
89
|
+
inProgress$: Observable<InteractionStatus>;
|
|
90
|
+
constructor(msalInstance: IPublicClientApplication, ngZone: NgZone, msalBroadcastConfig?: MsalBroadcastConfiguration | undefined);
|
|
91
|
+
/**
|
|
92
|
+
* Resets inProgress state to None
|
|
93
|
+
*/
|
|
94
|
+
resetInProgressEvent(): void;
|
|
95
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MsalBroadcastService, [null, null, { optional: true; }]>;
|
|
96
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MsalBroadcastService>;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
declare class MsalGuard {
|
|
100
|
+
private msalGuardConfig;
|
|
101
|
+
private msalBroadcastService;
|
|
102
|
+
private authService;
|
|
103
|
+
private location;
|
|
104
|
+
private router;
|
|
105
|
+
private loginFailedRoute?;
|
|
106
|
+
constructor(msalGuardConfig: MsalGuardConfiguration, msalBroadcastService: MsalBroadcastService, authService: MsalService, location: Location, router: Router);
|
|
107
|
+
/**
|
|
108
|
+
* Parses url string to UrlTree
|
|
109
|
+
* @param url
|
|
110
|
+
*/
|
|
111
|
+
parseUrl(url: string): UrlTree;
|
|
112
|
+
/**
|
|
113
|
+
* Builds the absolute url for the destination page
|
|
114
|
+
* @param path Relative path of requested page
|
|
115
|
+
* @returns Full destination url
|
|
116
|
+
*/
|
|
117
|
+
getDestinationUrl(path: string): string;
|
|
118
|
+
/**
|
|
119
|
+
* Interactively prompt the user to login
|
|
120
|
+
* @param url Path of the requested page
|
|
121
|
+
*/
|
|
122
|
+
private loginInteractively;
|
|
123
|
+
/**
|
|
124
|
+
* Helper which checks for the correct interaction type, prevents page with Guard to be set as redirect, and calls handleRedirectObservable
|
|
125
|
+
* @param state
|
|
126
|
+
*/
|
|
127
|
+
private activateHelper;
|
|
128
|
+
includesCode(path: string): boolean;
|
|
129
|
+
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree>;
|
|
130
|
+
canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree>;
|
|
131
|
+
canMatch(): Observable<boolean | UrlTree>;
|
|
132
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MsalGuard, never>;
|
|
133
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MsalGuard>;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
declare type MsalInterceptorAuthRequest = Omit<PopupRequest, "scopes"> | Omit<RedirectRequest, "scopes"> | Omit<SilentRequest, "scopes">;
|
|
137
|
+
type MsalInterceptorConfiguration = {
|
|
138
|
+
interactionType: InteractionType.Popup | InteractionType.Redirect;
|
|
139
|
+
protectedResourceMap: Map<string, Array<string | ProtectedResourceScopes> | null>;
|
|
140
|
+
authRequest?: MsalInterceptorAuthRequest | ((msalService: MsalService, req: HttpRequest<unknown>, originalAuthRequest: MsalInterceptorAuthRequest) => MsalInterceptorAuthRequest);
|
|
141
|
+
/**
|
|
142
|
+
* When `true` (the default in v5), enables stricter, more correct URL component pattern matching for
|
|
143
|
+
* `protectedResourceMap` entries. Strict matching uses anchored regex patterns and
|
|
144
|
+
* treats metacharacters (including `.`) as literals, so patterns match only their
|
|
145
|
+
* intended strings. Wildcards still apply, but host-component wildcards
|
|
146
|
+
* are constrained to a single DNS label.
|
|
147
|
+
*
|
|
148
|
+
* Set to `false` to use the legacy matching behaviour from v4 for
|
|
149
|
+
* backwards compatibility.
|
|
150
|
+
*
|
|
151
|
+
* @default true
|
|
152
|
+
*/
|
|
153
|
+
strictMatching?: boolean;
|
|
154
|
+
};
|
|
155
|
+
type ProtectedResourceScopes = {
|
|
156
|
+
httpMethod: string;
|
|
157
|
+
scopes: Array<string> | null;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
declare class MsalInterceptor implements HttpInterceptor {
|
|
161
|
+
private msalInterceptorConfig;
|
|
162
|
+
private authService;
|
|
163
|
+
private location;
|
|
164
|
+
private msalBroadcastService;
|
|
165
|
+
private _document;
|
|
166
|
+
constructor(msalInterceptorConfig: MsalInterceptorConfiguration, authService: MsalService, location: Location, msalBroadcastService: MsalBroadcastService, document: Document);
|
|
167
|
+
intercept(req: HttpRequest<any>, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
168
|
+
next: HttpHandler): Observable<HttpEvent<any>>;
|
|
169
|
+
/**
|
|
170
|
+
* Try to acquire token silently. Invoke interaction if acquireTokenSilent rejected with error or resolved with null access token
|
|
171
|
+
* @param authRequest Request
|
|
172
|
+
* @param scopes Array of scopes for the request
|
|
173
|
+
* @param account Account
|
|
174
|
+
* @returns Authentication result
|
|
175
|
+
*/
|
|
176
|
+
private acquireToken;
|
|
177
|
+
/**
|
|
178
|
+
* Invoke interaction for the given set of scopes
|
|
179
|
+
* @param authRequest Request
|
|
180
|
+
* @param scopes Array of scopes for the request
|
|
181
|
+
* @returns Result from the interactive request
|
|
182
|
+
*/
|
|
183
|
+
private acquireTokenInteractively;
|
|
184
|
+
/**
|
|
185
|
+
* Looks up the scopes for the given endpoint from the protectedResourceMap
|
|
186
|
+
* @param endpoint Url of the request
|
|
187
|
+
* @param httpMethod Http method of the request
|
|
188
|
+
* @returns Array of scopes, or null if not found
|
|
189
|
+
*
|
|
190
|
+
*/
|
|
191
|
+
private getScopesForEndpoint;
|
|
192
|
+
/**
|
|
193
|
+
* Finds resource endpoints that match request endpoint
|
|
194
|
+
* @param protectedResourcesEndpoints
|
|
195
|
+
* @param endpoint
|
|
196
|
+
* @returns
|
|
197
|
+
*/
|
|
198
|
+
private matchResourcesToEndpoint;
|
|
199
|
+
/**
|
|
200
|
+
* Compares URL segments between key and endpoint
|
|
201
|
+
* @param key
|
|
202
|
+
* @param endpoint
|
|
203
|
+
* @returns
|
|
204
|
+
*/
|
|
205
|
+
private checkUrlComponents;
|
|
206
|
+
/**
|
|
207
|
+
* Transforms relative urls to absolute urls
|
|
208
|
+
* @param url
|
|
209
|
+
* @returns
|
|
210
|
+
*/
|
|
211
|
+
private getAbsoluteUrl;
|
|
212
|
+
/**
|
|
213
|
+
* Finds scopes from first matching endpoint with HTTP method that matches request
|
|
214
|
+
* @param protectedResourceMap Protected resource map
|
|
215
|
+
* @param endpointArray Array of resources that match request endpoint
|
|
216
|
+
* @param httpMethod Http method of the request
|
|
217
|
+
* @returns
|
|
218
|
+
*/
|
|
219
|
+
private matchScopesToEndpoint;
|
|
220
|
+
/**
|
|
221
|
+
* Tests if a given string matches a given pattern, with support for wildcards and queries.
|
|
222
|
+
* @param pattern Wildcard pattern to string match. Supports "*" for wildcards and "?" for queries
|
|
223
|
+
* @param input String to match against
|
|
224
|
+
*/
|
|
225
|
+
private matchPattern;
|
|
226
|
+
/**
|
|
227
|
+
* Tests if a given string matches a given pattern using stricter, anchored
|
|
228
|
+
* matching semantics.
|
|
229
|
+
*
|
|
230
|
+
* Differences from `matchPattern` (legacy):
|
|
231
|
+
* - All regex metacharacters (including `.` and `?`) are treated as literals.
|
|
232
|
+
* - The generated regex is anchored with `^` and `$` (full-string match).
|
|
233
|
+
* - `*` wildcard behaviour depends on the URL component:
|
|
234
|
+
* - `host`: `*` maps to `[^.]*` — matches any characters that do NOT
|
|
235
|
+
* include `.`, so wildcards stay within a single DNS label.
|
|
236
|
+
* - All other components: `*` matches any characters.
|
|
237
|
+
*
|
|
238
|
+
* @param pattern - The protectedResourceMap key pattern.
|
|
239
|
+
* @param input - The URL component value from the outgoing request.
|
|
240
|
+
* @param component - Which URL component is being matched.
|
|
241
|
+
* @returns `true` if the full input string matches the pattern.
|
|
242
|
+
*/
|
|
243
|
+
private matchPatternStrict;
|
|
244
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MsalInterceptor, never>;
|
|
245
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MsalInterceptor>;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
declare const MSAL_INSTANCE: InjectionToken<IPublicClientApplication>;
|
|
249
|
+
declare const MSAL_GUARD_CONFIG: InjectionToken<MsalGuardConfiguration>;
|
|
250
|
+
declare const MSAL_INTERCEPTOR_CONFIG: InjectionToken<MsalInterceptorConfiguration>;
|
|
251
|
+
declare const MSAL_BROADCAST_CONFIG: InjectionToken<MsalBroadcastConfiguration>;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* This is a dedicated redirect component to be added to Angular apps to
|
|
255
|
+
* handle redirects when using @azure/msal-angular.
|
|
256
|
+
* Import this component to use redirects in your app.
|
|
257
|
+
*/
|
|
258
|
+
|
|
259
|
+
declare class MsalRedirectComponent implements OnInit {
|
|
260
|
+
private authService;
|
|
261
|
+
constructor(authService: MsalService);
|
|
262
|
+
ngOnInit(): void;
|
|
263
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MsalRedirectComponent, never>;
|
|
264
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MsalRedirectComponent, "app-redirect", never, {}, {}, never, never, false, never>;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
declare class MsalModule {
|
|
268
|
+
static forRoot(msalInstance: IPublicClientApplication, guardConfig: MsalGuardConfiguration, interceptorConfig: MsalInterceptorConfiguration): ModuleWithProviders<MsalModule>;
|
|
269
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MsalModule, never>;
|
|
270
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<MsalModule, [typeof MsalRedirectComponent], [typeof i2.CommonModule], never>;
|
|
271
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<MsalModule>;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Custom navigation used for Angular client-side navigation.
|
|
276
|
+
* See performance doc for details:
|
|
277
|
+
* https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular/docs/performance.md
|
|
278
|
+
*/
|
|
279
|
+
declare class MsalCustomNavigationClient extends NavigationClient {
|
|
280
|
+
private authService;
|
|
281
|
+
private router;
|
|
282
|
+
private location;
|
|
283
|
+
constructor(authService: MsalService, router: Router, location: Location);
|
|
284
|
+
navigateInternal(url: string, options: NavigationOptions): Promise<boolean>;
|
|
285
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MsalCustomNavigationClient, never>;
|
|
286
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MsalCustomNavigationClient>;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
declare const version = "6.0.1";
|
|
290
|
+
|
|
291
|
+
export { MSAL_BROADCAST_CONFIG, MSAL_GUARD_CONFIG, MSAL_INSTANCE, MSAL_INTERCEPTOR_CONFIG, MsalBroadcastService, MsalCustomNavigationClient, MsalGuard, MsalInterceptor, MsalModule, MsalRedirectComponent, MsalService, version };
|
|
292
|
+
export type { IMsalService, MsalBroadcastConfiguration, MsalGuardAuthRequest, MsalGuardConfiguration, MsalInterceptorAuthRequest, MsalInterceptorConfiguration, ProtectedResourceScopes };
|
package/IMsalService.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { AuthenticationResult, PopupRequest, RedirectRequest, SilentRequest, Logger, SsoSilentRequest, EndSessionRequest, EndSessionPopupRequest, HandleRedirectPromiseOptions } from "@azure/msal-browser";
|
|
2
|
-
import { Observable } from "rxjs";
|
|
3
|
-
export interface IMsalService {
|
|
4
|
-
initialize(): Observable<void>;
|
|
5
|
-
acquireTokenPopup(request: PopupRequest): Observable<AuthenticationResult>;
|
|
6
|
-
acquireTokenRedirect(request: RedirectRequest): Observable<void>;
|
|
7
|
-
acquireTokenSilent(silentRequest: SilentRequest): Observable<AuthenticationResult>;
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated Pass options object instead of hash string. Use handleRedirectObservable({ hash: "#..." }) instead.
|
|
10
|
-
*/
|
|
11
|
-
handleRedirectObservable(hash: string): Observable<AuthenticationResult | null>;
|
|
12
|
-
handleRedirectObservable(options?: HandleRedirectPromiseOptions): Observable<AuthenticationResult | null>;
|
|
13
|
-
loginPopup(request?: PopupRequest): Observable<AuthenticationResult>;
|
|
14
|
-
loginRedirect(request?: RedirectRequest): Observable<void>;
|
|
15
|
-
logoutRedirect(logoutRequest?: EndSessionRequest): Observable<void>;
|
|
16
|
-
logoutPopup(logoutRequest?: EndSessionPopupRequest): Observable<void>;
|
|
17
|
-
ssoSilent(request: SsoSilentRequest): Observable<AuthenticationResult>;
|
|
18
|
-
getLogger(): Logger;
|
|
19
|
-
setLogger(logger: Logger): void;
|
|
20
|
-
}
|
package/constants.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { InjectionToken } from "@angular/core";
|
|
2
|
-
import { type IPublicClientApplication } from "@azure/msal-browser";
|
|
3
|
-
import { type MsalBroadcastConfiguration } from "./msal.broadcast.config";
|
|
4
|
-
import { type MsalGuardConfiguration } from "./msal.guard.config";
|
|
5
|
-
import { type MsalInterceptorConfiguration } from "./msal.interceptor.config";
|
|
6
|
-
export declare const MSAL_INSTANCE: InjectionToken<IPublicClientApplication>;
|
|
7
|
-
export declare const MSAL_GUARD_CONFIG: InjectionToken<MsalGuardConfiguration>;
|
|
8
|
-
export declare const MSAL_INTERCEPTOR_CONFIG: InjectionToken<MsalInterceptorConfiguration>;
|
|
9
|
-
export declare const MSAL_BROADCAST_CONFIG: InjectionToken<MsalBroadcastConfiguration>;
|
package/index.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { EventMessage, IPublicClientApplication, InteractionStatus } from "@azure/msal-browser";
|
|
2
|
-
import { Observable } from "rxjs";
|
|
3
|
-
import { MsalBroadcastConfiguration } from "./msal.broadcast.config";
|
|
4
|
-
import * as i0 from "@angular/core";
|
|
5
|
-
export declare class MsalBroadcastService {
|
|
6
|
-
private msalInstance;
|
|
7
|
-
private msalBroadcastConfig?;
|
|
8
|
-
private _msalSubject;
|
|
9
|
-
msalSubject$: Observable<EventMessage>;
|
|
10
|
-
private _inProgress;
|
|
11
|
-
inProgress$: Observable<InteractionStatus>;
|
|
12
|
-
constructor(msalInstance: IPublicClientApplication, msalBroadcastConfig?: MsalBroadcastConfiguration);
|
|
13
|
-
/**
|
|
14
|
-
* Resets inProgress state to None
|
|
15
|
-
*/
|
|
16
|
-
resetInProgressEvent(): void;
|
|
17
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<MsalBroadcastService, [null, { optional: true; }]>;
|
|
18
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<MsalBroadcastService>;
|
|
19
|
-
}
|
package/msal.guard.config.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { RouterStateSnapshot } from "@angular/router";
|
|
2
|
-
import { PopupRequest, RedirectRequest, InteractionType } from "@azure/msal-browser";
|
|
3
|
-
import { MsalService } from "./msal.service";
|
|
4
|
-
export declare type MsalGuardAuthRequest = Partial<PopupRequest> | Partial<Omit<RedirectRequest, "redirectStartPage">>;
|
|
5
|
-
export type MsalGuardConfiguration = {
|
|
6
|
-
interactionType: InteractionType.Popup | InteractionType.Redirect;
|
|
7
|
-
authRequest?: MsalGuardAuthRequest | ((authService: MsalService, state: RouterStateSnapshot) => MsalGuardAuthRequest);
|
|
8
|
-
loginFailedRoute?: string;
|
|
9
|
-
};
|
package/msal.guard.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Location } from "@angular/common";
|
|
2
|
-
import { ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree, Router } from "@angular/router";
|
|
3
|
-
import { Observable } from "rxjs";
|
|
4
|
-
import { MsalService } from "./msal.service";
|
|
5
|
-
import { MsalGuardConfiguration } from "./msal.guard.config";
|
|
6
|
-
import { MsalBroadcastService } from "./msal.broadcast.service";
|
|
7
|
-
import * as i0 from "@angular/core";
|
|
8
|
-
export declare class MsalGuard {
|
|
9
|
-
private msalGuardConfig;
|
|
10
|
-
private msalBroadcastService;
|
|
11
|
-
private authService;
|
|
12
|
-
private location;
|
|
13
|
-
private router;
|
|
14
|
-
private loginFailedRoute?;
|
|
15
|
-
constructor(msalGuardConfig: MsalGuardConfiguration, msalBroadcastService: MsalBroadcastService, authService: MsalService, location: Location, router: Router);
|
|
16
|
-
/**
|
|
17
|
-
* Parses url string to UrlTree
|
|
18
|
-
* @param url
|
|
19
|
-
*/
|
|
20
|
-
parseUrl(url: string): UrlTree;
|
|
21
|
-
/**
|
|
22
|
-
* Builds the absolute url for the destination page
|
|
23
|
-
* @param path Relative path of requested page
|
|
24
|
-
* @returns Full destination url
|
|
25
|
-
*/
|
|
26
|
-
getDestinationUrl(path: string): string;
|
|
27
|
-
/**
|
|
28
|
-
* Interactively prompt the user to login
|
|
29
|
-
* @param url Path of the requested page
|
|
30
|
-
*/
|
|
31
|
-
private loginInteractively;
|
|
32
|
-
/**
|
|
33
|
-
* Helper which checks for the correct interaction type, prevents page with Guard to be set as redirect, and calls handleRedirectObservable
|
|
34
|
-
* @param state
|
|
35
|
-
*/
|
|
36
|
-
private activateHelper;
|
|
37
|
-
includesCode(path: string): boolean;
|
|
38
|
-
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree>;
|
|
39
|
-
canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree>;
|
|
40
|
-
canMatch(): Observable<boolean | UrlTree>;
|
|
41
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<MsalGuard, never>;
|
|
42
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<MsalGuard>;
|
|
43
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { HttpRequest } from "@angular/common/http";
|
|
2
|
-
import { PopupRequest, RedirectRequest, InteractionType, SilentRequest } from "@azure/msal-browser";
|
|
3
|
-
import { MsalService } from "./msal.service";
|
|
4
|
-
export declare type MsalInterceptorAuthRequest = Omit<PopupRequest, "scopes"> | Omit<RedirectRequest, "scopes"> | Omit<SilentRequest, "scopes">;
|
|
5
|
-
export type MsalInterceptorConfiguration = {
|
|
6
|
-
interactionType: InteractionType.Popup | InteractionType.Redirect;
|
|
7
|
-
protectedResourceMap: Map<string, Array<string | ProtectedResourceScopes> | null>;
|
|
8
|
-
authRequest?: MsalInterceptorAuthRequest | ((msalService: MsalService, req: HttpRequest<unknown>, originalAuthRequest: MsalInterceptorAuthRequest) => MsalInterceptorAuthRequest);
|
|
9
|
-
/**
|
|
10
|
-
* When `true` (the default in v5), enables stricter, more correct URL component pattern matching for
|
|
11
|
-
* `protectedResourceMap` entries. Strict matching uses anchored regex patterns and
|
|
12
|
-
* treats metacharacters (including `.`) as literals, so patterns match only their
|
|
13
|
-
* intended strings. Wildcards still apply, but host-component wildcards
|
|
14
|
-
* are constrained to a single DNS label.
|
|
15
|
-
*
|
|
16
|
-
* Set to `false` to use the legacy matching behaviour from v4 for
|
|
17
|
-
* backwards compatibility.
|
|
18
|
-
*
|
|
19
|
-
* @default true
|
|
20
|
-
*/
|
|
21
|
-
strictMatching?: boolean;
|
|
22
|
-
};
|
|
23
|
-
export type ProtectedResourceScopes = {
|
|
24
|
-
httpMethod: string;
|
|
25
|
-
scopes: Array<string> | null;
|
|
26
|
-
};
|
package/msal.interceptor.d.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { Location } from "@angular/common";
|
|
2
|
-
import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from "@angular/common/http";
|
|
3
|
-
import { Observable } from "rxjs";
|
|
4
|
-
import { MsalService } from "./msal.service";
|
|
5
|
-
import { MsalInterceptorConfiguration } from "./msal.interceptor.config";
|
|
6
|
-
import { MsalBroadcastService } from "./msal.broadcast.service";
|
|
7
|
-
import * as i0 from "@angular/core";
|
|
8
|
-
export declare class MsalInterceptor implements HttpInterceptor {
|
|
9
|
-
private msalInterceptorConfig;
|
|
10
|
-
private authService;
|
|
11
|
-
private location;
|
|
12
|
-
private msalBroadcastService;
|
|
13
|
-
private _document?;
|
|
14
|
-
constructor(msalInterceptorConfig: MsalInterceptorConfiguration, authService: MsalService, location: Location, msalBroadcastService: MsalBroadcastService, document?: any);
|
|
15
|
-
intercept(req: HttpRequest<any>, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
16
|
-
next: HttpHandler): Observable<HttpEvent<any>>;
|
|
17
|
-
/**
|
|
18
|
-
* Try to acquire token silently. Invoke interaction if acquireTokenSilent rejected with error or resolved with null access token
|
|
19
|
-
* @param authRequest Request
|
|
20
|
-
* @param scopes Array of scopes for the request
|
|
21
|
-
* @param account Account
|
|
22
|
-
* @returns Authentication result
|
|
23
|
-
*/
|
|
24
|
-
private acquireToken;
|
|
25
|
-
/**
|
|
26
|
-
* Invoke interaction for the given set of scopes
|
|
27
|
-
* @param authRequest Request
|
|
28
|
-
* @param scopes Array of scopes for the request
|
|
29
|
-
* @returns Result from the interactive request
|
|
30
|
-
*/
|
|
31
|
-
private acquireTokenInteractively;
|
|
32
|
-
/**
|
|
33
|
-
* Looks up the scopes for the given endpoint from the protectedResourceMap
|
|
34
|
-
* @param endpoint Url of the request
|
|
35
|
-
* @param httpMethod Http method of the request
|
|
36
|
-
* @returns Array of scopes, or null if not found
|
|
37
|
-
*
|
|
38
|
-
*/
|
|
39
|
-
private getScopesForEndpoint;
|
|
40
|
-
/**
|
|
41
|
-
* Finds resource endpoints that match request endpoint
|
|
42
|
-
* @param protectedResourcesEndpoints
|
|
43
|
-
* @param endpoint
|
|
44
|
-
* @returns
|
|
45
|
-
*/
|
|
46
|
-
private matchResourcesToEndpoint;
|
|
47
|
-
/**
|
|
48
|
-
* Compares URL segments between key and endpoint
|
|
49
|
-
* @param key
|
|
50
|
-
* @param endpoint
|
|
51
|
-
* @returns
|
|
52
|
-
*/
|
|
53
|
-
private checkUrlComponents;
|
|
54
|
-
/**
|
|
55
|
-
* Transforms relative urls to absolute urls
|
|
56
|
-
* @param url
|
|
57
|
-
* @returns
|
|
58
|
-
*/
|
|
59
|
-
private getAbsoluteUrl;
|
|
60
|
-
/**
|
|
61
|
-
* Finds scopes from first matching endpoint with HTTP method that matches request
|
|
62
|
-
* @param protectedResourceMap Protected resource map
|
|
63
|
-
* @param endpointArray Array of resources that match request endpoint
|
|
64
|
-
* @param httpMethod Http method of the request
|
|
65
|
-
* @returns
|
|
66
|
-
*/
|
|
67
|
-
private matchScopesToEndpoint;
|
|
68
|
-
/**
|
|
69
|
-
* Tests if a given string matches a given pattern, with support for wildcards and queries.
|
|
70
|
-
* @param pattern Wildcard pattern to string match. Supports "*" for wildcards and "?" for queries
|
|
71
|
-
* @param input String to match against
|
|
72
|
-
*/
|
|
73
|
-
private matchPattern;
|
|
74
|
-
/**
|
|
75
|
-
* Tests if a given string matches a given pattern using stricter, anchored
|
|
76
|
-
* matching semantics.
|
|
77
|
-
*
|
|
78
|
-
* Differences from `matchPattern` (legacy):
|
|
79
|
-
* - All regex metacharacters (including `.` and `?`) are treated as literals.
|
|
80
|
-
* - The generated regex is anchored with `^` and `$` (full-string match).
|
|
81
|
-
* - `*` wildcard behaviour depends on the URL component:
|
|
82
|
-
* - `host`: `*` maps to `[^.]*` — matches any characters that do NOT
|
|
83
|
-
* include `.`, so wildcards stay within a single DNS label.
|
|
84
|
-
* - All other components: `*` matches any characters.
|
|
85
|
-
*
|
|
86
|
-
* @param pattern - The protectedResourceMap key pattern.
|
|
87
|
-
* @param input - The URL component value from the outgoing request.
|
|
88
|
-
* @param component - Which URL component is being matched.
|
|
89
|
-
* @returns `true` if the full input string matches the pattern.
|
|
90
|
-
*/
|
|
91
|
-
private matchPatternStrict;
|
|
92
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<MsalInterceptor, never>;
|
|
93
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<MsalInterceptor>;
|
|
94
|
-
}
|
package/msal.module.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ModuleWithProviders } from "@angular/core";
|
|
2
|
-
import { IPublicClientApplication } from "@azure/msal-browser";
|
|
3
|
-
import { MsalGuardConfiguration } from "./msal.guard.config";
|
|
4
|
-
import { MsalInterceptorConfiguration } from "./msal.interceptor.config";
|
|
5
|
-
import * as i0 from "@angular/core";
|
|
6
|
-
import * as i1 from "./msal.redirect.component";
|
|
7
|
-
import * as i2 from "@angular/common";
|
|
8
|
-
export declare class MsalModule {
|
|
9
|
-
static forRoot(msalInstance: IPublicClientApplication, guardConfig: MsalGuardConfiguration, interceptorConfig: MsalInterceptorConfiguration): ModuleWithProviders<MsalModule>;
|
|
10
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<MsalModule, never>;
|
|
11
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<MsalModule, [typeof i1.MsalRedirectComponent], [typeof i2.CommonModule], never>;
|
|
12
|
-
static ɵinj: i0.ɵɵInjectorDeclaration<MsalModule>;
|
|
13
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Location } from "@angular/common";
|
|
2
|
-
import { Router } from "@angular/router";
|
|
3
|
-
import { NavigationClient, NavigationOptions } from "@azure/msal-browser";
|
|
4
|
-
import { MsalService } from "./msal.service";
|
|
5
|
-
import * as i0 from "@angular/core";
|
|
6
|
-
/**
|
|
7
|
-
* Custom navigation used for Angular client-side navigation.
|
|
8
|
-
* See performance doc for details:
|
|
9
|
-
* https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular/docs/performance.md
|
|
10
|
-
*/
|
|
11
|
-
export declare class MsalCustomNavigationClient extends NavigationClient {
|
|
12
|
-
private authService;
|
|
13
|
-
private router;
|
|
14
|
-
private location;
|
|
15
|
-
constructor(authService: MsalService, router: Router, location: Location);
|
|
16
|
-
navigateInternal(url: string, options: NavigationOptions): Promise<boolean>;
|
|
17
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<MsalCustomNavigationClient, never>;
|
|
18
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<MsalCustomNavigationClient>;
|
|
19
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is a dedicated redirect component to be added to Angular apps to
|
|
3
|
-
* handle redirects when using @azure/msal-angular.
|
|
4
|
-
* Import this component to use redirects in your app.
|
|
5
|
-
*/
|
|
6
|
-
import { OnInit } from "@angular/core";
|
|
7
|
-
import { MsalService } from "./msal.service";
|
|
8
|
-
import * as i0 from "@angular/core";
|
|
9
|
-
export declare class MsalRedirectComponent implements OnInit {
|
|
10
|
-
private authService;
|
|
11
|
-
constructor(authService: MsalService);
|
|
12
|
-
ngOnInit(): void;
|
|
13
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<MsalRedirectComponent, never>;
|
|
14
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<MsalRedirectComponent, "app-redirect", never, {}, {}, never, never, false, never>;
|
|
15
|
-
}
|
package/msal.service.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Injector } from "@angular/core";
|
|
2
|
-
import { Location } from "@angular/common";
|
|
3
|
-
import { IPublicClientApplication, EndSessionRequest, EndSessionPopupRequest, AuthenticationResult, RedirectRequest, SilentRequest, PopupRequest, SsoSilentRequest, Logger, HandleRedirectPromiseOptions } from "@azure/msal-browser";
|
|
4
|
-
import { Observable } from "rxjs";
|
|
5
|
-
import { IMsalService } from "./IMsalService";
|
|
6
|
-
import * as i0 from "@angular/core";
|
|
7
|
-
export declare class MsalService implements IMsalService {
|
|
8
|
-
instance: IPublicClientApplication;
|
|
9
|
-
private location;
|
|
10
|
-
private injector;
|
|
11
|
-
private redirectHash;
|
|
12
|
-
private logger;
|
|
13
|
-
constructor(instance: IPublicClientApplication, location: Location, injector: Injector);
|
|
14
|
-
initialize(): Observable<void>;
|
|
15
|
-
acquireTokenPopup(request: PopupRequest): Observable<AuthenticationResult>;
|
|
16
|
-
acquireTokenRedirect(request: RedirectRequest): Observable<void>;
|
|
17
|
-
acquireTokenSilent(silentRequest: SilentRequest): Observable<AuthenticationResult>;
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated Pass options object instead of hash string. Use handleRedirectObservable({ hash: "#..." }) instead.
|
|
20
|
-
*/
|
|
21
|
-
handleRedirectObservable(hash: string): Observable<AuthenticationResult | null>;
|
|
22
|
-
/**
|
|
23
|
-
* Handles the redirect response from authentication. Call this on every page load after a redirect-based login.
|
|
24
|
-
* If no options are provided, the service will attempt to use the cached redirect hash captured during construction.
|
|
25
|
-
*
|
|
26
|
-
* @param options - Optional configuration for redirect handling, such as an explicit hash value to process.
|
|
27
|
-
* @returns Observable that emits the AuthenticationResult when a redirect is successfully handled.
|
|
28
|
-
*/
|
|
29
|
-
handleRedirectObservable(options?: HandleRedirectPromiseOptions): Observable<AuthenticationResult | null>;
|
|
30
|
-
loginPopup(request?: PopupRequest): Observable<AuthenticationResult>;
|
|
31
|
-
loginRedirect(request?: RedirectRequest): Observable<void>;
|
|
32
|
-
logoutRedirect(logoutRequest?: EndSessionRequest): Observable<void>;
|
|
33
|
-
logoutPopup(logoutRequest?: EndSessionPopupRequest): Observable<void>;
|
|
34
|
-
ssoSilent(request: SsoSilentRequest): Observable<AuthenticationResult>;
|
|
35
|
-
/**
|
|
36
|
-
* Gets logger for msal-angular.
|
|
37
|
-
* If no logger set, returns logger instance created with same options as msal-browser
|
|
38
|
-
*/
|
|
39
|
-
getLogger(): Logger;
|
|
40
|
-
setLogger(logger: Logger): void;
|
|
41
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<MsalService, never>;
|
|
42
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<MsalService>;
|
|
43
|
-
}
|
package/packageMetadata.d.ts
DELETED
package/public-api.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @packageDocumentation
|
|
3
|
-
* @module @azure/msal-angular
|
|
4
|
-
*/
|
|
5
|
-
export { MsalService } from "./msal.service";
|
|
6
|
-
export { IMsalService } from "./IMsalService";
|
|
7
|
-
export { MsalGuard } from "./msal.guard";
|
|
8
|
-
export { MsalGuardConfiguration, MsalGuardAuthRequest, } from "./msal.guard.config";
|
|
9
|
-
export { MsalInterceptor } from "./msal.interceptor";
|
|
10
|
-
export { MsalInterceptorConfiguration, MsalInterceptorAuthRequest, ProtectedResourceScopes, } from "./msal.interceptor.config";
|
|
11
|
-
export { MSAL_INSTANCE, MSAL_GUARD_CONFIG, MSAL_INTERCEPTOR_CONFIG, MSAL_BROADCAST_CONFIG, } from "./constants";
|
|
12
|
-
export { MsalBroadcastService } from "./msal.broadcast.service";
|
|
13
|
-
export { MsalBroadcastConfiguration } from "./msal.broadcast.config";
|
|
14
|
-
export { MsalModule } from "./msal.module";
|
|
15
|
-
export { MsalRedirectComponent } from "./msal.redirect.component";
|
|
16
|
-
export { MsalCustomNavigationClient } from "./msal.navigation.client";
|
|
17
|
-
export { version } from "./packageMetadata";
|