@azure/identity 1.0.0-preview.1 → 1.0.0-preview.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.

Potentially problematic release.


This version of @azure/identity might be problematic. Click here for more details.

Files changed (88) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +50 -23
  3. package/browser/identity.js +9828 -0
  4. package/browser/identity.js.map +1 -0
  5. package/browser/identity.min.js +2 -0
  6. package/browser/identity.min.js.map +1 -0
  7. package/dist/index.js +475 -205
  8. package/dist/index.js.map +1 -1
  9. package/dist-esm/src/client/errors.d.ts +1 -1
  10. package/dist-esm/src/client/errors.d.ts.map +1 -1
  11. package/dist-esm/src/client/errors.js +9 -1
  12. package/dist-esm/src/client/errors.js.map +1 -1
  13. package/dist-esm/src/client/identityClient.d.ts +20 -17
  14. package/dist-esm/src/client/identityClient.d.ts.map +1 -1
  15. package/dist-esm/src/client/identityClient.js +42 -206
  16. package/dist-esm/src/client/identityClient.js.map +1 -1
  17. package/dist-esm/src/credentials/clientCertificateCredential.browser.d.ts +7 -0
  18. package/dist-esm/src/credentials/clientCertificateCredential.browser.d.ts.map +1 -0
  19. package/dist-esm/src/credentials/clientCertificateCredential.browser.js +12 -0
  20. package/dist-esm/src/credentials/clientCertificateCredential.browser.js.map +1 -0
  21. package/dist-esm/src/credentials/clientCertificateCredential.d.ts +5 -5
  22. package/dist-esm/src/credentials/clientCertificateCredential.d.ts.map +1 -1
  23. package/dist-esm/src/credentials/clientCertificateCredential.js +59 -5
  24. package/dist-esm/src/credentials/clientCertificateCredential.js.map +1 -1
  25. package/dist-esm/src/credentials/clientSecretCredential.d.ts +3 -3
  26. package/dist-esm/src/credentials/clientSecretCredential.d.ts.map +1 -1
  27. package/dist-esm/src/credentials/clientSecretCredential.js +27 -4
  28. package/dist-esm/src/credentials/clientSecretCredential.js.map +1 -1
  29. package/dist-esm/src/credentials/deviceCodeCredential.browser.d.ts +7 -0
  30. package/dist-esm/src/credentials/deviceCodeCredential.browser.d.ts.map +1 -0
  31. package/dist-esm/src/credentials/deviceCodeCredential.browser.js +12 -0
  32. package/dist-esm/src/credentials/deviceCodeCredential.browser.js.map +1 -0
  33. package/dist-esm/src/credentials/deviceCodeCredential.d.ts +67 -0
  34. package/dist-esm/src/credentials/deviceCodeCredential.d.ts.map +1 -0
  35. package/dist-esm/src/credentials/deviceCodeCredential.js +139 -0
  36. package/dist-esm/src/credentials/deviceCodeCredential.js.map +1 -0
  37. package/dist-esm/src/credentials/environmentCredential.browser.d.ts +7 -0
  38. package/dist-esm/src/credentials/environmentCredential.browser.d.ts.map +1 -0
  39. package/dist-esm/src/credentials/environmentCredential.browser.js +12 -0
  40. package/dist-esm/src/credentials/environmentCredential.browser.js.map +1 -0
  41. package/dist-esm/src/credentials/environmentCredential.d.ts.map +1 -1
  42. package/dist-esm/src/credentials/environmentCredential.js +0 -4
  43. package/dist-esm/src/credentials/environmentCredential.js.map +1 -1
  44. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.d.ts +32 -0
  45. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.d.ts.map +1 -0
  46. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js +112 -0
  47. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js.map +1 -0
  48. package/dist-esm/src/credentials/interactiveBrowserCredential.d.ts +12 -0
  49. package/dist-esm/src/credentials/interactiveBrowserCredential.d.ts.map +1 -0
  50. package/dist-esm/src/credentials/interactiveBrowserCredential.js +17 -0
  51. package/dist-esm/src/credentials/interactiveBrowserCredential.js.map +1 -0
  52. package/dist-esm/src/credentials/interactiveBrowserCredentialOptions.d.ts +24 -0
  53. package/dist-esm/src/credentials/interactiveBrowserCredentialOptions.d.ts.map +1 -0
  54. package/dist-esm/src/credentials/interactiveBrowserCredentialOptions.js +3 -0
  55. package/dist-esm/src/credentials/interactiveBrowserCredentialOptions.js.map +1 -0
  56. package/dist-esm/src/credentials/managedIdentityCredential.browser.d.ts +7 -0
  57. package/dist-esm/src/credentials/managedIdentityCredential.browser.d.ts.map +1 -0
  58. package/dist-esm/src/credentials/managedIdentityCredential.browser.js +15 -0
  59. package/dist-esm/src/credentials/managedIdentityCredential.browser.js.map +1 -0
  60. package/dist-esm/src/credentials/managedIdentityCredential.d.ts +10 -1
  61. package/dist-esm/src/credentials/managedIdentityCredential.d.ts.map +1 -1
  62. package/dist-esm/src/credentials/managedIdentityCredential.js +144 -2
  63. package/dist-esm/src/credentials/managedIdentityCredential.js.map +1 -1
  64. package/dist-esm/src/credentials/usernamePasswordCredential.d.ts +39 -0
  65. package/dist-esm/src/credentials/usernamePasswordCredential.d.ts.map +1 -0
  66. package/dist-esm/src/credentials/usernamePasswordCredential.js +67 -0
  67. package/dist-esm/src/credentials/usernamePasswordCredential.js.map +1 -0
  68. package/dist-esm/src/index.d.ts +4 -0
  69. package/dist-esm/src/index.d.ts.map +1 -1
  70. package/dist-esm/src/index.js +3 -0
  71. package/dist-esm/src/index.js.map +1 -1
  72. package/package.json +32 -14
  73. package/src/client/errors.ts +11 -3
  74. package/src/client/identityClient.ts +64 -246
  75. package/src/credentials/clientCertificateCredential.browser.ts +27 -0
  76. package/src/credentials/clientCertificateCredential.ts +72 -22
  77. package/src/credentials/clientSecretCredential.ts +32 -17
  78. package/src/credentials/deviceCodeCredential.browser.ts +27 -0
  79. package/src/credentials/deviceCodeCredential.ts +203 -0
  80. package/src/credentials/environmentCredential.browser.ts +19 -0
  81. package/src/credentials/environmentCredential.ts +5 -9
  82. package/src/credentials/interactiveBrowserCredential.browser.ts +134 -0
  83. package/src/credentials/interactiveBrowserCredential.ts +31 -0
  84. package/src/credentials/interactiveBrowserCredentialOptions.ts +30 -0
  85. package/src/credentials/managedIdentityCredential.browser.ts +22 -0
  86. package/src/credentials/managedIdentityCredential.ts +179 -8
  87. package/src/credentials/usernamePasswordCredential.ts +83 -0
  88. package/src/index.ts +4 -0
