@azure/msal-node 1.11.0 → 1.13.0

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 (31) hide show
  1. package/README.md +1 -3
  2. package/dist/client/ClientApplication.d.ts +3 -2
  3. package/dist/client/ClientApplication.d.ts.map +1 -1
  4. package/dist/client/ConfidentialClientApplication.d.ts +9 -1
  5. package/dist/client/ConfidentialClientApplication.d.ts.map +1 -1
  6. package/dist/client/IConfidentialClientApplication.d.ts +4 -2
  7. package/dist/client/IConfidentialClientApplication.d.ts.map +1 -1
  8. package/dist/client/IPublicClientApplication.d.ts +4 -1
  9. package/dist/client/IPublicClientApplication.d.ts.map +1 -1
  10. package/dist/client/PublicClientApplication.d.ts +5 -0
  11. package/dist/client/PublicClientApplication.d.ts.map +1 -1
  12. package/dist/error/NodeAuthError.d.ts +58 -0
  13. package/dist/error/NodeAuthError.d.ts.map +1 -0
  14. package/dist/index.d.ts +2 -1
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/msal-node.cjs.development.js +277 -7
  17. package/dist/msal-node.cjs.development.js.map +1 -1
  18. package/dist/msal-node.cjs.production.min.js +1 -1
  19. package/dist/msal-node.cjs.production.min.js.map +1 -1
  20. package/dist/msal-node.esm.js +276 -7
  21. package/dist/msal-node.esm.js.map +1 -1
  22. package/dist/network/LoopbackClient.d.ts +21 -0
  23. package/dist/network/LoopbackClient.d.ts.map +1 -0
  24. package/dist/packageMetadata.d.ts +1 -1
  25. package/dist/request/InteractiveRequest.d.ts +8 -0
  26. package/dist/request/InteractiveRequest.d.ts.map +1 -0
  27. package/dist/request/RefreshTokenRequest.d.ts +3 -1
  28. package/dist/request/RefreshTokenRequest.d.ts.map +1 -1
  29. package/dist/utils/Constants.d.ts +10 -0
  30. package/dist/utils/Constants.d.ts.map +1 -1
  31. package/package.json +2 -2
package/README.md CHANGED
@@ -116,9 +116,7 @@ AAD samples:
116
116
 
117
117
  B2C samples:
118
118
 
