@azure/msal-node 1.0.0-alpha.8 → 1.0.0-beta.2

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/changelog.md CHANGED
@@ -1,79 +1,170 @@
1
- # Change Log - @azure/msal-node
2
-
3
- This log was last generated on Wed, 23 Sep 2020 21:13:48 GMT and should not be manually modified.
4
-
5
- <!-- Start content -->
6
-
7
- ## 1.0.0-alpha.7
8
-
9
- Wed, 23 Sep 2020 21:13:48 GMT
10
-
11
- ### Changes
12
- - Make network interface public (#2335) (sameera.gajjarapu@microsoft.com)
13
- - Rename TokenCache.cacheHasChanged to TokenCache.hasChanged (#2332) (sagonzal@microsoft.com)
14
- - FOCI - Family of Client IDs feature (#2201) (sameera.gajjarapu@microsoft.com)
15
- - Fix issue with token cache not removing old cache entities (#2304) (sagonzal@microsoft.com)
16
-
17
- ## 1.0.0-alpha.6
18
-
19
- Thu, 17 Sep 2020 23:16:22 GMT
20
-
21
- ### Changes
22
-
23
- - Address tsdx warnings (#2202) (thomas.norling@microsoft.com)
24
- - Implement Telemetry in msal-node (#1921) (thomas.norling@microsoft.com)
25
- - Changes node storage: getItem(), setItem() and removeItem() simplified and no longer need a 'type' (sameera.gajjarapu@microsoft.com)
26
- - Add support for on-behalf-of flow (sagonzal@microsoft.com)
27
-
28
- ## 1.0.0-alpha.5
29
-
30
- Tue, 25 Aug 2020 00:40:45 GMT
31
-
32
- ### Changes
33
-
34
- - update APP_META_DATA to APP_METADATA (sameera.gajjarapu@microsoft.com)
35
- - Client Capabilities Support (#2169) (thomas.norling@microsoft.com)
36
- - Remove log statement (email not defined)
37
- - undefined (sagonzal@microsoft.com)
38
-
39
- # 1.0.0-alpha.4
40
- - Add confidential client support (#2023)
41
-
42
- # 1.0.0-alpha.3
43
- - Fix an issue where the types were not defined correctly in the package.json (#2014)
44
-
45
- # 1.0.0-alpha.2
46
- - Fix an issue where the `dist` folder was not published (#2013)
47
-
48
- # 1.0.0-alpha.1
49
-
50
- - Add `response` to device code in `msal-node` (#1947)
51
- - `msal-node` docs update (#1948)
52
- - Export `AccountInfo` in `msal-node (#2005)
53
-
54
- # 1.0.0-alpha.0
55
-
56
- - scaffolding (#1328)
57
- - Configuration and Client (#1325)
58
- - Account and Authority (#1330)
59
- - initial compatibility with other libs (#1342)
60
- - `msal-node` crypto module (#1368)
61
- - `msal-node` network module (#1371)
62
- - `msal-node` lerna support (#1383)
63
- - `msal-common` and `msal-node` Client applications, authorization code and device code flow (#1409)
64
- - `msal-node` add DEBUG logging (#1423)
65
- - `msal-common` authority changes (#1424)
66
- - `msal-node` and `msal-common` unit tests for changes in #1409 (#1449)
67
- - `msal-node` switch `strictNullChecks:true` for msal-node (#1478)
68
- - `msal-node` and `msal-common` Update generation of client info headers (#1482)
69
- - `msal-node` and `msal-common` Support for acquiring a token with refresh token (#1496)
70
- - `msal-node` and `msal-common` Move authority generation from common to node (#1537)
71
- - `msal-node` fix casing issue (#1630)
72
- - `msal-node` Cache implementation (#1444, #1471, #1519, #1520, #1522, #1622, #1655, #1680)
73
- - `msal-node` Silent Flow support (#1711)
74
- - merge cache logic for all platforms (#1762)
75
- - Utilize ScopeSet across the library (#1770)
76
- - Update UnifiedCacheManager.ts (#1771)
77
- - Node cache interface (#1801)
78
- - SilentFlow node interface (#1809)
79
- - Update TokenCache name (#1901)
1
+ # Change Log - @azure/msal-node
2
+
3
+ This log was last generated on Mon, 07 Dec 2020 22:19:03 GMT and should not be manually modified.
4
+
5
+ <!-- Start content -->
6
+
7
+ ## 1.0.0-beta.2
8
+
9
+ Mon, 07 Dec 2020 22:19:03 GMT
10
+
11
+ ### Changes
12
+
13
+ - Expose idTokenClaims on AccountInfo (#2554) (janutter@microsoft.com)
14
+ - Add null to API response signatures (#2602) (thomas.norling@microsoft.com)
15
+ - Enforce triple equals in eslint (janutter@microsoft.com)
16
+ - Log messages contain package name and version (#2589) (thomas.norling@microsoft.com)
17
+ - Update request types (#2512) (thomas.norling@microsoft.com)
18
+
19
+ ## 1.0.0-beta.1
20
+
21
+ Wed, 11 Nov 2020 23:33:20 GMT
22
+
23
+ ### Changes
24
+
25
+ - Add support for SubjectName/Issuer authentication (#2471). (jamckenn@microsoft.com)
26
+
27
+ ## 1.0.0-alpha.16
28
+
29
+ Tue, 10 Nov 2020 01:48:44 GMT
30
+
31
+ ### Changes
32
+
33
+ - Enhance lookup for IdTokens/AppMetadata (#2530) (sameera.gajjarapu@microsoft.com)
34
+
35
+ ## 1.0.0-alpha.15
36
+
37
+ Sat, 07 Nov 2020 01:50:14 GMT
38
+
39
+ ### Changes
40
+
41
+ - Fixing a bug and adding `localAccountId` in AccountInfo interface (#2516) (sameera.gajjarapu@microsoft.com)
42
+ - Filtered lookup of IdTokens, AppMetadata; Error handling in Node Storage (#2530) (sameera.gajjarapu@microsoft.com)
43
+ - Implement Password Grant Flow (#2204) (sameera.gajjarapu@microsoft.com)
44
+
45
+ ## 1.0.0-alpha.14
46
+
47
+ Mon, 02 Nov 2020 23:33:39 GMT
48
+
49
+ ### Changes
50
+
51
+ - Add getLogger and setLogger to msal-node (#2520) (joarroyo@microsoft.com)
52
+ - Remove `debug` from the `msal-node` library (#2496) (sameera.gajjarapu@microsoft.com)
53
+
54
+ ## 1.0.0-alpha.13
55
+
56
+ Mon, 26 Oct 2020 21:00:29 GMT
57
+
58
+ ### Changes
59
+
60
+ - msal-browser and msal-node cache Interfaces to msal-common updated (#2415) (sameera.gajjarapu@microsoft.com)
61
+ - Export Node Cache Serializer for use in end-to-end testing framework (#2414) (hemoral@microsoft.com)
62
+
63
+ ## 1.0.0-alpha.12
64
+
65
+ Tue, 20 Oct 2020 23:47:28 GMT
66
+
67
+ ### Changes
68
+
69
+ - Adds support for any OIDC-compliant authority (#2389). (jamckenn@microsoft.com)
70
+
71
+ ## 1.0.0-alpha.11
72
+
73
+ Thu, 15 Oct 2020 00:49:18 GMT
74
+
75
+ ### Changes
76
+
77
+ - Export all "Request" types in msal-node (sameera.gajjarapu@microsoft.com)
78
+
79
+ ## 1.0.0-alpha.10
80
+
81
+ Wed, 14 Oct 2020 23:45:07 GMT
82
+
83
+ ### Changes
84
+
85
+ - Docs update for msal-node release (sameera.gajjarapu@microsoft.com)
86
+ - Export error types for msal-node (sameera.gajjarapu@microsoft.com)
87
+ - Add uuid as dependency in msal-node package.json so it is installed with the library (hectormgdev@gmail.com)
88
+ - Update TokenCache interface (#2348) (sameera.gajjarapu@microsoft.com)
89
+
90
+ ## 1.0.0-alpha.9
91
+
92
+ Fri, 02 Oct 2020 17:42:35 GMT
93
+
94
+ ### Changes
95
+
96
+ - Dummy implementation of access token proof-of-possession (prkanher@microsoft.com)
97
+
98
+ ## 1.0.0-alpha.7
99
+
100
+ Wed, 23 Sep 2020 21:13:48 GMT
101
+
102
+ ### Changes
103
+ - Make network interface public (#2335) (sameera.gajjarapu@microsoft.com)
104
+ - Rename TokenCache.cacheHasChanged to TokenCache.hasChanged (#2332) (sagonzal@microsoft.com)
105
+ - FOCI - Family of Client IDs feature (#2201) (sameera.gajjarapu@microsoft.com)
106
+ - Fix issue with token cache not removing old cache entities (#2304) (sagonzal@microsoft.com)
107
+
108
+ ## 1.0.0-alpha.6
109
+
110
+ Thu, 17 Sep 2020 23:16:22 GMT
111
+
112
+ ### Changes
113
+
114
+ - Address tsdx warnings (#2202) (thomas.norling@microsoft.com)
115
+ - Implement Telemetry in msal-node (#1921) (thomas.norling@microsoft.com)
116
+ - Changes node storage: getItem(), setItem() and removeItem() simplified and no longer need a 'type' (sameera.gajjarapu@microsoft.com)
117
+ - Add support for on-behalf-of flow (sagonzal@microsoft.com)
118
+
119
+ ## 1.0.0-alpha.5
120
+
121
+ Tue, 25 Aug 2020 00:40:45 GMT
122
+
123
+ ### Changes
124
+
125
+ - update APP_META_DATA to APP_METADATA (sameera.gajjarapu@microsoft.com)
126
+ - Client Capabilities Support (#2169) (thomas.norling@microsoft.com)
127
+ - Remove log statement (email not defined)
128
+ - undefined (sagonzal@microsoft.com)
129
+
130
+ # 1.0.0-alpha.4
131
+ - Add confidential client support (#2023)
132
+
133
+ # 1.0.0-alpha.3
134
+ - Fix an issue where the types were not defined correctly in the package.json (#2014)
135
+
136
+ # 1.0.0-alpha.2
137
+ - Fix an issue where the `dist` folder was not published (#2013)
138
+
139
+ # 1.0.0-alpha.1
140
+
141
+ - Add `response` to device code in `msal-node` (#1947)
142
+ - `msal-node` docs update (#1948)
143
+ - Export `AccountInfo` in `msal-node (#2005)
144
+
145
+ # 1.0.0-alpha.0
146
+
147
+ - scaffolding (#1328)
148
+ - Configuration and Client (#1325)
149
+ - Account and Authority (#1330)
150
+ - initial compatibility with other libs (#1342)
151
+ - `msal-node` crypto module (#1368)
152
+ - `msal-node` network module (#1371)
153
+ - `msal-node` lerna support (#1383)
154
+ - `msal-common` and `msal-node` Client applications, authorization code and device code flow (#1409)
155
+ - `msal-node` add DEBUG logging (#1423)
156
+ - `msal-common` authority changes (#1424)
157
+ - `msal-node` and `msal-common` unit tests for changes in #1409 (#1449)
158
+ - `msal-node` switch `strictNullChecks:true` for msal-node (#1478)
159
+ - `msal-node` and `msal-common` Update generation of client info headers (#1482)
160
+ - `msal-node` and `msal-common` Support for acquiring a token with refresh token (#1496)
161
+ - `msal-node` and `msal-common` Move authority generation from common to node (#1537)
162
+ - `msal-node` fix casing issue (#1630)
163
+ - `msal-node` Cache implementation (#1444, #1471, #1519, #1520, #1522, #1622, #1655, #1680)
164
+ - `msal-node` Silent Flow support (#1711)
165
+ - merge cache logic for all platforms (#1762)
166
+ - Utilize ScopeSet across the library (#1770)
167
+ - Update UnifiedCacheManager.ts (#1771)
168
+ - Node cache interface (#1801)
169
+ - SilentFlow node interface (#1809)
170
+ - Update TokenCache name (#1901)
@@ -1,4 +1,4 @@
1
- import { CacheManager, Logger, ValidCacheType } from "@azure/msal-common";
1
+ import { AccountEntity, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, ServerTelemetryEntity, ThrottlingEntity, CacheManager, Logger, ValidCacheType, ICrypto } from "@azure/msal-common";
2
2
  import { InMemoryCache, JsonCache, CacheKVStore } from "./serializer/SerializerTypes";
3
3
  /**
4
4
  * This class implements Storage for node, reading cache from user specified storage location or an extension library
@@ -7,7 +7,7 @@ export declare class Storage extends CacheManager {
7
7
  private logger;
8
8
  private cache;
9
9
  private changeEmitters;
10
- constructor(logger: Logger);
10
+ constructor(logger: Logger, clientId: string, cryptoImpl: ICrypto);
11
11
  registerChangeEmitter(func: () => void): void;
12
12
  emitChange(): void;
13
13
  /**
@@ -38,6 +38,11 @@ export declare class Storage extends CacheManager {
38
38
  * @param cacheMap
39
39
  */
40
40
  setCache(cache: CacheKVStore): void;
41
+ /**
42
+ * Gets cache item with given key.
43
+ * @param key
44
+ */
45
+ getItem(key: string): ValidCacheType;
41
46
  /**
42
47
  * Gets cache item with given <key, value>
43
48
  * @param key
@@ -45,10 +50,77 @@ export declare class Storage extends CacheManager {
45
50
  */
46
51
  setItem(key: string, value: ValidCacheType): void;
47
52
  /**
48
- * Gets cache item with given key.
49
- * @param key
53
+ * fetch the account entity
54
+ * @param accountKey
50
55
  */
51
- getItem(key: string): ValidCacheType;
56
+ getAccount(accountKey: string): AccountEntity | null;
57
+ /**
58
+ * set account entity
59
+ * @param account
60
+ */
61
+ setAccount(account: AccountEntity): void;
62
+ /**
63
+ * fetch the idToken credential
64
+ * @param idTokenKey
65
+ */
66
+ getIdTokenCredential(idTokenKey: string): IdTokenEntity | null;
67
+ /**
68
+ * set idToken credential
69
+ * @param idToken
70
+ */
71
+ setIdTokenCredential(idToken: IdTokenEntity): void;
72
+ /**
73
+ * fetch the accessToken credential
74
+ * @param accessTokenKey
75
+ */
76
+ getAccessTokenCredential(accessTokenKey: string): AccessTokenEntity | null;
77
+ /**
78
+ * set accessToken credential
79
+ * @param accessToken
80
+ */
81
+ setAccessTokenCredential(accessToken: AccessTokenEntity): void;
82
+ /**
83
+ * fetch the refreshToken credential
84
+ * @param refreshTokenKey
85
+ */
86
+ getRefreshTokenCredential(refreshTokenKey: string): RefreshTokenEntity | null;
87
+ /**
88
+ * set refreshToken credential
89
+ * @param refreshToken
90
+ */
91
+ setRefreshTokenCredential(refreshToken: RefreshTokenEntity): void;
92
+ /**
93
+ * fetch appMetadata entity from the platform cache
94
+ * @param appMetadataKey
95
+ */
96
+ getAppMetadata(appMetadataKey: string): AppMetadataEntity | null;
97
+ /**
98
+ * set appMetadata entity to the platform cache
99
+ * @param appMetadata
100
+ */
101
+ setAppMetadata(appMetadata: AppMetadataEntity): void;
102
+ /**
103
+ * fetch server telemetry entity from the platform cache
104
+ * @param serverTelemetrykey
105
+ */
106
+ getServerTelemetry(serverTelemetrykey: string): ServerTelemetryEntity | null;
107
+ /**
108
+ * set server telemetry entity to the platform cache
109
+ * @param serverTelemetryKey
110
+ * @param serverTelemetry
111
+ */
112
+ setServerTelemetry(serverTelemetryKey: string, serverTelemetry: ServerTelemetryEntity): void;
113
+ /**
114
+ * fetch throttling entity from the platform cache
115
+ * @param throttlingCacheKey
116
+ */
117
+ getThrottlingCache(throttlingCacheKey: string): ThrottlingEntity | null;
118
+ /**
119
+ * set throttling entity to the platform cache
120
+ * @param throttlingCacheKey
121
+ * @param throttlingCache
122
+ */
123
+ setThrottlingCache(throttlingCacheKey: string, throttlingCache: ThrottlingEntity): void;
52
124
  /**
53
125
  * Removes the cache item from memory with the given key.
54
126
  * @param key
@@ -1,10 +1,9 @@
1
1
  import { Storage } from "./Storage";
2
- import { AccountInfo, Logger } from "@azure/msal-common";
3
- import { ICachePlugin } from "./ICachePlugin";
2
+ import { AccountInfo, Logger, ISerializableTokenCache, ICachePlugin } from "@azure/msal-common";
4
3
  /**
5
4
  * In-memory token cache manager
6
5
  */
7
- export declare class TokenCache {
6
+ export declare class TokenCache implements ISerializableTokenCache {
8
7
  private storage;
9
8
  private cacheHasChanged;
10
9
  private cacheSnapshot;
@@ -25,23 +24,28 @@ export declare class TokenCache {
25
24
  */
26
25
  deserialize(cache: string): void;
27
26
  /**
28
- * Serializes cache into JSON and calls ICachePlugin.writeToStorage. ICachePlugin must be set on ClientApplication
27
+ * API that retrieves all accounts currently in cache to the user
29
28
  */
30
- writeToPersistence(): Promise<void>;
29
+ getAllAccounts(): Promise<AccountInfo[]>;
31
30
  /**
32
- * Calls ICachePlugin.readFromStorage and deserializes JSON to in-memory cache.
33
- * ICachePlugin must be set on ClientApplication.
31
+ * Returns the signed in account matching homeAccountId.
32
+ * (the account object is created at the time of successful login)
33
+ * or null when no matching account is found
34
+ * @returns {@link AccountInfo} - the account object stored in MSAL
34
35
  */
35
- readFromPersistence(): Promise<void>;
36
+ getAccountByHomeId(homeAccountId: string): Promise<AccountInfo | null>;
36
37
  /**
37
- * API that retrieves all accounts currently in cache to the user
38
+ * Returns the signed in account matching localAccountId.
39
+ * (the account object is created at the time of successful login)
40
+ * or null when no matching account is found
41
+ * @returns {@link AccountInfo} - the account object stored in MSAL
38
42
  */
39
- getAllAccounts(): AccountInfo[];
43
+ getAccountByLocalId(localAccountId: string): Promise<AccountInfo | null>;
40
44
  /**
41
45
  * API to remove a specific account and the relevant data from cache
42
46
  * @param account
43
47
  */
44
- removeAccount(account: AccountInfo): void;
48
+ removeAccount(account: AccountInfo): Promise<void>;
45
49
  /**
46
50
  * Called when the cache has changed state.
47
51
  */
@@ -1,8 +1,12 @@
1
- import { AuthorizationUrlRequest, AuthorizationCodeRequest, ClientConfiguration, RefreshTokenRequest, AuthenticationResult, BaseAuthRequest, SilentFlowRequest, Logger, ServerTelemetryManager } from "@azure/msal-common";
1
+ import { ClientConfiguration, AuthenticationResult, BaseAuthRequest, Logger, ServerTelemetryManager } from "@azure/msal-common";
2
2
  import { Configuration } from "../config/Configuration";
3
3
  import { Storage } from "../cache/Storage";
4
4
  import { TokenCache } from "../cache/TokenCache";
5
- import { ClientAssertion } from "../client/ClientAssertion";
5
+ import { ClientAssertion } from "./ClientAssertion";
6
+ import { AuthorizationUrlRequest } from "../request/AuthorizationUrlRequest";
7
+ import { AuthorizationCodeRequest } from "../request/AuthorizationCodeRequest";
8
+ import { RefreshTokenRequest } from "../request/RefreshTokenRequest";
9
+ import { SilentFlowRequest } from "../request/SilentFlowRequest";
6
10
  export declare abstract class ClientApplication {
7
11
  private _authority;
8
12
  private readonly cryptoProvider;
@@ -34,7 +38,7 @@ export declare abstract class ClientApplication {
34
38
  * Authorization Code flow. Ensure that values for redirectUri and scopes in AuthorizationCodeUrlRequest and
35
39
  * AuthorizationCodeRequest are the same.
36
40
  */
37
- acquireTokenByCode(request: AuthorizationCodeRequest): Promise<AuthenticationResult>;
41
+ acquireTokenByCode(request: AuthorizationCodeRequest): Promise<AuthenticationResult | null>;
38
42
  /**
39
43
  * Acquires a token by exchanging the refresh token provided for a new set of tokens.
40
44
  *
@@ -42,7 +46,7 @@ export declare abstract class ClientApplication {
42
46
  * recommended that you use `acquireTokenSilent()` for silent scenarios. When using `acquireTokenSilent()`, MSAL will
43
47
  * handle the caching and refreshing of tokens automatically.
44
48
  */
45
- acquireTokenByRefreshToken(request: RefreshTokenRequest): Promise<AuthenticationResult>;
49
+ acquireTokenByRefreshToken(request: RefreshTokenRequest): Promise<AuthenticationResult | null>;
46
50
  /**
47
51
  * Acquires a token silently when a user specifies the account the token is requested for.
48
52
  *
@@ -51,18 +55,27 @@ export declare abstract class ClientApplication {
51
55
  * In case the refresh_token is expired or not found, an error is thrown
52
56
  * and the guidance is for the user to call any interactive token acquisition API (eg: `acquireTokenByCode()`).
53
57
  */
54
- acquireTokenSilent(request: SilentFlowRequest): Promise<AuthenticationResult>;
58
+ acquireTokenSilent(request: SilentFlowRequest): Promise<AuthenticationResult | null>;
55
59
  /**
56
60
  * Gets the token cache for the application.
57
61
  */
58
62
  getTokenCache(): TokenCache;
59
- protected buildOauthClientConfiguration(authority?: string, serverTelemetryManager?: ServerTelemetryManager): Promise<ClientConfiguration>;
63
+ /**
64
+ * Returns the logger instance
65
+ */
66
+ getLogger(): Logger;
67
+ /**
68
+ * Replaces the default logger set in configurations with new Logger with new configurations
69
+ * @param logger Logger instance
70
+ */
71
+ setLogger(logger: Logger): void;
72
+ protected buildOauthClientConfiguration(authority: string, serverTelemetryManager?: ServerTelemetryManager): Promise<ClientConfiguration>;
60
73
  private getClientAssertion;
61
74
  /**
62
75
  * Generates a request with the default scopes & generates a correlationId.
63
76
  * @param authRequest
64
77
  */
65
- protected initializeRequest(authRequest: BaseAuthRequest): BaseAuthRequest;
78
+ protected initializeBaseRequest(authRequest: Partial<BaseAuthRequest>): BaseAuthRequest;
66
79
  protected initializeServerTelemetryManager(apiId: number, correlationId: string, forceRefresh?: boolean): ServerTelemetryManager;
67
80
  /**
68
81
  * Create authority instance. If authority not passed in request, default to authority set on the application
@@ -9,9 +9,15 @@ export declare class ClientAssertion {
9
9
  private expirationTime;
10
10
  private issuer;
11
11
  private jwtAudience;
12
+ private publicCertificate;
12
13
  static fromAssertion(assertion: string): ClientAssertion;
13
- static fromCertificate(thumbprint: string, privateKey: string): ClientAssertion;
14
+ static fromCertificate(thumbprint: string, privateKey: string, publicCertificate?: string): ClientAssertion;
14
15
  getJwt(cryptoProvider: CryptoProvider, issuer: string, jwtAudience: string): string;
15
16
  private createJwt;
16
17
  private isExpired;
18
+ /**
19
+ * Extracts the raw certs from a given certificate string and returns them in an array.
20
+ * @param publicCertificate
21
+ */
22
+ static parseCertificate(publicCertificate: string): Array<string>;
17
23
  }
@@ -1,6 +1,8 @@
1
1
  import { ClientApplication } from "./ClientApplication";
2
2
  import { Configuration } from "../config/Configuration";
3
- import { ClientCredentialRequest, OnBehalfOfRequest, AuthenticationResult } from "@azure/msal-common";
3
+ import { AuthenticationResult } from "@azure/msal-common";
4
+ import { OnBehalfOfRequest } from "../request/OnBehalfOfRequest";
5
+ import { ClientCredentialRequest } from "../request/ClientCredentialRequest";
4
6
  export declare class ConfidentialClientApplication extends ClientApplication {
5
7
  /**
6
8
  * @constructor
@@ -26,7 +28,7 @@ export declare class ConfidentialClientApplication extends ClientApplication {
26
28
  /**
27
29
  * Acquires tokens from the authority for the application (not for an end user).
28
30
  */
29
- acquireTokenByClientCredential(request: ClientCredentialRequest): Promise<AuthenticationResult>;
31
+ acquireTokenByClientCredential(request: ClientCredentialRequest): Promise<AuthenticationResult | null>;
30
32
  /**
31
33
  * Acquires tokens from the authority for the application.
32
34
  *
@@ -38,6 +40,6 @@ export declare class ConfidentialClientApplication extends ClientApplication {
38
40
  * See how to gain consent upfront for your middle-tier app from this article.
39
41
  * https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow#gaining-consent-for-the-middle-tier-application
40
42
  */
41
- acquireTokenOnBehalfOf(request: OnBehalfOfRequest): Promise<AuthenticationResult>;
43
+ acquireTokenOnBehalfOf(request: OnBehalfOfRequest): Promise<AuthenticationResult | null>;
42
44
  private setClientCredential;
43
45
  }
@@ -1,6 +1,8 @@
1
- import { DeviceCodeRequest, AuthenticationResult } from "@azure/msal-common";
1
+ import { AuthenticationResult } from "@azure/msal-common";
2
2
  import { Configuration } from "../config/Configuration";
3
3
  import { ClientApplication } from "./ClientApplication";
4
+ import { DeviceCodeRequest } from "../request/DeviceCodeRequest";
5
+ import { UsernamePasswordRequest } from "../request/UsernamePasswordRequest";
4
6
  /**
5
7
  * This class is to be used to acquire tokens for public client applications (desktop, mobile). Public client applications
6
8
  * are not trusted to safely store application secrets, and therefore can only request tokens in the name of an user.
@@ -33,5 +35,16 @@ export declare class PublicClientApplication extends ClientApplication {
33
35
  * Since the client cannot receive incoming requests, it polls the authorization server repeatedly
34
36
  * until the end-user completes input of credentials.
35
37
  */
36
- acquireTokenByDeviceCode(request: DeviceCodeRequest): Promise<AuthenticationResult>;
38
+ acquireTokenByDeviceCode(request: DeviceCodeRequest): Promise<AuthenticationResult | null>;
39
+ /**
40
+ * Acquires tokens with password grant by exchanging client applications username and password for credentials
41
+ *
42
+ * The latest OAuth 2.0 Security Best Current Practice disallows the password grant entirely.
43
+ * More details on this recommendation at https://tools.ietf.org/html/draft-ietf-oauth-security-topics-13#section-3.4
44
+ * Microsoft's documentation and recommendations are at:
45
+ * https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-authentication-flows#usernamepassword
46
+ *
47
+ * @param request
48
+ */
49
+ acquireTokenByUsernamePassword(request: UsernamePasswordRequest): Promise<AuthenticationResult | null>;
37
50
  }
@@ -1,5 +1,4 @@
1
- import { LoggerOptions, INetworkModule } from "@azure/msal-common";
2
- import { ICachePlugin } from "../cache/ICachePlugin";
1
+ import { LoggerOptions, INetworkModule, ProtocolMode, ICachePlugin } from "@azure/msal-common";
3
2
  /**
4
3
  * - clientId - Client id of the application.
5
4
  * - authority - Url of the authority. If no value is set, defaults to https://login.microsoftonline.com/common.
@@ -7,6 +6,7 @@ import { ICachePlugin } from "../cache/ICachePlugin";
7
6
  * - clientSecret - Secret string that the application uses when requesting a token. Only used in confidential client applications. Can be created in the Azure app registration portal.
8
7
  * - clientAssertion - Assertion string that the application uses when requesting a token. Only used in confidential client applications. Assertion should be of type urn:ietf:params:oauth:client-assertion-type:jwt-bearer.
9
8
  * - clientCertificate - Certificate that the application uses when requesting a token. Only used in confidential client applications. Requires hex encoded X.509 SHA-1 thumbprint of the certificiate, and the PEM encoded private key (string should contain -----BEGIN PRIVATE KEY----- ... -----END PRIVATE KEY----- )
9
+ * - protocolMode - Enum that represents the protocol that msal follows. Used for configuring proper endpoints.
10
10
  */
11
11
  export declare type NodeAuthOptions = {
12
12
  clientId: string;
@@ -16,10 +16,12 @@ export declare type NodeAuthOptions = {
16
16
  clientCertificate?: {
17
17
  thumbprint: string;
18
18
  privateKey: string;
19
+ x5c?: string;
19
20
  };
20
21
  knownAuthorities?: Array<string>;
21
22
  cloudDiscoveryMetadata?: string;
22
23
  clientCapabilities?: [];
24
+ protocolMode?: ProtocolMode;
23
25
  };
24
26
  /**
25
27
  * Use this to configure the below cache configuration options:
@@ -25,4 +25,6 @@ export declare class CryptoProvider implements ICrypto {
25
25
  * Generates PKCE codes used in Authorization Code Flow.
26
26
  */
27
27
  generatePkceCodes(): Promise<PkceCodes>;
28
+ getPublicKeyThumbprint(): Promise<string>;
29
+ signJwt(): Promise<string>;
28
30
  }
package/dist/index.d.ts CHANGED
@@ -2,7 +2,15 @@ export { PublicClientApplication } from "./client/PublicClientApplication";
2
2
  export { ConfidentialClientApplication } from "./client/ConfidentialClientApplication";
3
3
  export { Configuration, buildAppConfiguration } from "./config/Configuration";
4
4
  export { Storage } from "./cache/Storage";
5
+ export { Serializer } from "./cache/serializer/Serializer";
6
+ export { Deserializer } from "./cache/serializer/Deserializer";
5
7
  export { TokenCache } from "./cache/TokenCache";
6
- export { ICachePlugin } from "./cache/ICachePlugin";
7
8
  export { CryptoProvider } from "./crypto/CryptoProvider";
8
- export { AuthorizationCodeRequest, DeviceCodeRequest, RefreshTokenRequest, PromptValue, ResponseMode, AuthenticationResult, AccountInfo, AuthError, AuthErrorMessage, INetworkModule, NetworkRequestOptions, NetworkResponse, LogLevel, } from "@azure/msal-common";
9
+ export type { AuthorizationCodeRequest } from "./request/AuthorizationCodeRequest";
10
+ export type { AuthorizationUrlRequest } from "./request/AuthorizationUrlRequest";
11
+ export type { ClientCredentialRequest } from "./request/ClientCredentialRequest";
12
+ export type { DeviceCodeRequest } from "./request/DeviceCodeRequest";
13
+ export type { OnBehalfOfRequest } from "./request/OnBehalfOfRequest";
14
+ export type { RefreshTokenRequest } from "./request/RefreshTokenRequest";
15
+ export type { SilentFlowRequest } from "./request/SilentFlowRequest";
16
+ export { PromptValue, ResponseMode, AuthenticationResult, AccountInfo, AuthError, AuthErrorMessage, InteractionRequiredAuthError, ServerError, ClientAuthError, ClientAuthErrorMessage, ClientConfigurationError, ClientConfigurationErrorMessage, INetworkModule, NetworkRequestOptions, NetworkResponse, Logger, LogLevel, ProtocolMode, ICachePlugin, TokenCacheContext, ISerializableTokenCache } from "@azure/msal-common";