@@ -2,21 +2,17 @@
2
2
  // Licensed under the MIT License.
3
3
  import * as tslib_1 from "tslib";
4
4
  import qs from "qs";
5
- import jws from "jws";
6
- import uuid from "uuid";
7
- import { ServiceClient, WebResource, RestError } from "@azure/core-http";
5
+ import { ServiceClient, WebResource } from "@azure/core-http";
8
6
  import { AuthenticationError } from "./errors";
9
- const SelfSignedJwtLifetimeMins = 10;
10
7
  const DefaultAuthorityHost = "https://login.microsoftonline.com";
11
- const DefaultScopeSuffix = "/.default";
12
- export const ImdsEndpoint = "http://169.254.169.254/metadata/identity/oauth2/token";
13
- export const ImdsApiVersion = "2018-02-01";
14
- export const AppServiceMsiApiVersion = "2017-09-01";
15
8
  export class IdentityClient extends ServiceClient {
16
9
  constructor(options) {
17
10
  options = options || IdentityClient.getDefaultOptions();
18
11
  super(undefined, options);
19
- this.baseUri = options.authorityHost;
12
+ this.baseUri = this.authorityHost = options.authorityHost || DefaultAuthorityHost;
13
+ if (!this.baseUri.startsWith("https:")) {
14
+ throw new Error("The authorityHost address must use the 'https' protocol.");
15
+ }
20
16
  }
21
17
  createWebResource(requestOptions) {
22
18
  const webResource = new WebResource();
@@ -31,219 +27,59 @@ export class IdentityClient extends ServiceClient {
31
27
  });
32
28
  if (response.status === 200 || response.status === 201) {
33
29
  return {
34
- token: response.parsedBody.access_token,
35
- expiresOnTimestamp: expiresOnParser(response.parsedBody)
30
+ accessToken: {
31
+ token: response.parsedBody.access_token,
32
+ expiresOnTimestamp: expiresOnParser(response.parsedBody)
33
+ },
34
+ refreshToken: response.parsedBody.refresh_token,
36
35
  };
37
36
  }
38
37
  else {
39
- throw new AuthenticationError(response.status, response.bodyAsText);
38
+ throw new AuthenticationError(response.status, response.parsedBody || response.bodyAsText);
40
39
  }
41
40
  });
42
41
  }