119
- - [b2c-auth-code](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/b2c-auth-code): Express app using OAuth2.0 authorization code flow.
120
- - [b2c-auth-code-pkce](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/b2c-auth-code-pkce): Express app using OAuth2.0 authorization code flow with PKCE.
121
- - [b2c-silent-flow](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/b2c-silent-flow): Express app using OAuth2.0 authorization code flow to acquire a token and store in the token cache, and silent flow to use tokens in the token cache.
119
+ - [b2c-user-flows](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/b2c-user-flows): Express app using OAuth2.0 authorization code flow.
122
120
  - [ms-identity-b2c-javascript-nodejs-management](https://github.com/Azure-Samples/ms-identity-b2c-javascript-nodejs-management/tree/main/Chapter2): Command line app using OAuth 2.0 client credentials flow for performing user management operations on an Azure AD / Azure AD B2C tenant
123
121
 
124
122
  Others:
@@ -1,5 +1,6 @@
1
1
  import { ClientConfiguration, AuthenticationResult, BaseAuthRequest, Logger, ServerTelemetryManager, AzureRegionConfiguration, AzureCloudOptions, AuthorizationCodePayload } from "@azure/msal-common";
2
2
  import { Configuration, NodeConfiguration } from "../config/Configuration";
3
+ import { CryptoProvider } from "../crypto/CryptoProvider";
3
4
  import { NodeStorage } from "../cache/NodeStorage";
4
5
  import { TokenCache } from "../cache/TokenCache";
5
6
  import { ClientAssertion } from "./ClientAssertion";
@@ -13,7 +14,7 @@ import { UsernamePasswordRequest } from "../request/UsernamePasswordRequest";
13
14
  * @public
14
15
  */
15
16
  export declare abstract class ClientApplication {
16
- private readonly cryptoProvider;
17
+ protected readonly cryptoProvider: CryptoProvider;
17
18
  private tokenCache;
18
19
  /**
19
20
  * Platform storage object
@@ -57,7 +58,7 @@ export declare abstract class ClientApplication {
57
58
  * Authorization Code flow. Ensure that values for redirectUri and scopes in AuthorizationCodeUrlRequest and
58
59
  * AuthorizationCodeRequest are the same.
59
60
  */
60
- acquireTokenByCode(request: AuthorizationCodeRequest, authCodePayLoad?: AuthorizationCodePayload): Promise<AuthenticationResult | null>;
61
+ acquireTokenByCode(request: AuthorizationCodeRequest, authCodePayLoad?: AuthorizationCodePayload): Promise<AuthenticationResult>;
61
62
  /**
62
63
  * Acquires a token by exchanging the refresh token provided for a new set of tokens.
63
64
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ClientApplication.d.ts","sourceRoot":"","sources":["../src/client/ClientApplication.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,mBAAmB,EAEnB,oBAAoB,EAGpB,eAAe,EAEf,MAAM,EACN,sBAAsB,EAYtB,wBAAwB,EAExB,iBAAiB,EACjB,wBAAwB,EAG3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAyB,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAElG,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E;;;GAGG;AACH,8BAAsB,iBAAiB;IAEnC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAChD,OAAO,CAAC,UAAU,CAAa;IAE/B;;OAEG;IACH,SAAS,CAAC,OAAO,EAAE,WAAW,CAAC;IAC/B;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,SAAS,CA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;;;;OAKG;IACH,SAAS,CAAC,gCAAgC,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,sBAAsB;IAWhI;;;;OAIG;YACW,eAAe;IAkB7B;;OAEG;IACH,UAAU,IAAI,IAAI;CAGrB"}
@@ -1,6 +1,6 @@
1
1
  import { ClientApplication } from "./ClientApplication";
2
2
  import { Configuration } from "../config/Configuration";
3
- import { AuthenticationResult } from "@azure/msal-common";
3
+ import { AuthenticationResult, IAppTokenProvider } from "@azure/msal-common";
4
4
  import { IConfidentialClientApplication } from "./IConfidentialClientApplication";
5
5
  import { OnBehalfOfRequest } from "../request/OnBehalfOfRequest";
6
6
  import { ClientCredentialRequest } from "../request/ClientCredentialRequest";
@@ -10,6 +10,7 @@ import { ClientCredentialRequest } from "../request/ClientCredentialRequest";
10
10
  * @public
11
11
  */
12
12
  export declare class ConfidentialClientApplication extends ClientApplication implements IConfidentialClientApplication {
13
+ private appTokenProvider?;
13
14
  /**
14
15
  * Constructor for the ConfidentialClientApplication
15
16
  *
@@ -30,6 +31,13 @@ export declare class ConfidentialClientApplication extends ClientApplication imp
30
31
  * @param Configuration - configuration object for the MSAL ConfidentialClientApplication instance
31
32
  */
32
33
  constructor(configuration: Configuration);
34
+ /**
35
+ * This extensibility point only works for the client_credential flow, i.e. acquireTokenByClientCredential and
36
+ * is meant for Azure SDK to enhance Managed Identity support.
37
+ *
38
+ * @param IAppTokenProvider - Extensibility interface, which allows the app developer to return a token from a custom source.
39
+ */
40
+ SetAppTokenProvider(provider: IAppTokenProvider): void;
33
41
  /**
34
42
  * Acquires tokens from the authority for the application (not for an end user).
35
43
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ConfidentialClientApplication.d.ts","sourceRoot":"","sources":["../src/client/ConfidentialClientApplication.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,E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AAmB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAItD;;OAEG;IACU,8BAA8B,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IA4CnH;;;;;;;;;;OAUG;IACU,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAyBrG,OAAO,CAAC,mBAAmB;CAyC9B"}
@@ -1,4 +1,4 @@
1
- import { AuthenticationResult, Logger } from "@azure/msal-common";
1
+ import { AuthenticationResult, IAppTokenProvider, Logger } from "@azure/msal-common";
2
2
  import { AuthorizationCodeRequest } from "../request/AuthorizationCodeRequest";
3
3
  import { AuthorizationUrlRequest } from "../request/AuthorizationUrlRequest";
4
4
  import { ClientCredentialRequest } from "../request/ClientCredentialRequest";
@@ -15,7 +15,7 @@ export interface IConfidentialClientApplication {
15
15
  /** Creates the URL of the authorization request */
16
16
  getAuthCodeUrl(request: AuthorizationUrlRequest): Promise<string>;
17
17
  /** Acquires a token by exchanging the authorization code received from the first step of OAuth 2.0 Authorization Code Flow */
18
- acquireTokenByCode(request: AuthorizationCodeRequest): Promise<AuthenticationResult | null>;
18
+ acquireTokenByCode(request: AuthorizationCodeRequest): Promise<AuthenticationResult>;
19
19
  /** Acquires a token silently when a user specifies the account the token is requested for */
20
20
  acquireTokenSilent(request: SilentFlowRequest): Promise<AuthenticationResult | null>;
21
21
  /** Acquires a token by exchanging the refresh token provided for a new set of tokens */
@@ -34,5 +34,7 @@ export interface IConfidentialClientApplication {
34
34
  setLogger(logger: Logger): void;
35
35
  /** Clear the cache */
36
36
  clearCache(): void;
37
+ /** This extensibility point is meant for Azure SDK to enhance Managed Identity support */
38
+ SetAppTokenProvider(provider: IAppTokenProvider): void;
37
39
  }
38
40
  //# sourceMappingURL=IConfidentialClientApplication.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IConfidentialClientApplication.d.ts","sourceRoot":"","s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AwF;IACxF,0BAA0B,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAE/F,mFAAmF;IACnF,8BAA8B,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAEvG,6DAA6D;IAC7D,sBAAsB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAEzF,kHAAkH;IAClH,8BAA8B,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAEvG,+CAA+C;IAC/C,aAAa,IAAI,UAAU,CAAC;IAE5B,kCAAkC;IAClC,SAAS,IAAI,MAAM,CAAC;IAEpB,gGAAgG;IAChG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC,sBAAsB;IACtB,UAAU,IAAI,IAAI,CAAC;IAEnB,0FAA0F;IAC1F,mBAAmB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;CACzD"}
@@ -6,6 +6,7 @@ import { RefreshTokenRequest } from "../request/RefreshTokenRequest";
6
6
  import { SilentFlowRequest } from "../request/SilentFlowRequest";
7
7
  import { UsernamePasswordRequest } from "../request/UsernamePasswordRequest";
8
8
  import { TokenCache } from "../cache/TokenCache";
9
+ import { InteractiveRequest } from "../request/InteractiveRequest";
9
10
  /**
10
11
  * Interface for the PublicClientApplication class defining the public API signatures
11
12
  * @public
@@ -14,7 +15,9 @@ export interface IPublicClientApplication {
14
15
  /** Creates the URL of the authorization request */
15
16
  getAuthCodeUrl(request: AuthorizationUrlRequest): Promise<string>;
16
17
  /** Acquires a token by exchanging the authorization code received from the first step of OAuth 2.0 Authorization Code Flow */
17
- acquireTokenByCode(request: AuthorizationCodeRequest): Promise<AuthenticationResult | null>;
18
+ acquireTokenByCode(request: AuthorizationCodeRequest): Promise<AuthenticationResult>;
19
+ /** Acquires a token interactively */
20
+ acquireTokenInteractive(request: InteractiveRequest): Promise<AuthenticationResult>;
18
21
  /** Acquires a token silently when a user specifies the account the token is requested for */
19
22
  acquireTokenSilent(request: SilentFlowRequest): Promise<AuthenticationResult | null>;
20
23
  /** Acquires a token by exchanging the refresh token provided for a new set of tokens */
@@ -1 +1 @@
1
- {"version":3,"file":"IPublicClientApplication.d.ts","sourceRoot":"","sources":["../src/client/IPublicClientApplication.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IAErC,mDAAmD;IACnD,cAAc,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAElE,8HAA8H;IAC9H,kBAAkB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAE5F,6FAA6F;IAC7F,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAErF,wFAAwF;IACxF,0BAA0B,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAE/F,0EAA0E;IAC1E,wB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AuB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEpF,6FAA6F;IAC7F,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAErF,wFAAwF;IACxF,0BAA0B,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAE/F,0EAA0E;IAC1E,wBAAwB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAE3F,kHAAkH;IAClH,8BAA8B,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAEvG,+CAA+C;IAC/C,aAAa,IAAI,UAAU,CAAC;IAE5B,kCAAkC;IAClC,SAAS,IAAI,MAAM,CAAC;IAEpB,gGAAgG;IAChG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC,sBAAsB;IACtB,UAAU,IAAI,IAAI,CAAC;CACtB"}
@@ -3,6 +3,7 @@ import { Configuration } from "../config/Configuration";
3
3
  import { ClientApplication } from "./ClientApplication";
4
4
  import { IPublicClientApplication } from "./IPublicClientApplication";
5
5
  import { DeviceCodeRequest } from "../request/DeviceCodeRequest";
6
+ import { InteractiveRequest } from "../request/InteractiveRequest";
6
7
  /**
7
8
  * This class is to be used to acquire tokens for public client applications (desktop, mobile). Public client applications
8
9
  * are not trusted to safely store application secrets, and therefore can only request tokens in the name of an user.
@@ -37,5 +38,9 @@ export declare class PublicClientApplication extends ClientApplication implement
37
38
  * until the end-user completes input of credentials.
38
39
  */
39
40
  acquireTokenByDeviceCode(request: DeviceCodeRequest): Promise<AuthenticationResult | null>;
41
+ /**
42
+ * Acquires a token by requesting an Authorization code then exchanging it for a token.
43
+ */
44
+ acquireTokenInteractive(request: InteractiveRequest): Promise<AuthenticationResult>;
40
45
  }
41
46
  //# sourceMappingURL=PublicClientApplication.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PublicClientApplication.d.ts","sourceRoot":"","sources":["../src/client/PublicClientApplication.ts"],"names":[],"mappings":"AAMA,OAAO,EAEH,oBAAoB,EAGvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,iBAAkB,YAAW,wBAAwB;IAC9F;;;;;;;;;;;;;;;;OAgBG;gBACS,aAAa,EAAE,aAAa;IAIxC;;;;;;;;OAQG;IACU,wBAAwB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;CAuB1G"}
1
+ {"version":3,"file":"PublicClientApplication.d.ts","sourceRoot":"","sources":["../src/client/PublicClientApplication.ts"],"names":[],"mappings":"AAMA,OAAO,EAEH,oBAAoB,EAQvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAInE;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,iBAAkB,YAAW,wBAAwB;IAC9F;;;;;;;;;;;;;;;;OAgBG;gBACS,aAAa,EAAE,aAAa;IAIxC;;;;;;;;OAQG;IACU,wBAAwB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAwBvG;;OAEG;IACG,uBAAuB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAuC5F"}
@@ -0,0 +1,58 @@
1
+ import { AuthError } from "@azure/msal-common";
2
+ /**
3
+ * NodeAuthErrorMessage class containing string constants used by error codes and messages.
4
+ */
5
+ export declare const NodeAuthErrorMessage: {
6
+ invalidLoopbackAddressType: {
7
+ code: string;
8
+ desc: string;
9
+ };
10
+ unableToLoadRedirectUri: {
11
+ code: string;
12
+ desc: string;
13
+ };
14
+ noAuthCodeInResponse: {
15
+ code: string;
16
+ desc: string;
17
+ };
18
+ noLoopbackServerExists: {
19
+ code: string;
20
+ desc: string;
21
+ };
22
+ loopbackServerAlreadyExists: {
23
+ code: string;
24
+ desc: string;
25
+ };
26
+ loopbackServerTimeout: {
27
+ code: string;
28
+ desc: string;
29
+ };
30
+ };
31
+ export declare class NodeAuthError extends AuthError {
32
+ constructor(errorCode: string, errorMessage?: string);
33
+ /**
34
+ * Creates an error thrown if loopback server address is of type string.
35
+ */
36
+ static createInvalidLoopbackAddressTypeError(): NodeAuthError;
37
+ /**
38
+ * Creates an error thrown if the loopback server is unable to get a url.
39
+ */
40
+ static createUnableToLoadRedirectUrlError(): NodeAuthError;
41
+ /**
42
+ * Creates an error thrown if the server response does not contain an auth code.
43
+ */
44
+ static createNoAuthCodeInResponseError(): NodeAuthError;
45
+ /**
46
+ * Creates an error thrown if the loopback server has not been spun up yet.
47
+ */
48
+ static createNoLoopbackServerExistsError(): NodeAuthError;
49
+ /**
50
+ * Creates an error thrown if a loopback server already exists when attempting to create another one.
51
+ */
52
+ static createLoopbackServerAlreadyExistsError(): NodeAuthError;
53
+ /**
54
+ * Creates an error thrown if the loopback server times out registering the auth code listener.
55
+ */
56
+ static createLoopbackServerTimeoutError(): NodeAuthError;
57
+ }
58
+ //# sourceMappingURL=NodeAuthError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NodeAuthError.d.ts","sourceRoot":"","sources":["../src/error/NodeAuthError.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;CAyBhC,CAAC;AAEF,qBAAa,aAAc,SAAQ,SAAS;gBAC5B,SAAS,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM;IAKpD;;OAEG;IACH,MAAM,CAAC,qCAAqC,IAAI,aAAa;IAK7D;;OAEG;IACH,MAAM,CAAC,kCAAkC,IAAI,aAAa;IAK1D;;OAEG;IACH,MAAM,CAAC,+BAA+B,IAAI,aAAa;IAKvD;;OAEG;IACH,MAAM,CAAC,iCAAiC,IAAI,aAAa;IAKzD;;OAEG;IACH,MAAM,CAAC,sCAAsC,IAAI,aAAa;IAK9D;;OAEG;IACH,MAAM,CAAC,gCAAgC,IAAI,aAAa;CAI3D"}
package/dist/index.d.ts CHANGED
@@ -25,6 +25,7 @@ export type { OnBehalfOfRequest } from "./request/OnBehalfOfRequest";
25
25
  export type { UsernamePasswordRequest } from "./request/UsernamePasswordRequest";
26
26
  export type { RefreshTokenRequest } from "./request/RefreshTokenRequest";
27
27
  export type { SilentFlowRequest } from "./request/SilentFlowRequest";
28
- export { PromptValue, ResponseMode, AuthorizationCodePayload, AuthenticationResult, AccountInfo, ValidCacheType, AuthError, AuthErrorMessage, ClientAuthError, ClientAuthErrorMessage, ClientConfigurationError, ClientConfigurationErrorMessage, InteractionRequiredAuthError, InteractionRequiredAuthErrorMessage, ServerError, INetworkModule, NetworkRequestOptions, NetworkResponse, Logger, LogLevel, ProtocolMode, ICachePlugin, TokenCacheContext, ISerializableTokenCache, AzureCloudInstance, AzureCloudOptions } from "@azure/msal-common";
28
+ export type { InteractiveRequest } from "./request/InteractiveRequest";
29
+ export { PromptValue, ResponseMode, AuthorizationCodePayload, AuthenticationResult, AccountInfo, ValidCacheType, AuthError, AuthErrorMessage, ClientAuthError, ClientAuthErrorMessage, ClientConfigurationError, ClientConfigurationErrorMessage, InteractionRequiredAuthError, InteractionRequiredAuthErrorMessage, ServerError, INetworkModule, NetworkRequestOptions, NetworkResponse, Logger, LogLevel, ProtocolMode, ICachePlugin, TokenCacheContext, ISerializableTokenCache, AzureCloudInstance, AzureCloudOptions, IAppTokenProvider, AppTokenProviderParameters, AppTokenProviderResult } from "@azure/msal-common";
29
30
  export { version } from "./packageMetadata";
30
31
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAKA;;;GAGG;AAGH,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAG1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,eAAe,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAChI,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAG3D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,2BAA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YAAY,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAGvE,OAAO,EAEH,WAAW,EACX,YAAY,EACZ,wBAAwB,EAExB,oBAAoB,EAEpB,WAAW,EACX,cAAc,EAEd,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,wBAAwB,EACxB,+BAA+B,EAC/B,4BAA4B,EAC5B,mCAAmC,EACnC,WAAW,EAEX,cAAc,EACd,qBAAqB,EACrB,eAAe,EAEf,MAAM,EACN,QAAQ,EAER,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,EAEvB,kBAAkB,EAClB,iBAAiB,EAEjB,iBAAiB,EACjB,0BAA0B,EAC1B,sBAAsB,EACzB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC"}
@@ -5,7 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
6
 
7
7
  var msalCommon = require('@azure/msal-common');
8
- var http = _interopDefault(require('http'));
8
+ var http = require('http');
9
+ var http__default = _interopDefault(http);
9
10
  var https = _interopDefault(require('https'));
10
11
  var uuid = require('uuid');
11
12
  var crypto = _interopDefault(require('crypto'));
@@ -25,6 +26,13 @@ var HttpMethod;
25
26
  HttpMethod["GET"] = "get";
26
27
  HttpMethod["POST"] = "post";
27
28
  })(HttpMethod || (HttpMethod = {}));
29
+
30
+ var HttpStatus;
31
+
32
+ (function (HttpStatus) {
33
+ HttpStatus[HttpStatus["OK"] = 200] = "OK";
34
+ HttpStatus[HttpStatus["REDIRECT"] = 302] = "REDIRECT";
35
+ })(HttpStatus || (HttpStatus = {}));
28
36
  /**
29
37
  * Constants used for region discovery
30
38
  */
@@ -57,7 +65,9 @@ const CharSet = {
57
65
  const Constants = {
58
66
  MSAL_SKU: "msal.js.node",
59
67
  JWT_BEARER_ASSERTION_TYPE: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
60
- AUTHORIZATION_PENDING: "authorization_pending"
68
+ AUTHORIZATION_PENDING: "authorization_pending",
69
+ HTTP_PROTOCOL: "http://",
70
+ LOCALHOST: "localhost"
61
71
  };
62
72
  /**
63
73
  * API Codes for Telemetry purposes.
@@ -94,6 +104,10 @@ const JwtConstants = {
94
104
  NOT_BEFORE: "nbf",
95
105
  JWT_ID: "jti"
96
106
  };
107
+ const LOOPBACK_SERVER_CONSTANTS = {
108
+ INTERVAL_MS: 100,
109
+ TIMEOUT_MS: 5000
110
+ };
97
111
 
98
112
  /*
99
113
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -160,7 +174,7 @@ const networkRequestViaProxy = (url, httpMethod, options, timeout) => {
160
174
 
161
175
  const outgoingRequestString = `${httpMethod.toUpperCase()} ${destinationUrl.href} HTTP/1.1\r\n` + `Host: ${destinationUrl.host}\r\n` + "Connection: close\r\n" + postRequestStringContent + "\r\n";
162
176
  return new Promise((resolve, reject) => {
163
- const request = http.request(tunnelRequestOptions);
177
+ const request = http__default.request(tunnelRequestOptions);
164
178
 
165
179
  if (tunnelRequestOptions.timeout) {
166
180
  request.on("timeout", () => {
@@ -1758,7 +1772,7 @@ class TokenCache {
1758
1772
 
1759
1773
  /* eslint-disable header/header */
1760
1774
  const name = "@azure/msal-node";
1761
- const version = "1.11.0";
1775
+ const version = "1.13.0";
1762
1776
 
1763
1777
  /*
1764
1778
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1971,7 +1985,7 @@ class ClientApplication {
1971
1985
  this.logger.verbose(`building oauth client configuration with the authority: ${authority}`, requestCorrelationId);
1972
1986
  const discoveredAuthority = await this.createAuthority(authority, azureRegionConfiguration, requestCorrelationId, userAzureCloudOptions);
1973
1987
  serverTelemetryManager == null ? void 0 : serverTelemetryManager.updateRegionDiscoveryMetadata(discoveredAuthority.regionDiscoveryMetadata);
1974
- return {
1988
+ const clientConfiguration = {
1975
1989
  authOptions: {
1976
1990
  clientId: this.config.auth.clientId,
1977
1991
  authority: discoveredAuthority,
@@ -2004,6 +2018,7 @@ class ClientApplication {
2004
2018
  persistencePlugin: this.config.cache.cachePlugin,
2005
2019
  serializableCache: this.tokenCache
2006
2020
  };
2021
+ return clientConfiguration;
2007
2022
  }
2008
2023
 
2009
2024
  getClientAssertion(authority) {
@@ -2086,6 +2101,192 @@ class ClientApplication {
2086
2101
 
2087
2102
  }
2088
2103
 
2104
+ /*
2105
+ * Copyright (c) Microsoft Corporation. All rights reserved.
2106
+ * Licensed under the MIT License.
2107
+ */
2108
+ /**
2109
+ * NodeAuthErrorMessage class containing string constants used by error codes and messages.
2110
+ */
2111
+
2112
+ const NodeAuthErrorMessage = {
2113
+ invalidLoopbackAddressType: {
2114
+ code: "invalid_loopback_server_address_type",
2115
+ desc: "Loopback server address is not type string. This is unexpected."
2116
+ },
2117
+ unableToLoadRedirectUri: {
2118
+ code: "unable_to_load_redirectUrl",
2119
+ desc: "Loopback server callback was invoked without a url. This is unexpected."
2120
+ },
2121
+ noAuthCodeInResponse: {
2122
+ code: "no_auth_code_in_response",
2123
+ desc: "No auth code found in the server response. Please check your network trace to determine what happened."
2124
+ },
2125
+ noLoopbackServerExists: {
2126
+ code: "no_loopback_server_exists",
2127
+ desc: "No loopback server exists yet."
2128
+ },
2129
+ loopbackServerAlreadyExists: {
2130
+ code: "loopback_server_already_exists",
2131
+ desc: "Loopback server already exists. Cannot create another."
2132
+ },
2133
+ loopbackServerTimeout: {
2134
+ code: "loopback_server_timeout",
2135
+ desc: "Timed out waiting for auth code listener to be registered."
2136
+ }
2137
+ };
2138
+ class NodeAuthError extends msalCommon.AuthError {
2139
+ constructor(errorCode, errorMessage) {
2140
+ super(errorCode, errorMessage);
2141
+ this.name = "NodeAuthError";
2142
+ }
2143
+ /**
2144
+ * Creates an error thrown if loopback server address is of type string.
2145
+ */
2146
+
2147
+
2148
+ static createInvalidLoopbackAddressTypeError() {
2149
+ return new NodeAuthError(NodeAuthErrorMessage.invalidLoopbackAddressType.code, `${NodeAuthErrorMessage.invalidLoopbackAddressType.desc}`);
2150
+ }
2151
+ /**
2152
+ * Creates an error thrown if the loopback server is unable to get a url.
2153
+ */
2154
+
2155
+
2156
+ static createUnableToLoadRedirectUrlError() {
2157
+ return new NodeAuthError(NodeAuthErrorMessage.unableToLoadRedirectUri.code, `${NodeAuthErrorMessage.unableToLoadRedirectUri.desc}`);
2158
+ }
2159
+ /**
2160
+ * Creates an error thrown if the server response does not contain an auth code.
2161
+ */
2162
+
2163
+
2164
+ static createNoAuthCodeInResponseError() {
2165
+ return new NodeAuthError(NodeAuthErrorMessage.noAuthCodeInResponse.code, `${NodeAuthErrorMessage.noAuthCodeInResponse.desc}`);
2166
+ }
2167
+ /**
2168
+ * Creates an error thrown if the loopback server has not been spun up yet.
2169
+ */
2170
+
2171
+
2172
+ static createNoLoopbackServerExistsError() {
2173
+ return new NodeAuthError(NodeAuthErrorMessage.noLoopbackServerExists.code, `${NodeAuthErrorMessage.noLoopbackServerExists.desc}`);
2174
+ }
2175
+ /**
2176
+ * Creates an error thrown if a loopback server already exists when attempting to create another one.
2177
+ */
2178
+
2179
+
2180
+ static createLoopbackServerAlreadyExistsError() {
2181
+ return new NodeAuthError(NodeAuthErrorMessage.loopbackServerAlreadyExists.code, `${NodeAuthErrorMessage.loopbackServerAlreadyExists.desc}`);
2182
+ }
2183
+ /**
2184
+ * Creates an error thrown if the loopback server times out registering the auth code listener.
2185
+ */
2186
+
2187
+
2188
+ static createLoopbackServerTimeoutError() {
2189
+ return new NodeAuthError(NodeAuthErrorMessage.loopbackServerTimeout.code, `${NodeAuthErrorMessage.loopbackServerTimeout.desc}`);
2190
+ }
2191
+
2192
+ }
2193
+
2194
+ /*
2195
+ * Copyright (c) Microsoft Corporation. All rights reserved.
2196
+ * Licensed under the MIT License.
2197
+ */
2198
+ class LoopbackClient {
2199
+ /**
2200
+ * Spins up a loopback server which returns the server response when the localhost redirectUri is hit
2201
+ * @param successTemplate
2202
+ * @param errorTemplate
2203
+ * @returns
2204
+ */
2205
+ async listenForAuthCode(successTemplate, errorTemplate) {
2206
+ if (!!this.server) {
2207
+ throw NodeAuthError.createLoopbackServerAlreadyExistsError();
2208
+ }
2209
+
2210
+ const authCodeListener = new Promise((resolve, reject) => {
2211
+ this.server = http.createServer(async (req, res) => {
2212
+ const url = req.url;
2213
+
2214
+ if (!url) {
2215
+ res.end(errorTemplate || "Error occurred loading redirectUrl");
2216
+ reject(NodeAuthError.createUnableToLoadRedirectUrlError());
2217
+ return;
2218
+ } else if (url === msalCommon.Constants.FORWARD_SLASH) {
2219
+ res.end(successTemplate || "Auth code was successfully acquired. You can close this window now.");
2220
+ return;
2221
+ }
2222
+
2223
+ const authCodeResponse = msalCommon.UrlString.getDeserializedQueryString(url);
2224
+
2225
+ if (authCodeResponse.code) {
2226
+ const redirectUri = await this.getRedirectUri();
2227
+ res.writeHead(HttpStatus.REDIRECT, {
2228
+ location: redirectUri
2229
+ }); // Prevent auth code from being saved in the browser history
2230
+
2231
+ res.end();
2232
+ }
2233
+
2234
+ resolve(authCodeResponse);
2235
+ });
2236
+ this.server.listen(0); // Listen on any available port
2237
+ }); // Wait for server to be listening
2238
+
2239
+ await new Promise(resolve => {
2240
+ let ticks = 0;
2241
+ const id = setInterval(() => {
2242
+ if (LOOPBACK_SERVER_CONSTANTS.TIMEOUT_MS / LOOPBACK_SERVER_CONSTANTS.INTERVAL_MS < ticks) {
2243
+ throw NodeAuthError.createLoopbackServerTimeoutError();
2244
+ }
2245
+
2246
+ if (this.server.listening) {
2247
+ clearInterval(id);
2248
+ resolve();
2249
+ }
2250
+
2251
+ ticks++;
2252
+ }, LOOPBACK_SERVER_CONSTANTS.INTERVAL_MS);
2253
+ });
2254
+ return authCodeListener;
2255
+ }
2256
+ /**
2257
+ * Get the port that the loopback server is running on
2258
+ * @returns
2259
+ */
2260
+
2261
+
2262
+ getRedirectUri() {
2263
+ if (!this.server) {
2264
+ throw NodeAuthError.createNoLoopbackServerExistsError();
2265
+ }
2266
+
2267
+ const address = this.server.address();
2268
+
2269
+ if (!address || typeof address === "string" || !address.port) {
2270
+ this.closeServer();
2271
+ throw NodeAuthError.createInvalidLoopbackAddressTypeError();
2272
+ }
2273
+
2274
+ const port = address && address.port;
2275
+ return `${Constants.HTTP_PROTOCOL}${Constants.LOCALHOST}:${port}`;
2276
+ }
2277
+ /**
2278
+ * Close the loopback server
2279
+ */
2280
+
2281
+
2282
+ closeServer() {
2283
+ if (!!this.server) {
2284
+ this.server.close();
2285
+ }
2286
+ }
2287
+
2288
+ }
2289
+
2089
2290
  /*
2090
2291
  * Copyright (c) Microsoft Corporation. All rights reserved.
2091
2292
  * Licensed under the MIT License.
@@ -2147,6 +2348,54 @@ class PublicClientApplication extends ClientApplication {
2147
2348
  throw e;
2148
2349
  }
2149
2350
  }
2351
+ /**
2352
+ * Acquires a token by requesting an Authorization code then exchanging it for a token.
2353
+ */
2354
+
2355
+
2356
+ async acquireTokenInteractive(request) {
2357
+ const {
2358
+ verifier,
2359
+ challenge
2360
+ } = await this.cryptoProvider.generatePkceCodes();
2361
+ const {
2362
+ openBrowser,
2363
+ successTemplate,
2364
+ errorTemplate,
2365
+ ...remainingProperties
2366
+ } = request;
2367
+ const loopbackClient = new LoopbackClient();
2368
+ const authCodeListener = loopbackClient.listenForAuthCode(successTemplate, errorTemplate);
2369
+ const redirectUri = loopbackClient.getRedirectUri();
2370
+ const validRequest = { ...remainingProperties,
2371
+ scopes: request.scopes || [],
2372
+ redirectUri: redirectUri,
2373
+ responseMode: msalCommon.ResponseMode.QUERY,
2374
+ codeChallenge: challenge,
2375
+ codeChallengeMethod: msalCommon.CodeChallengeMethodValues.S256
2376
+ };
2377
+ const authCodeUrl = await this.getAuthCodeUrl(validRequest);
2378
+ await openBrowser(authCodeUrl);
2379
+ const authCodeResponse = await authCodeListener.finally(() => {
2380
+ loopbackClient.closeServer();
2381
+ });
2382
+
2383
+ if (authCodeResponse.error) {
2384
+ throw new msalCommon.ServerError(authCodeResponse.error, authCodeResponse.error_description, authCodeResponse.suberror);
2385
+ } else if (!authCodeResponse.code) {
2386
+ throw NodeAuthError.createNoAuthCodeInResponseError();
2387
+ }
2388
+
2389
+ const clientInfo = authCodeResponse.client_info;
2390
+ const tokenRequest = {
2391
+ code: authCodeResponse.code,
2392
+ scopes: msalCommon.OIDC_DEFAULT_SCOPES,
2393
+ redirectUri: validRequest.redirectUri,
2394
+ codeVerifier: verifier,
2395
+ clientInfo: clientInfo || msalCommon.Constants.EMPTY_STRING
2396
+ };
2397
+ return this.acquireTokenByCode(tokenRequest);
2398
+ }
2150
2399
 
2151
2400
  }
2152
2401
 
@@ -2320,6 +2569,18 @@ class ConfidentialClientApplication extends ClientApplication {
2320
2569
  constructor(configuration) {
2321
2570
  super(configuration);
2322
2571
  this.setClientCredential(this.config);
2572
+ this.appTokenProvider = undefined;
2573
+ }
2574
+ /**
2575
+ * This extensibility point only works for the client_credential flow, i.e. acquireTokenByClientCredential and
2576
+ * is meant for Azure SDK to enhance Managed Identity support.
2577
+ *
2578
+ * @param IAppTokenProvider - Extensibility interface, which allows the app developer to return a token from a custom source.
2579
+ */
2580
+
2581
+
2582
+ SetAppTokenProvider(provider) {
2583
+ this.appTokenProvider = provider;
2323
2584
  }
2324
2585
  /**
2325
2586
  * Acquires tokens from the authority for the application (not for an end user).
@@ -2350,7 +2611,7 @@ class ConfidentialClientApplication extends ClientApplication {
2350
2611
 
2351
2612
  try {
2352
2613
  const clientCredentialConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager, azureRegionConfiguration, request.azureCloudOptions);
2353
- const clientCredentialClient = new msalCommon.ClientCredentialClient(clientCredentialConfig);
2614
+ const clientCredentialClient = new msalCommon.ClientCredentialClient(clientCredentialConfig, this.appTokenProvider);
2354
2615
  this.logger.verbose("Client credential client created", validRequest.correlationId);
2355
2616
  return clientCredentialClient.acquireToken(validRequest);
2356
2617
  } catch (e) {
@@ -2402,7 +2663,16 @@ class ConfidentialClientApplication extends ClientApplication {
2402
2663
  thumbprint: msalCommon.Constants.EMPTY_STRING,
2403
2664
  privateKey: msalCommon.Constants.EMPTY_STRING
2404
2665
  };
2405
- const certificateNotEmpty = !msalCommon.StringUtils.isEmpty(certificate.thumbprint) || !msalCommon.StringUtils.isEmpty(certificate.privateKey); // Check that at most one credential is set on the application
2666
+ const certificateNotEmpty = !msalCommon.StringUtils.isEmpty(certificate.thumbprint) || !msalCommon.StringUtils.isEmpty(certificate.privateKey);
2667
+ /*
2668
+ * If app developer configures this callback, they don't need a credential
2669
+ * i.e. AzureSDK can get token from Managed Identity without a cert / secret
2670
+ */
2671
+
2672
+ if (this.appTokenProvider) {
2673
+ return;
2674
+ } // Check that at most one credential is set on the application
2675
+
2406
2676
 
2407
2677
  if (clientSecretNotEmpty && clientAssertionNotEmpty || clientAssertionNotEmpty && certificateNotEmpty || clientSecretNotEmpty && certificateNotEmpty) {
2408
2678
  throw msalCommon.ClientAuthError.createInvalidCredentialError();