piral-adal 0.13.8 → 0.14.0-beta.3156
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 +15 -0
- package/esm/create.js +2 -2
- package/esm/create.js.map +1 -1
- package/esm/setup.d.ts +20 -0
- package/esm/setup.js +22 -27
- package/esm/setup.js.map +1 -1
- package/lib/create.js +2 -2
- package/lib/create.js.map +1 -1
- package/lib/index.js +4 -4
- package/lib/index.js.map +1 -1
- package/lib/setup.d.ts +20 -0
- package/lib/setup.js +23 -28
- package/lib/setup.js.map +1 -1
- package/package.json +4 -4
- package/src/setup.ts +22 -4
package/README.md
CHANGED
|
@@ -102,6 +102,21 @@ if (location.pathname !== '/auth') {
|
|
|
102
102
|
|
|
103
103
|
This way we evaluate the current path and act accordingly. Note that the actually used path may be different for your application.
|
|
104
104
|
|
|
105
|
+
By default, the `redirectUri` is chosen to be `{location.origin}/auth`, i.e., if your site is running on `https://example.com` then the redirect would go against `https://example.com/auth`. You can set the `redirectUri` (as well as `postLogoutRedirectUri` for the logout case) in the client setup:
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
// module adal.ts
|
|
109
|
+
import { setupAdalClient } from 'piral-adal';
|
|
110
|
+
|
|
111
|
+
export const client = setupAdalClient({
|
|
112
|
+
clientId: '...',
|
|
113
|
+
redirectUri: 'https://example.com/logged-in',
|
|
114
|
+
postLogoutRedirectUri: 'https://example.com/logged-out',
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
All auth options from the MSAL library are supported. For an overview, [see the MSAL wiki page](https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/MSAL.js-1.0.0-api-release#configuration-options).
|
|
119
|
+
|
|
105
120
|
:::
|
|
106
121
|
|
|
107
122
|
## License
|
package/esm/create.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Creates new Pilet API extensions for the integration of MSAL.
|
|
3
3
|
*/
|
|
4
4
|
export function createAdalApi(client) {
|
|
5
|
-
return
|
|
5
|
+
return (context) => {
|
|
6
6
|
context.on('before-fetch', client.extendHeaders);
|
|
7
7
|
return {
|
|
8
|
-
getAccessToken
|
|
8
|
+
getAccessToken() {
|
|
9
9
|
return client.token();
|
|
10
10
|
},
|
|
11
11
|
};
|
package/esm/create.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,MAAkB;IAC9C,OAAO,
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,MAAkB;IAC9C,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,OAAO,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC;QAEjD,OAAO;YACL,cAAc;gBACZ,OAAO,MAAM,CAAC,KAAK,EAAE,CAAC;YACxB,CAAC;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
package/esm/setup.d.ts
CHANGED
|
@@ -47,6 +47,26 @@ export interface AdalConfig {
|
|
|
47
47
|
* For more details see the MSAL.js documentation.
|
|
48
48
|
*/
|
|
49
49
|
framework?: any;
|
|
50
|
+
/**
|
|
51
|
+
* Determines whether or not the authority should be validated.
|
|
52
|
+
*/
|
|
53
|
+
validateAuthority?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Additional metadata to hand over.
|
|
56
|
+
*/
|
|
57
|
+
authorityMetadata?: string;
|
|
58
|
+
/**
|
|
59
|
+
* A list of known authorities to respect.
|
|
60
|
+
*/
|
|
61
|
+
knownAuthorities?: Array<string>;
|
|
62
|
+
/**
|
|
63
|
+
* Optionally decides where to redirect to in the logout case.
|
|
64
|
+
*/
|
|
65
|
+
postLogoutRedirectUri?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Determines if the URL for the login request should be navigated to.
|
|
68
|
+
*/
|
|
69
|
+
navigateToLoginRequestUrl?: boolean;
|
|
50
70
|
}
|
|
51
71
|
export interface AdalRequest {
|
|
52
72
|
/**
|
package/esm/setup.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
1
2
|
import { UserAgentApplication } from 'msal';
|
|
2
3
|
function retrieveToken(msalInstance, auth) {
|
|
3
4
|
if (msalInstance.getAccount()) {
|
|
4
5
|
return msalInstance
|
|
5
6
|
.acquireTokenSilent(auth)
|
|
6
|
-
.then(
|
|
7
|
-
.catch(
|
|
7
|
+
.then((response) => response.accessToken)
|
|
8
|
+
.catch((err) => {
|
|
8
9
|
if (err.name === 'InteractionRequiredAuthError') {
|
|
9
10
|
return msalInstance
|
|
10
11
|
.acquireTokenPopup(auth)
|
|
11
|
-
.then(
|
|
12
|
-
.catch(
|
|
12
|
+
.then((response) => response.accessToken)
|
|
13
|
+
.catch((err) => Promise.reject(err && err.message));
|
|
13
14
|
}
|
|
14
15
|
console.error(err);
|
|
15
16
|
return Promise.reject('Could not fetch token');
|
|
@@ -22,42 +23,36 @@ function retrieveToken(msalInstance, auth) {
|
|
|
22
23
|
* @param config The configuration for the client.
|
|
23
24
|
*/
|
|
24
25
|
export function setupAdalClient(config) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
auth: {
|
|
28
|
-
clientId: clientId,
|
|
29
|
-
redirectUri: redirectUri,
|
|
30
|
-
authority: authority,
|
|
31
|
-
},
|
|
26
|
+
const { redirectUri = `${location.origin}/auth`, restrict = false, scopes = ['User.Read'], storeAuthStateInCookie, cacheLocation = 'sessionStorage', framework, system } = config, remainingOptions = __rest(config, ["redirectUri", "restrict", "scopes", "storeAuthStateInCookie", "cacheLocation", "framework", "system"]);
|
|
27
|
+
const msalInstance = new UserAgentApplication({
|
|
28
|
+
auth: Object.assign({ redirectUri }, remainingOptions),
|
|
32
29
|
cache: {
|
|
33
|
-
storeAuthStateInCookie
|
|
34
|
-
cacheLocation
|
|
30
|
+
storeAuthStateInCookie,
|
|
31
|
+
cacheLocation,
|
|
35
32
|
},
|
|
36
|
-
system
|
|
37
|
-
framework
|
|
33
|
+
system,
|
|
34
|
+
framework,
|
|
38
35
|
});
|
|
39
|
-
|
|
40
|
-
msalInstance.handleRedirectCallback(
|
|
36
|
+
const tokenRequest = { scopes };
|
|
37
|
+
msalInstance.handleRedirectCallback(() => { });
|
|
41
38
|
return {
|
|
42
|
-
login
|
|
39
|
+
login() {
|
|
43
40
|
msalInstance.loginRedirect(tokenRequest);
|
|
44
41
|
},
|
|
45
|
-
logout
|
|
42
|
+
logout() {
|
|
46
43
|
msalInstance.logout();
|
|
47
44
|
},
|
|
48
|
-
account
|
|
45
|
+
account() {
|
|
49
46
|
return msalInstance.getAccount();
|
|
50
47
|
},
|
|
51
|
-
extendHeaders
|
|
48
|
+
extendHeaders(req) {
|
|
52
49
|
if (!restrict) {
|
|
53
|
-
req.setHeaders(retrieveToken(msalInstance, tokenRequest).then(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
};
|
|
57
|
-
}, function () { return undefined; }));
|
|
50
|
+
req.setHeaders(retrieveToken(msalInstance, tokenRequest).then((token) => token && {
|
|
51
|
+
Authorization: `Bearer ${token}`,
|
|
52
|
+
}, () => undefined));
|
|
58
53
|
}
|
|
59
54
|
},
|
|
60
|
-
token
|
|
55
|
+
token() {
|
|
61
56
|
return retrieveToken(msalInstance, tokenRequest);
|
|
62
57
|
},
|
|
63
58
|
};
|
package/esm/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAqC,MAAM,MAAM,CAAC;AAE/E,SAAS,aAAa,CAAC,YAAkC,EAAE,IAA8B;IACvF,IAAI,YAAY,CAAC,UAAU,EAAE,EAAE;QAC7B,OAAO,Y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S,CAAC;IACX,MAAM,YAAY,GAAG,IAAI,oBAAoB,CAAC;QAC5C,IAAI,kBACF,WAAW,IACR,gBAAgB,CACpB;QACD,KAAK,EAAE;YACL,sBAAsB;YACtB,aAAa;SACd;QACD,MAAM;QACN,SAAS;KACV,CAAC,CAAC;IACH,MAAM,YAAY,GAAG,EAAE,MAAM,EAAE,CAAC;IAChC,YAAY,CAAC,sBAAsB,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAC9C,OAAO;QACL,KAAK;YACH,YAAY,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QAC3C,CAAC;QACD,MAAM;YACJ,YAAY,CAAC,MAAM,EAAE,CAAC;QACxB,CAAC;QACD,OAAO;YACL,OAAO,YAAY,CAAC,UAAU,EAAE,CAAC;QACnC,CAAC;QACD,aAAa,CAAC,GAAG;YACf,IAAI,CAAC,QAAQ,EAAE;gBACb,GAAG,CAAC,UAAU,CACZ,aAAa,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC,IAAI,CAC5C,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,IAAI;oBACP,aAAa,EAAE,UAAU,KAAK,EAAE;iBACjC,EACH,GAAG,EAAE,CAAC,SAAS,CAChB,CACF,CAAC;aACH;QACH,CAAC;QACD,KAAK;YACH,OAAO,aAAa,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QACnD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/lib/create.js
CHANGED
|
@@ -5,10 +5,10 @@ exports.createAdalApi = void 0;
|
|
|
5
5
|
* Creates new Pilet API extensions for the integration of MSAL.
|
|
6
6
|
*/
|
|
7
7
|
function createAdalApi(client) {
|
|
8
|
-
return
|
|
8
|
+
return (context) => {
|
|
9
9
|
context.on('before-fetch', client.extendHeaders);
|
|
10
10
|
return {
|
|
11
|
-
getAccessToken
|
|
11
|
+
getAccessToken() {
|
|
12
12
|
return client.token();
|
|
13
13
|
},
|
|
14
14
|
};
|
package/lib/create.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":";;;AAIA;;GAEG;AACH,SAAgB,aAAa,CAAC,MAAkB;IAC9C,OAAO,
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":";;;AAIA;;GAEG;AACH,SAAgB,aAAa,CAAC,MAAkB;IAC9C,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,OAAO,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC;QAEjD,OAAO;YACL,cAAc;gBACZ,OAAO,MAAM,CAAC,KAAK,EAAE,CAAC;YACxB,CAAC;SACF,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAVD,sCAUC"}
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
tslib_1.__exportStar(require("./create"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./setup"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./types"), exports);
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
(0, tslib_1.__exportStar)(require("./create"), exports);
|
|
5
|
+
(0, tslib_1.__exportStar)(require("./setup"), exports);
|
|
6
|
+
(0, tslib_1.__exportStar)(require("./types"), exports);
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,wDAAyB;AACzB,uDAAwB;AACxB,uDAAwB"}
|
package/lib/setup.d.ts
CHANGED
|
@@ -47,6 +47,26 @@ export interface AdalConfig {
|
|
|
47
47
|
* For more details see the MSAL.js documentation.
|
|
48
48
|
*/
|
|
49
49
|
framework?: any;
|
|
50
|
+
/**
|
|
51
|
+
* Determines whether or not the authority should be validated.
|
|
52
|
+
*/
|
|
53
|
+
validateAuthority?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Additional metadata to hand over.
|
|
56
|
+
*/
|
|
57
|
+
authorityMetadata?: string;
|
|
58
|
+
/**
|
|
59
|
+
* A list of known authorities to respect.
|
|
60
|
+
*/
|
|
61
|
+
knownAuthorities?: Array<string>;
|
|
62
|
+
/**
|
|
63
|
+
* Optionally decides where to redirect to in the logout case.
|
|
64
|
+
*/
|
|
65
|
+
postLogoutRedirectUri?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Determines if the URL for the login request should be navigated to.
|
|
68
|
+
*/
|
|
69
|
+
navigateToLoginRequestUrl?: boolean;
|
|
50
70
|
}
|
|
51
71
|
export interface AdalRequest {
|
|
52
72
|
/**
|
package/lib/setup.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setupAdalClient = void 0;
|
|
4
|
-
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const msal_1 = require("msal");
|
|
5
6
|
function retrieveToken(msalInstance, auth) {
|
|
6
7
|
if (msalInstance.getAccount()) {
|
|
7
8
|
return msalInstance
|
|
8
9
|
.acquireTokenSilent(auth)
|
|
9
|
-
.then(
|
|
10
|
-
.catch(
|
|
10
|
+
.then((response) => response.accessToken)
|
|
11
|
+
.catch((err) => {
|
|
11
12
|
if (err.name === 'InteractionRequiredAuthError') {
|
|
12
13
|
return msalInstance
|
|
13
14
|
.acquireTokenPopup(auth)
|
|
14
|
-
.then(
|
|
15
|
-
.catch(
|
|
15
|
+
.then((response) => response.accessToken)
|
|
16
|
+
.catch((err) => Promise.reject(err && err.message));
|
|
16
17
|
}
|
|
17
18
|
console.error(err);
|
|
18
19
|
return Promise.reject('Could not fetch token');
|
|
@@ -25,42 +26,36 @@ function retrieveToken(msalInstance, auth) {
|
|
|
25
26
|
* @param config The configuration for the client.
|
|
26
27
|
*/
|
|
27
28
|
function setupAdalClient(config) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
auth: {
|
|
31
|
-
clientId: clientId,
|
|
32
|
-
redirectUri: redirectUri,
|
|
33
|
-
authority: authority,
|
|
34
|
-
},
|
|
29
|
+
const { redirectUri = `${location.origin}/auth`, restrict = false, scopes = ['User.Read'], storeAuthStateInCookie, cacheLocation = 'sessionStorage', framework, system } = config, remainingOptions = (0, tslib_1.__rest)(config, ["redirectUri", "restrict", "scopes", "storeAuthStateInCookie", "cacheLocation", "framework", "system"]);
|
|
30
|
+
const msalInstance = new msal_1.UserAgentApplication({
|
|
31
|
+
auth: Object.assign({ redirectUri }, remainingOptions),
|
|
35
32
|
cache: {
|
|
36
|
-
storeAuthStateInCookie
|
|
37
|
-
cacheLocation
|
|
33
|
+
storeAuthStateInCookie,
|
|
34
|
+
cacheLocation,
|
|
38
35
|
},
|
|
39
|
-
system
|
|
40
|
-
framework
|
|
36
|
+
system,
|
|
37
|
+
framework,
|
|
41
38
|
});
|
|
42
|
-
|
|
43
|
-
msalInstance.handleRedirectCallback(
|
|
39
|
+
const tokenRequest = { scopes };
|
|
40
|
+
msalInstance.handleRedirectCallback(() => { });
|
|
44
41
|
return {
|
|
45
|
-
login
|
|
42
|
+
login() {
|
|
46
43
|
msalInstance.loginRedirect(tokenRequest);
|
|
47
44
|
},
|
|
48
|
-
logout
|
|
45
|
+
logout() {
|
|
49
46
|
msalInstance.logout();
|
|
50
47
|
},
|
|
51
|
-
account
|
|
48
|
+
account() {
|
|
52
49
|
return msalInstance.getAccount();
|
|
53
50
|
},
|
|
54
|
-
extendHeaders
|
|
51
|
+
extendHeaders(req) {
|
|
55
52
|
if (!restrict) {
|
|
56
|
-
req.setHeaders(retrieveToken(msalInstance, tokenRequest).then(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
};
|
|
60
|
-
}, function () { return undefined; }));
|
|
53
|
+
req.setHeaders(retrieveToken(msalInstance, tokenRequest).then((token) => token && {
|
|
54
|
+
Authorization: `Bearer ${token}`,
|
|
55
|
+
}, () => undefined));
|
|
61
56
|
}
|
|
62
57
|
},
|
|
63
|
-
token
|
|
58
|
+
token() {
|
|
64
59
|
return retrieveToken(msalInstance, tokenRequest);
|
|
65
60
|
},
|
|
66
61
|
};
|
package/lib/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":";;;;AAAA,+BAA+E;AAE/E,SAAS,aAAa,CAAC,YAAkC,EAAE,IAA8B;IACvF,IAAI,YAAY,CAAC,UAAU,EAAE,EAAE;QAC7B,OAAO,YAAY;aAChB,kBAAkB,CAAC,IAAI,CAAC;aACxB,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC;aACxC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACb,IAAI,GAAG,CAAC,IAAI,KAAK,8BAA8B,EAAE;gBAC/C,OAAO,YAAY;qBAChB,iBAAiB,CAAC,IAAI,CAAC;qBACvB,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC;qBACxC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;aACvD;YAED,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACnB,OAAO,OAAO,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;KACN;IAED,OAAO,OAAO,CAAC,M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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-adal",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0-beta.3156",
|
|
4
4
|
"description": "Plugin to integrate AAD authentication in Piral.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"msal": "^1.1.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"piral-core": "^0.
|
|
50
|
+
"piral-core": "^0.14.0-beta.3156"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"piral-core": "0.
|
|
53
|
+
"piral-core": "0.14.x"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "e368a181defdfca4722d7bd478a9dcd47d90a51b"
|
|
56
56
|
}
|
package/src/setup.ts
CHANGED
|
@@ -69,6 +69,26 @@ export interface AdalConfig {
|
|
|
69
69
|
* For more details see the MSAL.js documentation.
|
|
70
70
|
*/
|
|
71
71
|
framework?: any;
|
|
72
|
+
/**
|
|
73
|
+
* Determines whether or not the authority should be validated.
|
|
74
|
+
*/
|
|
75
|
+
validateAuthority?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Additional metadata to hand over.
|
|
78
|
+
*/
|
|
79
|
+
authorityMetadata?: string;
|
|
80
|
+
/**
|
|
81
|
+
* A list of known authorities to respect.
|
|
82
|
+
*/
|
|
83
|
+
knownAuthorities?: Array<string>;
|
|
84
|
+
/**
|
|
85
|
+
* Optionally decides where to redirect to in the logout case.
|
|
86
|
+
*/
|
|
87
|
+
postLogoutRedirectUri?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Determines if the URL for the login request should be navigated to.
|
|
90
|
+
*/
|
|
91
|
+
navigateToLoginRequestUrl?: boolean;
|
|
72
92
|
}
|
|
73
93
|
|
|
74
94
|
export interface AdalRequest {
|
|
@@ -108,8 +128,6 @@ export interface AdalClient {
|
|
|
108
128
|
*/
|
|
109
129
|
export function setupAdalClient(config: AdalConfig): AdalClient {
|
|
110
130
|
const {
|
|
111
|
-
clientId,
|
|
112
|
-
authority,
|
|
113
131
|
redirectUri = `${location.origin}/auth`,
|
|
114
132
|
restrict = false,
|
|
115
133
|
scopes = ['User.Read'],
|
|
@@ -117,12 +135,12 @@ export function setupAdalClient(config: AdalConfig): AdalClient {
|
|
|
117
135
|
cacheLocation = 'sessionStorage',
|
|
118
136
|
framework,
|
|
119
137
|
system,
|
|
138
|
+
...remainingOptions
|
|
120
139
|
} = config;
|
|
121
140
|
const msalInstance = new UserAgentApplication({
|
|
122
141
|
auth: {
|
|
123
|
-
clientId,
|
|
124
142
|
redirectUri,
|
|
125
|
-
|
|
143
|
+
...remainingOptions,
|
|
126
144
|
},
|
|
127
145
|
cache: {
|
|
128
146
|
storeAuthStateInCookie,
|