43
- mapScopesToResource(scopes) {
44
- let scope = "";
45
- if (Array.isArray(scopes)) {
46
- if (scopes.length !== 1) {
47
- throw "To convert to a resource string the specified array must be exactly length 1";
48
- }
49
- scope = scopes[0];
50
- }
51
- else if (typeof scopes === "string") {
52
- scope = scopes;
53
- }
54
- if (!scope.endsWith(DefaultScopeSuffix)) {
55
- return scope;
56
- }
57
- return scope.substr(0, scope.lastIndexOf(DefaultScopeSuffix));
58
- }
59
- dateInSeconds(date) {
60
- return Math.floor(date.getTime() / 1000);
61
- }
62
- addMinutes(date, minutes) {
63
- date.setMinutes(date.getMinutes() + minutes);
64
- return date;
65
- }
66
- createImdsAuthRequest(resource, clientId) {
67
- const queryParameters = {
68
- resource,
69
- "api-version": ImdsApiVersion
70
- };
71
- if (clientId) {
72
- queryParameters.client_id = clientId;
73
- }
74
- return {
75
- url: ImdsEndpoint,
76
- method: "GET",
77
- queryParameters,
78
- headers: {
79
- Accept: "application/json",
80
- Metadata: true
81
- }
82
- };
83
- }
84
- createAppServiceMsiAuthRequest(resource, clientId) {
85
- const queryParameters = {
86
- resource,
87
- "api-version": AppServiceMsiApiVersion,
88
- };
89
- if (clientId) {
90
- queryParameters.client_id = clientId;
91
- }
92
- return {
93
- url: process.env.MSI_ENDPOINT,
94
- method: "GET",
95
- queryParameters,
96
- headers: {
97
- Accept: "application/json",
98
- secret: process.env.MSI_SECRET
99
- }
100
- };
101
- }
102
- createCloudShellMsiAuthRequest(resource, clientId) {
103
- const body = {
104
- resource
105
- };
106
- if (clientId) {
107
- body.client_id = clientId;
108
- }
109
- return {
110
- url: process.env.MSI_ENDPOINT,
111
- method: "POST",
112
- body: qs.stringify(body),
113
- headers: {
114
- Accept: "application/json",
115
- Metadata: true,
116
- "Content-Type": "application/x-www-form-urlencoded"
117
- }
118
- };
119
- }
120
- pingImdsEndpoint(resource, clientId) {
42
+ refreshAccessToken(tenantId, clientId, scopes, refreshToken, clientSecret, expiresOnParser, options) {
121
43
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
122
- const request = this.createImdsAuthRequest(resource, clientId);
123
- // This will always be populated, but let's make TypeScript happy
124
- if (request.headers) {
125
- // Remove the Metadata header to invoke a request error from
126
- // IMDS endpoint
127
- delete request.headers.Metadata;
44
+ if (refreshToken === undefined) {
45
+ return null;
46
+ }
47
+ const refreshParams = {
48
+ grant_type: "refresh_token",
49
+ client_id: clientId,
50
+ refresh_token: refreshToken,
51
+ scope: scopes
52
+ };
53
+ if (clientSecret !== undefined) {
54
+ refreshParams.client_secret = clientSecret;
128
55
  }
129
- // Create a request with a 500 msec timeout since we expect that
130
- // not having a "Metadata" header should cause an error to be
131
- // returned quickly from the endpoint, proving its availability.
132
- const webResource = this.createWebResource(request);
133
- webResource.timeout = 500;
56
+ const webResource = this.createWebResource({
57
+ url: `${this.authorityHost}/${tenantId}/oauth2/v2.0/token`,
58
+ method: "POST",
59
+ disableJsonStringifyOnBody: true,
60
+ deserializationMapper: undefined,
61
+ body: qs.stringify(refreshParams),
62
+ headers: {
63
+ Accept: "application/json",
64
+ "Content-Type": "application/x-www-form-urlencoded"
65
+ },
66
+ abortSignal: options && options.abortSignal
67
+ });
134
68
  try {
135
- yield this.sendRequest(webResource);
69
+ return yield this.sendTokenRequest(webResource, expiresOnParser);
136
70
  }
137
71
  catch (err) {
138
- if (err instanceof RestError && err.code === RestError.REQUEST_SEND_ERROR) {
139
- // Either request failed or IMDS endpoint isn't available
140
- return false;
141
- }
142
- }
143
- // If we received any response, the endpoint is available
144
- return true;
145
- });
146
- }
147
- authenticateClientSecret(tenantId, clientId, clientSecret, scopes, getTokenOptions) {
148
- const webResource = this.createWebResource({
149
- url: `${this.baseUri}/${tenantId}/oauth2/v2.0/token`,
150
- method: "POST",
151
- disableJsonStringifyOnBody: true,
152
- deserializationMapper: undefined,
153
- body: qs.stringify({
154
- response_type: "token",
155
- grant_type: "client_credentials",
156
- client_id: clientId,
157
- client_secret: clientSecret,
158
- scope: typeof scopes === "string" ? scopes : scopes.join(" ")
159
- }),
160
- headers: {
161
- Accept: "application/json",
162
- "Content-Type": "application/x-www-form-urlencoded"
163
- },
164
- abortSignal: getTokenOptions && getTokenOptions.abortSignal
165
- });
166
- return this.sendTokenRequest(webResource);
167
- }
168
- authenticateManagedIdentity(scopes, checkIfImdsEndpointAvailable, clientId, getTokenOptions) {
169
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
170
- let authRequestOptions;
171
- const resource = this.mapScopesToResource(scopes);
172
- let expiresInParser;
173
- // Detect which type of environment we are running in
174
- if (process.env.MSI_ENDPOINT) {
175
- if (process.env.MSI_SECRET) {
176
- // Running in App Service
177
- authRequestOptions = this.createAppServiceMsiAuthRequest(resource, clientId);
178
- expiresInParser = (requestBody) => {
179
- // Parse a date format like "06/20/2019 02:57:58 +00:00" and
180
- // convert it into a JavaScript-formatted date
181
- const m = requestBody.expires_on.match(/(\d\d)\/(\d\d)\/(\d\d\d\d) (\d\d):(\d\d):(\d\d) (\+|-)(\d\d):(\d\d)/);
182
- return Date.parse(`${m[3]}-${m[1]}-${m[2]}T${m[4]}:${m[5]}:${m[6]}${m[7]}${m[8]}:${m[9]}`);
183
- };
184
- }
185
- else {
186
- // Running in Cloud Shell
187
- authRequestOptions = this.createCloudShellMsiAuthRequest(resource, clientId);
188
- }
189
- }
190
- else {
191
- // Ping the IMDS endpoint to see if it's available
192
- if (!checkIfImdsEndpointAvailable || (yield this.pingImdsEndpoint(resource, clientId))) {
193
- // Running in an Azure VM
194
- authRequestOptions = this.createImdsAuthRequest(resource, clientId);
72
+ if (err instanceof AuthenticationError && err.errorResponse.error === "interaction_required") {
73
+ // It's likely that the refresh token has expired, so
74
+ // return null so that the credential implementation will
75
+ // initiate the authentication flow again.
76
+ return null;
195
77
  }
196
78
  else {
197
- // Returning null tells the ManagedIdentityCredential that
198
- // no MSI authentication endpoints are available
199
- return null;
79
+ throw err;
200
80
  }
201
81
  }
202
- const webResource = this.createWebResource(Object.assign({ disableJsonStringifyOnBody: true, deserializationMapper: undefined, abortSignal: getTokenOptions && getTokenOptions.abortSignal }, authRequestOptions));
203
- return this.sendTokenRequest(webResource, expiresInParser);
204
- });
205
- }
206
- authenticateClientCertificate(tenantId, clientId, certificateString, certificateX5t, scopes, getTokenOptions) {
207
- const tokenId = uuid.v4();
208
- const audienceUrl = `${this.baseUri}/${tenantId}/oauth2/v2.0/token`;
209
- const header = {
210
- typ: "JWT",
211
- alg: "RS256",
212
- x5t: certificateX5t
213
- };
214
- const payload = {
215
- iss: clientId,
216
- sub: clientId,
217
- aud: audienceUrl,
218
- jti: tokenId,
219
- nbf: this.dateInSeconds(new Date()),
220
- exp: this.dateInSeconds(this.addMinutes(new Date(), SelfSignedJwtLifetimeMins))
221
- };
222
- const clientAssertion = jws.sign({
223
- header,
224
- payload,
225
- secret: certificateString
226
- });
227
- const webResource = this.createWebResource({
228
- url: audienceUrl,
229
- method: "POST",
230
- disableJsonStringifyOnBody: true,
231
- deserializationMapper: undefined,
232
- body: qs.stringify({
233
- response_type: "token",
234
- grant_type: "client_credentials",
235
- client_id: clientId,
236
- client_assertion_type: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
237
- client_assertion: clientAssertion,
238
- scope: typeof scopes === "string" ? scopes : scopes.join(" ")
239
- }),
240
- headers: {
241
- Accept: "application/json",
242
- "Content-Type": "application/x-www-form-urlencoded"
243
- },
244
- abortSignal: getTokenOptions && getTokenOptions.abortSignal
245
82
  });
246
- return this.sendTokenRequest(webResource);
247
83
  }
248
84
  static getDefaultOptions() {
249
85
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"identityClient.js","sourceRoot":"","sources":["../../../src/client/identityClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAEL,aAAa,EAGb,WAAW,EAEX,SAAS,EACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,yBAAyB,GAAG,EAAE,CAAC;AACrC,MAAM,oBAAoB,GAAG,mCAAmC,CAAC;AACjE,MAAM,kBAAkB,GAAG,WAAW,CAAC;AACvC,MAAM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IAAI,CAAC,aAAa,IAAI,QAAQ,oBAAoB;gBAC1D,MAAM,EAAE,MAAM;gBACd,0BAA0B,EAAE,IAAI;gBAChC,qBAAqB,EAAE,SAAS;gBAChC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC;gBACjC,OAAO,EAAE;oBACP,MAAM,EAAE,kBAAkB;oBAC1B,cAAc,EAAE,mCAAmC;iBACpD;gBACD,WAAW,EAAE,OAAO,IAAI,OAAO,CAAC,WAAW;aAC5C,CAAC,CAAC;YAEH,IAAI;gBACF,OAAO,MAAM,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;aAClE;YAAC,OAAO,GAAG,EAAE;gBACZ,IAAI,GAAG,YAAY,mBAAmB,IAAI,GAAG,CAAC,aAAa,CAAC,KAAK,KAAK,sBAAsB,EAAE;oBAC5F,qDAAqD;oBACrD,yDAAyD;oBACzD,0CAA0C;oBAC1C,OAAO,IAAI,CAAC;iBACb;qBAAM;oBACL,MAAM,GAAG,CAAC;iBACX;aACF;QACH,CAAC;KAAA;IAED,MAAM,CAAC,iBAAiB;QACtB,OAAO;YACL,aAAa,EAAE,oBAAoB;SACpC,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,7 @@
1
+ import { TokenCredential, GetTokenOptions, AccessToken } from "@azure/core-http";
2
+ import { IdentityClientOptions } from "../client/identityClient";
3
+ export declare class ClientCertificateCredential implements TokenCredential {
4
+ constructor(tenantId: string, clientId: string, certificatePath: string, options?: IdentityClientOptions);
5
+ getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null>;
6
+ }
7
+ //# sourceMappingURL=clientCertificateCredential.browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientCertificateCredential.browser.d.ts","sourceRoot":"","sources":["../../../src/credentials/clientCertificateCredential.browser.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAIjE,qBAAa,2BAA4B,YAAW,eAAe;gBAE/D,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,OAAO,CAAC,EAAE,qBAAqB;IAK1B,QAAQ,CACb,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,EACzB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;CAG/B"}
@@ -0,0 +1,12 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ const BrowserNotSupportedError = new Error("ClientCertificateCredential is not supported in the browser.");
4
+ export class ClientCertificateCredential {
5
+ constructor(tenantId, clientId, certificatePath, options) {
6
+ throw BrowserNotSupportedError;
7
+ }
8
+ getToken(scopes, options) {
9
+ throw BrowserNotSupportedError;
10
+ }
11
+ }
12
+ //# sourceMappingURL=clientCertificateCredential.browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clientCertificateCredential.browser.js","sourceRoot":"","sources":["../../../src/credentials/clientCertificateCredential.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,MAAM,wBAAwB,GAAG,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;AAE3G,MAAM,OAAO,2BAA2B;IACtC,YACE,QAAgB,EAChB,QAAgB,EAChB,eAAuB,EACvB,OAA+B;QAE/B,MAAM,wBAAwB,CAAC;IACjC,CAAC;IAEM,QAAQ,CACb,MAAyB,EACzB,OAAyB;QAEzB,MAAM,wBAAwB,CAAC;IACjC,CAAC;CACF"}
@@ -10,11 +10,11 @@ import { IdentityClientOptions } from "../client/identityClient";
10
10
  */
11
11
  export declare class ClientCertificateCredential implements TokenCredential {
12
12
  private identityClient;
13
- private _tenantId;
14
- private _clientId;
15
- private _certificateString;
16
- certificateThumbprint: string;
17
- certificateX5t: string;
13
+ private tenantId;
14
+ private clientId;
15
+ private certificateString;
16
+ private certificateThumbprint;
17
+ private certificateX5t;
18
18
  /**
19
19
  * Creates an instance of the ClientCertificateCredential with the details
20
20
  * needed to authenticate against Azure Active Directory with a certificate.
@@ -1 +1 @@
1
- {"version":3,"file":"clientCertificateCredential.d.ts","sourceRoot":"","sources":["../../../src/credentials/clientCertificateCredential.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAkB,MAAM,0BAA0B,CAAC;AAEjF;;;;;;;GAOG;AACH,qBAAa,2BAA4B,YAAW,eAAe;IACjE,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,kBAAkB,CAAS;IAE5B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,MAAM,CAAC;IAE9B;;;;;;;;OAQG;gBAED,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,OAAO,CAAC,EAAE,qBAAqB;IAyBjC;;;;;;;;;OASG;IACI,QAAQ,CACb,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,EACzB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;CAU/B"}
1
+ {"version":3,"file":"clientCertificateCredential.d.ts","sourceRoot":"","sources":["../../../src/credentials/clientCertificateCredential.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAkB,MAAM,0BAA0B,CAAC;AAajF;;;;;;;GAOG;AACH,qBAAa,2BAA4B,YAAW,eAAe;IACjE,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,qBAAqB,CAAS;IACtC,OAAO,CAAC,cAAc,CAAS;IAE/B;;;;;;;;OAQG;gBAED,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,OAAO,CAAC,EAAE,qBAAqB;IAyBjC;;;;;;;;;OASG;IACU,QAAQ,CACnB,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,EACzB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;CA+C/B"}
@@ -1,8 +1,20 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
+ import * as tslib_1 from "tslib";
4
+ import qs from "qs";
5
+ import jws from "jws";
6
+ import uuid from "uuid";
3
7
  import { readFileSync } from "fs";
4
8
  import { createHash } from "crypto";
5
9
  import { IdentityClient } from "../client/identityClient";
10
+ const SelfSignedJwtLifetimeMins = 10;
11
+ function timestampInSeconds(date) {
12
+ return Math.floor(date.getTime() / 1000);
13
+ }
14
+ function addMinutes(date, minutes) {
15
+ date.setMinutes(date.getMinutes() + minutes);
16
+ return date;
17
+ }
6
18
  /**
7
19
  * Enables authentication to Azure Active Directory using a PEM-encoded
8
20
  * certificate that is assigned to an App Registration. More information
@@ -23,11 +35,11 @@ export class ClientCertificateCredential {
23
35
  */
24
36
  constructor(tenantId, clientId, certificatePath, options) {
25
37
  this.identityClient = new IdentityClient(options);
26
- this._tenantId = tenantId;
27
- this._clientId = clientId;
28
- this._certificateString = readFileSync(certificatePath, "utf8");
38
+ this.tenantId = tenantId;
39
+ this.clientId = clientId;
40
+ this.certificateString = readFileSync(certificatePath, "utf8");
29
41
  const certificatePattern = /(-+BEGIN CERTIFICATE-+)(\n\r?|\r\n?)([A-Za-z0-9+/\n\r]+=*)(\n\r?|\r\n?)(-+END CERTIFICATE-+)/;
30
- const matchCert = this._certificateString.match(certificatePattern);
42
+ const matchCert = this.certificateString.match(certificatePattern);
31
43
  const publicKey = matchCert ? matchCert[3] : "";
32
44
  if (!publicKey) {
33
45
  throw new Error("The file at the specified path does not contain a PEM-encoded certificate.");
@@ -49,7 +61,49 @@ export class ClientCertificateCredential {
49
61
  * TokenCredential implementation might make.
50
62
  */
51
63
  getToken(scopes, options) {
52
- return this.identityClient.authenticateClientCertificate(this._tenantId, this._clientId, this._certificateString, this.certificateX5t, scopes, options);
64
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
65
+ const tokenId = uuid.v4();
66
+ const audienceUrl = `${this.identityClient.authorityHost}/${this.tenantId}/oauth2/v2.0/token`;
67
+ const header = {
68
+ typ: "JWT",
69
+ alg: "RS256",
70
+ x5t: this.certificateX5t
71
+ };
72
+ const payload = {
73
+ iss: this.clientId,
74
+ sub: this.clientId,
75
+ aud: audienceUrl,
76
+ jti: tokenId,
77
+ nbf: timestampInSeconds(new Date()),
78
+ exp: timestampInSeconds(addMinutes(new Date(), SelfSignedJwtLifetimeMins))
79
+ };
80
+ const clientAssertion = jws.sign({
81
+ header,
82
+ payload,
83
+ secret: this.certificateString
84
+ });
85
+ const webResource = this.identityClient.createWebResource({
86
+ url: audienceUrl,
87
+ method: "POST",
88
+ disableJsonStringifyOnBody: true,
89
+ deserializationMapper: undefined,
90
+ body: qs.stringify({
91
+ response_type: "token",
92
+ grant_type: "client_credentials",
93
+ client_id: this.clientId,
94
+ client_assertion_type: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
95
+ client_assertion: clientAssertion,
96
+ scope: typeof scopes === "string" ? scopes : scopes.join(" ")
97
+ }),
98
+ headers: {
99
+ Accept: "application/json",
100
+ "Content-Type": "application/x-www-form-urlencoded"
101
+ },
102
+ abortSignal: options && options.abortSignal
103
+ });
104
+ const tokenResponse = yield this.identityClient.sendTokenRequest(webResource);
105
+ return (tokenResponse && tokenResponse.accessToken) || null;
106
+ });
53
107
  }
54
108
  }
55
109
  //# sourceMappingURL=clientCertificateCredential.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clientCertificateCredential.js","sourceRoot":"","sources":["../../../src/credentials/clientCertificateCredential.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EAAyB,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAEjF;;;;;;;GAOG;AACH,MAAM,OAAO,2BAA2B;IAStC;;;;;;;;OAQG;IACH,YACE,QAAgB,EAChB,QAAgB,EAChB,eAAuB,EACvB,OAA+B;QAE/B,IAAI,CAAC,cAAc,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAE1B,IAAI,CAAC,kBAAkB,GAAG,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;QAEhE,MAAM,kBAAkB,GAAG,8FAA8F,CAAC;QAC1H,MAAM,SAAS,GAAG,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACpE,MAAM,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAChD,IAAI,CAAC,SAAS,EAAE;YACd,MAAM,IAAI,KAAK,CACb,4EAA4E,CAC7E,CAAC;SACH;QAED,IAAI,CAAC,qBAAqB,GAAG,UAAU,CAAC,MAAM,CAAC;aAC5C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;aACxC,MAAM,CAAC,KAAK,CAAC;aACb,WAAW,EAAE,CAAC;QAEjB,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC1F,CAAC;IAED;;;;;;;;;OASG;IACI,QAAQ,CACb,MAAyB,EACzB,OAAyB;QAEzB,OAAO,IAAI,CAAC,cAAc,CAAC,6BAA6B,CACtD,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,kBAAkB,EACvB,IAAI,CAAC,cAAc,EACnB,MAAM,EACN,OAAO,CACR,CAAC;IACJ,CAAC;CACF"}
1
+ {"version":3,"file":"clientCertificateCredential.js","sourceRoot":"","sources":["../../../src/credentials/clientCertificateCredential.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EAAyB,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAEjF,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAErC,SAAS,kBAAkB,CAAC,IAAU;IACpC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;AAC3C,CAAC;AAED,SAAS,UAAU,CAAC,IAAU,EAAE,OAAe;IAC7C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,OAAO,CAAC,CAAC;IAC7C,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,2BAA2B;IAQtC;;;;;;;;OAQG;IACH,YACE,QAAgB,EAChB,QAAgB,EAChB,eAAuB,EACvB,OAA+B;QAE/B,IAAI,CAAC,cAAc,GAAG,IAAI,cAAc,CAAC,OA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ClientOptions } from "../client/identityClient";
10
10
  */
11
11
  export declare class ClientSecretCredential implements TokenCredential {
12
12
  private identityClient;
13
- private _tenantId;
14
- private _clientId;
15
- private _clientSecret;
13
+ private tenantId;
14
+ private clientId;
15
+ private clientSecret;
16
16
  /**
17
17
  * Creates an instance of the ClientSecretCredential with the details
18
18
  * needed to authenticate against Azure Active Directory with a client
@@ -1 +1 @@
1
- {"version":3,"file":"clientSecretCredential.d.ts","sourceRoot":"","sources":["../../../src/credentials/clientSecretCredential.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAkB,MAAM,0BAA0B,CAAC;AAEjF;;;;;;;GAOG;AACH,qBAAa,sBAAuB,YAAW,eAAe;IAC5D,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,aAAa,CAAS;IAE9B;;;;;;;;;OASG;gBAED,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,qBAAqB;IAQjC;;;;;;;;;OASG;IACI,QAAQ,CACb,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,EACzB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;CAS/B"}
1
+ {"version":3,"file":"clientSecretCredential.d.ts","sourceRoot":"","sources":["../../../src/credentials/clientSecretCredential.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAkB,MAAM,0BAA0B,CAAC;AAEjF;;;;;;;GAOG;AACH,qBAAa,sBAAuB,YAAW,eAAe;IAC5D,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,YAAY,CAAS;IAE7B;;;;;;;;;OASG;gBAED,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,qBAAqB;IAQjC;;;;;;;;;OASG;IACU,QAAQ,CACnB,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,EACzB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;CAuB/B"}
@@ -1,5 +1,7 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
+ import * as tslib_1 from "tslib";
4
+ import qs from "qs";
3
5
  import { IdentityClient } from "../client/identityClient";
4
6
  /**
5
7
  * Enables authentication to Azure Active Directory using a client secret
@@ -22,9 +24,9 @@ export class ClientSecretCredential {
22
24
  */
23
25
  constructor(tenantId, clientId, clientSecret, options) {
24
26
  this.identityClient = new IdentityClient(options);
25
- this._tenantId = tenantId;
26
- this._clientId = clientId;
27
- this._clientSecret = clientSecret;
27
+ this.tenantId = tenantId;
28
+ this.clientId = clientId;
29
+ this.clientSecret = clientSecret;
28
30
  }
29
31
  /**
30
32
  * Authenticates with Azure Active Directory and returns an {@link AccessToken} if
@@ -37,7 +39,28 @@ export class ClientSecretCredential {
37
39
  * TokenCredential implementation might make.
38
40
  */
39
41
  getToken(scopes, options) {
40
- return this.identityClient.authenticateClientSecret(this._tenantId, this._clientId, this._clientSecret, scopes, options);
42
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
43
+ const webResource = this.identityClient.createWebResource({
44
+ url: `${this.identityClient.authorityHost}/${this.tenantId}/oauth2/v2.0/token`,
45
+ method: "POST",
46
+ disableJsonStringifyOnBody: true,
47
+ deserializationMapper: undefined,
48
+ body: qs.stringify({
49
+ response_type: "token",
50
+ grant_type: "client_credentials",
51
+ client_id: this.clientId,
52
+ client_secret: this.clientSecret,
53
+ scope: typeof scopes === "string" ? scopes : scopes.join(" ")
54
+ }),
55
+ headers: {
56
+ Accept: "application/json",
57
+ "Content-Type": "application/x-www-form-urlencoded"
58
+ },
59
+ abortSignal: options && options.abortSignal
60
+ });
61
+ const tokenResponse = yield this.identityClient.sendTokenRequest(webResource);
62
+ return (tokenResponse && tokenResponse.accessToken) || null;
63
+ });
41
64
  }
42
65
  }
43
66
  //# sourceMappingURL=clientSecretCredential.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clientSecretCredential.js","sourceRoot":"","sources":["../../../src/credentials/clientSecretCredential.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAyB,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAEjF;;;;;;;GAOG;AACH,MAAM,OAAO,sBAAsB;IAMjC;;;;;;;;;OASG;IACH,YACE,QAAgB,EAChB,QAAgB,EAChB,YAAoB,EACpB,OAA+B;QAE/B,IAAI,CAAC,cAAc,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;IACpC,CAAC;IAED;;;;;;;;;OASG;IACI,QAAQ,CACb,MAAyB,EACzB,OAAyB;QAEzB,OAAO,IAAI,CAAC,cAAc,CAAC,wBAAwB,CACjD,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,aAAa,EAClB,MAAM,EACN,OAAO,CACR,CAAC;IACJ,CAAC;CACF"}
1
+ {"version":3,"file":"clientSecretCredential.js","sourceRoot":"","sources":["../../../src/credentials/clientSecretCredential.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,OAAO,EAAyB,cAAc,EAAE,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C,WAAW,CAAC,IAAI,IAAI,CAAC;QAC9D,CAAC;KAAA;CACF"}
@@ -0,0 +1,7 @@
1
+ import { TokenCredential, GetTokenOptions, AccessToken } from "@azure/core-http";
2
+ import { IdentityClientOptions } from "../client/identityClient";
3
+ export declare class DeviceCodeCredential implements TokenCredential {
4
+ constructor(tenantId: string, clientId: string, userPromptCallback: (details: any) => void, options?: IdentityClientOptions);
5
+ getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null>;
6
+ }
7
+ //# sourceMappingURL=deviceCodeCredential.browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deviceCodeCredential.browser.d.ts","sourceRoot":"","sources":["../../../src/credentials/deviceCodeCredential.browser.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAIjE,qBAAa,oBAAqB,YAAW,eAAe;gBAExD,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,kBAAkB,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,EAC1C,OAAO,CAAC,EAAE,qBAAqB;IAK1B,QAAQ,CACb,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,EACzB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;CAG/B"}
@@ -0,0 +1,12 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ const BrowserNotSupportedError = new Error("DeviceCodeCredential is not supported in the browser.");
4
+ export class DeviceCodeCredential {
5
+ constructor(tenantId, clientId, userPromptCallback, options) {
6
+ throw BrowserNotSupportedError;
7
+ }
8
+ getToken(scopes, options) {
9
+ throw BrowserNotSupportedError;
10
+ }
11
+ }
12
+ //# sourceMappingURL=deviceCodeCredential.browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deviceCodeCredential.browser.js","sourceRoot":"","sources":["../../../src/credentials/deviceCodeCredential.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,MAAM,wBAAwB,GAAG,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;AAEpG,MAAM,OAAO,oBAAoB;IAC/B,YACE,QAAgB,EAChB,QAAgB,EAChB,kBAA0C,EAC1C,OAA+B;QAE/B,MAAM,wBAAwB,CAAC;IACjC,CAAC;IAEM,QAAQ,CACb,MAAyB,EACzB,OAAyB;QAEzB,MAAM,wBAAwB,CAAC;IACjC,CAAC;CACF"}