@backstage/plugin-auth-backend 0.19.2 → 0.19.3-next.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 +54 -22
- package/config.d.ts +0 -12
- package/dist/index.cjs.js +79 -241
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/package.json +18 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,34 +1,66 @@
|
|
|
1
1
|
# @backstage/plugin-auth-backend
|
|
2
2
|
|
|
3
|
-
## 0.19.2
|
|
3
|
+
## 0.19.3-next.2
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
+
- 2d8f7e82c1: Migrated the Microsoft auth provider to new `@backstage/plugin-auth-backend-module-microsoft-provider` module package.
|
|
7
8
|
- Updated dependencies
|
|
8
|
-
- @backstage/
|
|
9
|
-
- @backstage/
|
|
10
|
-
- @backstage/
|
|
11
|
-
- @backstage/
|
|
12
|
-
- @backstage/plugin-auth-backend-module-
|
|
13
|
-
- @backstage/plugin-auth-backend-module-
|
|
14
|
-
- @backstage/plugin-auth-backend-module-
|
|
15
|
-
- @backstage/backend-
|
|
16
|
-
- @backstage/plugin-
|
|
9
|
+
- @backstage/backend-common@0.19.8-next.2
|
|
10
|
+
- @backstage/plugin-auth-node@0.4.0-next.2
|
|
11
|
+
- @backstage/catalog-model@1.4.3-next.0
|
|
12
|
+
- @backstage/errors@1.2.3-next.0
|
|
13
|
+
- @backstage/plugin-auth-backend-module-gcp-iap-provider@0.2.0-next.2
|
|
14
|
+
- @backstage/plugin-auth-backend-module-microsoft-provider@0.1.0-next.0
|
|
15
|
+
- @backstage/plugin-auth-backend-module-github-provider@0.1.3-next.2
|
|
16
|
+
- @backstage/plugin-auth-backend-module-gitlab-provider@0.1.3-next.2
|
|
17
|
+
- @backstage/plugin-auth-backend-module-oauth2-provider@0.1.3-next.2
|
|
18
|
+
- @backstage/plugin-catalog-node@1.4.7-next.2
|
|
19
|
+
- @backstage/backend-plugin-api@0.6.6-next.2
|
|
20
|
+
- @backstage/catalog-client@1.4.5-next.0
|
|
21
|
+
- @backstage/config@1.1.1-next.0
|
|
22
|
+
- @backstage/types@1.1.1
|
|
23
|
+
- @backstage/plugin-auth-backend-module-google-provider@0.1.3-next.2
|
|
24
|
+
|
|
25
|
+
## 0.19.2-next.1
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- Updated dependencies
|
|
30
|
+
- @backstage/plugin-catalog-node@1.4.6-next.1
|
|
31
|
+
- @backstage/backend-common@0.19.7-next.1
|
|
32
|
+
- @backstage/backend-plugin-api@0.6.5-next.1
|
|
33
|
+
- @backstage/plugin-auth-backend-module-github-provider@0.1.2-next.1
|
|
34
|
+
- @backstage/plugin-auth-backend-module-gitlab-provider@0.1.2-next.1
|
|
35
|
+
- @backstage/plugin-auth-backend-module-oauth2-provider@0.1.2-next.1
|
|
36
|
+
- @backstage/plugin-auth-node@0.3.2-next.1
|
|
37
|
+
- @backstage/config@1.1.0
|
|
38
|
+
- @backstage/catalog-client@1.4.4
|
|
39
|
+
- @backstage/catalog-model@1.4.2
|
|
40
|
+
- @backstage/errors@1.2.2
|
|
41
|
+
- @backstage/types@1.1.1
|
|
42
|
+
- @backstage/plugin-auth-backend-module-gcp-iap-provider@0.1.2-next.1
|
|
43
|
+
- @backstage/plugin-auth-backend-module-google-provider@0.1.2-next.1
|
|
17
44
|
|
|
18
|
-
## 0.19.
|
|
45
|
+
## 0.19.2-next.0
|
|
19
46
|
|
|
20
47
|
### Patch Changes
|
|
21
48
|
|
|
22
49
|
- Updated dependencies
|
|
23
|
-
- @backstage/plugin-auth-backend-module-github-provider@0.1.
|
|
24
|
-
- @backstage/plugin-auth-node@0.3.
|
|
25
|
-
- @backstage/backend-
|
|
26
|
-
- @backstage/
|
|
27
|
-
- @backstage/
|
|
28
|
-
- @backstage/
|
|
29
|
-
- @backstage/
|
|
30
|
-
- @backstage/
|
|
31
|
-
- @backstage/
|
|
50
|
+
- @backstage/plugin-auth-backend-module-github-provider@0.1.2-next.0
|
|
51
|
+
- @backstage/plugin-auth-node@0.3.2-next.0
|
|
52
|
+
- @backstage/backend-common@0.19.7-next.0
|
|
53
|
+
- @backstage/config@1.1.0
|
|
54
|
+
- @backstage/backend-plugin-api@0.6.5-next.0
|
|
55
|
+
- @backstage/catalog-client@1.4.4
|
|
56
|
+
- @backstage/catalog-model@1.4.2
|
|
57
|
+
- @backstage/errors@1.2.2
|
|
58
|
+
- @backstage/types@1.1.1
|
|
59
|
+
- @backstage/plugin-auth-backend-module-gcp-iap-provider@0.1.2-next.0
|
|
60
|
+
- @backstage/plugin-auth-backend-module-gitlab-provider@0.1.2-next.0
|
|
61
|
+
- @backstage/plugin-auth-backend-module-google-provider@0.1.2-next.0
|
|
62
|
+
- @backstage/plugin-auth-backend-module-oauth2-provider@0.1.2-next.0
|
|
63
|
+
- @backstage/plugin-catalog-node@1.4.6-next.0
|
|
32
64
|
|
|
33
65
|
## 0.19.0
|
|
34
66
|
|
|
@@ -372,7 +404,7 @@
|
|
|
372
404
|
### Patch Changes
|
|
373
405
|
|
|
374
406
|
- d8f774c30df: Enforce the secret visibility of certificates and client secrets in the auth backend. Also, document all known options for each auth plugin.
|
|
375
|
-
- 7908d72e033: Introduce a new global config parameter, `
|
|
407
|
+
- 7908d72e033: Introduce a new global config parameter, `enableExperimentalRedirectFlow`. When enabled, auth will happen with an in-window redirect flow rather than through a popup window.
|
|
376
408
|
- 475abd1dc3f: The `microsoft` (i.e. Azure) auth provider now supports negotiating tokens for
|
|
377
409
|
Azure resources besides Microsoft Graph (e.g. AKS, Virtual Machines, Machine
|
|
378
410
|
Learning Services, etc.). When the `/frame/handler` endpoint is called with an
|
|
@@ -458,7 +490,7 @@
|
|
|
458
490
|
### Patch Changes
|
|
459
491
|
|
|
460
492
|
- d8f774c30df: Enforce the secret visibility of certificates and client secrets in the auth backend. Also, document all known options for each auth plugin.
|
|
461
|
-
- 7908d72e033: Introduce a new global config parameter, `
|
|
493
|
+
- 7908d72e033: Introduce a new global config parameter, `enableExperimentalRedirectFlow`. When enabled, auth will happen with an in-window redirect flow rather than through a popup window.
|
|
462
494
|
- Updated dependencies
|
|
463
495
|
- @backstage/backend-common@0.18.4-next.0
|
|
464
496
|
- @backstage/config@1.0.7
|
package/config.d.ts
CHANGED
|
@@ -179,18 +179,6 @@ export interface Config {
|
|
|
179
179
|
};
|
|
180
180
|
};
|
|
181
181
|
/** @visibility frontend */
|
|
182
|
-
microsoft?: {
|
|
183
|
-
[authEnv: string]: {
|
|
184
|
-
clientId: string;
|
|
185
|
-
/**
|
|
186
|
-
* @visibility secret
|
|
187
|
-
*/
|
|
188
|
-
clientSecret: string;
|
|
189
|
-
tenantId: string;
|
|
190
|
-
callbackUrl?: string;
|
|
191
|
-
};
|
|
192
|
-
};
|
|
193
|
-
/** @visibility frontend */
|
|
194
182
|
onelogin?: {
|
|
195
183
|
[authEnv: string]: {
|
|
196
184
|
clientId: string;
|
package/dist/index.cjs.js
CHANGED
|
@@ -22,7 +22,7 @@ var pluginAuthBackendModuleGcpIapProvider = require('@backstage/plugin-auth-back
|
|
|
22
22
|
var pluginAuthBackendModuleGithubProvider = require('@backstage/plugin-auth-backend-module-github-provider');
|
|
23
23
|
var pluginAuthBackendModuleGitlabProvider = require('@backstage/plugin-auth-backend-module-gitlab-provider');
|
|
24
24
|
var pluginAuthBackendModuleGoogleProvider = require('@backstage/plugin-auth-backend-module-google-provider');
|
|
25
|
-
var
|
|
25
|
+
var pluginAuthBackendModuleMicrosoftProvider = require('@backstage/plugin-auth-backend-module-microsoft-provider');
|
|
26
26
|
var pluginAuthBackendModuleOauth2Provider = require('@backstage/plugin-auth-backend-module-oauth2-provider');
|
|
27
27
|
var openidClient = require('openid-client');
|
|
28
28
|
var passportOktaOauth = require('@davidzemon/passport-okta-oauth');
|
|
@@ -75,10 +75,10 @@ var session__default = /*#__PURE__*/_interopDefaultLegacy(session);
|
|
|
75
75
|
var connectSessionKnex__default = /*#__PURE__*/_interopDefaultLegacy(connectSessionKnex);
|
|
76
76
|
var passport__default = /*#__PURE__*/_interopDefaultLegacy(passport);
|
|
77
77
|
|
|
78
|
-
var __defProp$
|
|
79
|
-
var __defNormalProp$
|
|
80
|
-
var __publicField$
|
|
81
|
-
__defNormalProp$
|
|
78
|
+
var __defProp$g = Object.defineProperty;
|
|
79
|
+
var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
80
|
+
var __publicField$g = (obj, key, value) => {
|
|
81
|
+
__defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
82
82
|
return value;
|
|
83
83
|
};
|
|
84
84
|
const defaultScopes = ["offline_access", "read:me"];
|
|
@@ -95,7 +95,7 @@ class AtlassianStrategy extends OAuth2Strategy__default["default"] {
|
|
|
95
95
|
scope: Array.from(/* @__PURE__ */ new Set([...defaultScopes, ...scopes]))
|
|
96
96
|
};
|
|
97
97
|
super(optionsWithURLs, verify);
|
|
98
|
-
__publicField$
|
|
98
|
+
__publicField$g(this, "profileURL");
|
|
99
99
|
this.profileURL = "https://api.atlassian.com/me";
|
|
100
100
|
this.name = "atlassian";
|
|
101
101
|
this._oauth2.useAuthorizationHeaderforGET(true);
|
|
@@ -210,10 +210,10 @@ const ensuresXRequestedWith = (req) => {
|
|
|
210
210
|
|
|
211
211
|
const prepareBackstageIdentityResponse = pluginAuthNode.prepareBackstageIdentityResponse;
|
|
212
212
|
|
|
213
|
-
var __defProp$
|
|
214
|
-
var __defNormalProp$
|
|
215
|
-
var __publicField$
|
|
216
|
-
__defNormalProp$
|
|
213
|
+
var __defProp$f = Object.defineProperty;
|
|
214
|
+
var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
215
|
+
var __publicField$f = (obj, key, value) => {
|
|
216
|
+
__defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
217
217
|
return value;
|
|
218
218
|
};
|
|
219
219
|
const THOUSAND_DAYS_MS = 1e3 * 24 * 60 * 60 * 1e3;
|
|
@@ -222,8 +222,8 @@ class OAuthAdapter {
|
|
|
222
222
|
constructor(handlers, options) {
|
|
223
223
|
this.handlers = handlers;
|
|
224
224
|
this.options = options;
|
|
225
|
-
__publicField$
|
|
226
|
-
__publicField$
|
|
225
|
+
__publicField$f(this, "baseCookieOptions");
|
|
226
|
+
__publicField$f(this, "setNonceCookie", (res, nonce, cookieConfig) => {
|
|
227
227
|
res.cookie(`${this.options.providerId}-nonce`, nonce, {
|
|
228
228
|
maxAge: TEN_MINUTES_MS,
|
|
229
229
|
...this.baseCookieOptions,
|
|
@@ -231,34 +231,34 @@ class OAuthAdapter {
|
|
|
231
231
|
path: `${cookieConfig.path}/handler`
|
|
232
232
|
});
|
|
233
233
|
});
|
|
234
|
-
__publicField$
|
|
234
|
+
__publicField$f(this, "setGrantedScopeCookie", (res, scope, cookieConfig) => {
|
|
235
235
|
res.cookie(`${this.options.providerId}-granted-scope`, scope, {
|
|
236
236
|
maxAge: THOUSAND_DAYS_MS,
|
|
237
237
|
...this.baseCookieOptions,
|
|
238
238
|
...cookieConfig
|
|
239
239
|
});
|
|
240
240
|
});
|
|
241
|
-
__publicField$
|
|
241
|
+
__publicField$f(this, "getRefreshTokenFromCookie", (req) => {
|
|
242
242
|
return req.cookies[`${this.options.providerId}-refresh-token`];
|
|
243
243
|
});
|
|
244
|
-
__publicField$
|
|
244
|
+
__publicField$f(this, "getGrantedScopeFromCookie", (req) => {
|
|
245
245
|
return req.cookies[`${this.options.providerId}-granted-scope`];
|
|
246
246
|
});
|
|
247
|
-
__publicField$
|
|
247
|
+
__publicField$f(this, "setRefreshTokenCookie", (res, refreshToken, cookieConfig) => {
|
|
248
248
|
res.cookie(`${this.options.providerId}-refresh-token`, refreshToken, {
|
|
249
249
|
maxAge: THOUSAND_DAYS_MS,
|
|
250
250
|
...this.baseCookieOptions,
|
|
251
251
|
...cookieConfig
|
|
252
252
|
});
|
|
253
253
|
});
|
|
254
|
-
__publicField$
|
|
254
|
+
__publicField$f(this, "removeRefreshTokenCookie", (res, cookieConfig) => {
|
|
255
255
|
res.cookie(`${this.options.providerId}-refresh-token`, "", {
|
|
256
256
|
maxAge: 0,
|
|
257
257
|
...this.baseCookieOptions,
|
|
258
258
|
...cookieConfig
|
|
259
259
|
});
|
|
260
260
|
});
|
|
261
|
-
__publicField$
|
|
261
|
+
__publicField$f(this, "getCookieConfig", (origin) => {
|
|
262
262
|
return this.options.cookieConfigurer({
|
|
263
263
|
providerId: this.options.providerId,
|
|
264
264
|
baseUrl: this.options.baseUrl,
|
|
@@ -564,10 +564,10 @@ function createAuthProviderIntegration(config) {
|
|
|
564
564
|
});
|
|
565
565
|
}
|
|
566
566
|
|
|
567
|
-
var __defProp$
|
|
568
|
-
var __defNormalProp$
|
|
569
|
-
var __publicField$
|
|
570
|
-
__defNormalProp$
|
|
567
|
+
var __defProp$e = Object.defineProperty;
|
|
568
|
+
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
569
|
+
var __publicField$e = (obj, key, value) => {
|
|
570
|
+
__defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
571
571
|
return value;
|
|
572
572
|
};
|
|
573
573
|
const atlassianDefaultAuthHandler = async ({
|
|
@@ -578,10 +578,10 @@ const atlassianDefaultAuthHandler = async ({
|
|
|
578
578
|
});
|
|
579
579
|
class AtlassianAuthProvider {
|
|
580
580
|
constructor(options) {
|
|
581
|
-
__publicField$
|
|
582
|
-
__publicField$
|
|
583
|
-
__publicField$
|
|
584
|
-
__publicField$
|
|
581
|
+
__publicField$e(this, "_strategy");
|
|
582
|
+
__publicField$e(this, "signInResolver");
|
|
583
|
+
__publicField$e(this, "authHandler");
|
|
584
|
+
__publicField$e(this, "resolverContext");
|
|
585
585
|
this.resolverContext = options.resolverContext;
|
|
586
586
|
this.authHandler = options.authHandler;
|
|
587
587
|
this.signInResolver = options.signInResolver;
|
|
@@ -699,21 +699,21 @@ class Auth0Strategy extends Auth0InternalStrategy__default["default"] {
|
|
|
699
699
|
}
|
|
700
700
|
}
|
|
701
701
|
|
|
702
|
-
var __defProp$
|
|
703
|
-
var __defNormalProp$
|
|
704
|
-
var __publicField$
|
|
705
|
-
__defNormalProp$
|
|
702
|
+
var __defProp$d = Object.defineProperty;
|
|
703
|
+
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
704
|
+
var __publicField$d = (obj, key, value) => {
|
|
705
|
+
__defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
706
706
|
return value;
|
|
707
707
|
};
|
|
708
708
|
class Auth0AuthProvider {
|
|
709
709
|
constructor(options) {
|
|
710
|
-
__publicField$
|
|
711
|
-
__publicField$
|
|
712
|
-
__publicField$
|
|
713
|
-
__publicField$
|
|
714
|
-
__publicField$
|
|
715
|
-
__publicField$
|
|
716
|
-
__publicField$
|
|
710
|
+
__publicField$d(this, "_strategy");
|
|
711
|
+
__publicField$d(this, "signInResolver");
|
|
712
|
+
__publicField$d(this, "authHandler");
|
|
713
|
+
__publicField$d(this, "resolverContext");
|
|
714
|
+
__publicField$d(this, "audience");
|
|
715
|
+
__publicField$d(this, "connection");
|
|
716
|
+
__publicField$d(this, "connectionScope");
|
|
717
717
|
/**
|
|
718
718
|
* Due to passport-auth0 forcing options.state = true,
|
|
719
719
|
* passport-oauth2 requires express-session to be installed
|
|
@@ -722,7 +722,7 @@ class Auth0AuthProvider {
|
|
|
722
722
|
* passport-oauth2, which is the StateStore implementation used when options.state = false,
|
|
723
723
|
* allowing us to avoid using express-session in order to integrate with auth0.
|
|
724
724
|
*/
|
|
725
|
-
__publicField$
|
|
725
|
+
__publicField$d(this, "store", {
|
|
726
726
|
store(_req, cb) {
|
|
727
727
|
cb(null, null);
|
|
728
728
|
},
|
|
@@ -863,23 +863,23 @@ const auth0 = createAuthProviderIntegration({
|
|
|
863
863
|
}
|
|
864
864
|
});
|
|
865
865
|
|
|
866
|
-
var __defProp$
|
|
867
|
-
var __defNormalProp$
|
|
868
|
-
var __publicField$
|
|
869
|
-
__defNormalProp$
|
|
866
|
+
var __defProp$c = Object.defineProperty;
|
|
867
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
868
|
+
var __publicField$c = (obj, key, value) => {
|
|
869
|
+
__defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
870
870
|
return value;
|
|
871
871
|
};
|
|
872
872
|
const ALB_JWT_HEADER = "x-amzn-oidc-data";
|
|
873
873
|
const ALB_ACCESS_TOKEN_HEADER = "x-amzn-oidc-accesstoken";
|
|
874
874
|
class AwsAlbAuthProvider {
|
|
875
875
|
constructor(options) {
|
|
876
|
-
__publicField$
|
|
877
|
-
__publicField$
|
|
878
|
-
__publicField$
|
|
879
|
-
__publicField$
|
|
880
|
-
__publicField$
|
|
881
|
-
__publicField$
|
|
882
|
-
__publicField$
|
|
876
|
+
__publicField$c(this, "region");
|
|
877
|
+
__publicField$c(this, "issuer");
|
|
878
|
+
__publicField$c(this, "resolverContext");
|
|
879
|
+
__publicField$c(this, "keyCache");
|
|
880
|
+
__publicField$c(this, "authHandler");
|
|
881
|
+
__publicField$c(this, "signInResolver");
|
|
882
|
+
__publicField$c(this, "getKey", async (header) => {
|
|
883
883
|
if (!header.kid) {
|
|
884
884
|
throw new errors.AuthenticationError("No key id was specified in header");
|
|
885
885
|
}
|
|
@@ -1007,18 +1007,18 @@ const awsAlb = createAuthProviderIntegration({
|
|
|
1007
1007
|
}
|
|
1008
1008
|
});
|
|
1009
1009
|
|
|
1010
|
-
var __defProp$
|
|
1011
|
-
var __defNormalProp$
|
|
1012
|
-
var __publicField$
|
|
1013
|
-
__defNormalProp$
|
|
1010
|
+
var __defProp$b = Object.defineProperty;
|
|
1011
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1012
|
+
var __publicField$b = (obj, key, value) => {
|
|
1013
|
+
__defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1014
1014
|
return value;
|
|
1015
1015
|
};
|
|
1016
1016
|
class BitbucketAuthProvider {
|
|
1017
1017
|
constructor(options) {
|
|
1018
|
-
__publicField$
|
|
1019
|
-
__publicField$
|
|
1020
|
-
__publicField$
|
|
1021
|
-
__publicField$
|
|
1018
|
+
__publicField$b(this, "_strategy");
|
|
1019
|
+
__publicField$b(this, "signInResolver");
|
|
1020
|
+
__publicField$b(this, "authHandler");
|
|
1021
|
+
__publicField$b(this, "resolverContext");
|
|
1022
1022
|
this.signInResolver = options.signInResolver;
|
|
1023
1023
|
this.authHandler = options.authHandler;
|
|
1024
1024
|
this.resolverContext = options.resolverContext;
|
|
@@ -1186,10 +1186,10 @@ const commonByEmailResolver = async (info, ctx) => {
|
|
|
1186
1186
|
});
|
|
1187
1187
|
};
|
|
1188
1188
|
|
|
1189
|
-
var __defProp$
|
|
1190
|
-
var __defNormalProp$
|
|
1191
|
-
var __publicField$
|
|
1192
|
-
__defNormalProp$
|
|
1189
|
+
var __defProp$a = Object.defineProperty;
|
|
1190
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1191
|
+
var __publicField$a = (obj, key, value) => {
|
|
1192
|
+
__defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1193
1193
|
return value;
|
|
1194
1194
|
};
|
|
1195
1195
|
const CF_JWT_HEADER = "cf-access-jwt-assertion";
|
|
@@ -1197,12 +1197,12 @@ const COOKIE_AUTH_NAME = "CF_Authorization";
|
|
|
1197
1197
|
const CACHE_PREFIX = "providers/cloudflare-access/profile-v1";
|
|
1198
1198
|
class CloudflareAccessAuthProvider {
|
|
1199
1199
|
constructor(options) {
|
|
1200
|
-
__publicField$
|
|
1201
|
-
__publicField$
|
|
1202
|
-
__publicField$
|
|
1203
|
-
__publicField$
|
|
1204
|
-
__publicField$
|
|
1205
|
-
__publicField$
|
|
1200
|
+
__publicField$a(this, "teamName");
|
|
1201
|
+
__publicField$a(this, "resolverContext");
|
|
1202
|
+
__publicField$a(this, "authHandler");
|
|
1203
|
+
__publicField$a(this, "signInResolver");
|
|
1204
|
+
__publicField$a(this, "jwtKeySet");
|
|
1205
|
+
__publicField$a(this, "cache");
|
|
1206
1206
|
this.teamName = options.teamName;
|
|
1207
1207
|
this.authHandler = options.authHandler;
|
|
1208
1208
|
this.signInResolver = options.signInResolver;
|
|
@@ -1496,184 +1496,20 @@ const google = createAuthProviderIntegration({
|
|
|
1496
1496
|
})
|
|
1497
1497
|
});
|
|
1498
1498
|
|
|
1499
|
-
const BACKSTAGE_SESSION_EXPIRATION = 3600;
|
|
1500
|
-
|
|
1501
|
-
var __defProp$a = Object.defineProperty;
|
|
1502
|
-
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1503
|
-
var __publicField$a = (obj, key, value) => {
|
|
1504
|
-
__defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1505
|
-
return value;
|
|
1506
|
-
};
|
|
1507
|
-
class MicrosoftAuthProvider {
|
|
1508
|
-
constructor(options) {
|
|
1509
|
-
__publicField$a(this, "_strategy");
|
|
1510
|
-
__publicField$a(this, "signInResolver");
|
|
1511
|
-
__publicField$a(this, "authHandler");
|
|
1512
|
-
__publicField$a(this, "logger");
|
|
1513
|
-
__publicField$a(this, "resolverContext");
|
|
1514
|
-
__publicField$a(this, "skipUserProfile", (accessToken) => {
|
|
1515
|
-
const { aud, scp } = jose.decodeJwt(accessToken);
|
|
1516
|
-
const hasGraphReadScope = aud === "00000003-0000-0000-c000-000000000000" && scp.split(" ").map((s) => s.toLowerCase()).includes("user.read");
|
|
1517
|
-
return !hasGraphReadScope;
|
|
1518
|
-
});
|
|
1519
|
-
this.signInResolver = options.signInResolver;
|
|
1520
|
-
this.authHandler = options.authHandler;
|
|
1521
|
-
this.logger = options.logger;
|
|
1522
|
-
this.resolverContext = options.resolverContext;
|
|
1523
|
-
this._strategy = new passportMicrosoft.Strategy(
|
|
1524
|
-
{
|
|
1525
|
-
clientID: options.clientId,
|
|
1526
|
-
clientSecret: options.clientSecret,
|
|
1527
|
-
callbackURL: options.callbackUrl,
|
|
1528
|
-
authorizationURL: options.authorizationUrl,
|
|
1529
|
-
tokenURL: options.tokenUrl,
|
|
1530
|
-
passReqToCallback: false,
|
|
1531
|
-
skipUserProfile: (accessToken, done) => {
|
|
1532
|
-
done(null, this.skipUserProfile(accessToken));
|
|
1533
|
-
}
|
|
1534
|
-
},
|
|
1535
|
-
(accessToken, refreshToken, params, fullProfile, done) => {
|
|
1536
|
-
done(void 0, { fullProfile, accessToken, params }, { refreshToken });
|
|
1537
|
-
}
|
|
1538
|
-
);
|
|
1539
|
-
}
|
|
1540
|
-
async start(req) {
|
|
1541
|
-
return await executeRedirectStrategy(req, this._strategy, {
|
|
1542
|
-
scope: req.scope,
|
|
1543
|
-
state: encodeState(req.state)
|
|
1544
|
-
});
|
|
1545
|
-
}
|
|
1546
|
-
async handler(req) {
|
|
1547
|
-
const { result, privateInfo } = await executeFrameHandlerStrategy(req, this._strategy);
|
|
1548
|
-
return {
|
|
1549
|
-
response: await this.handleResult(result),
|
|
1550
|
-
refreshToken: privateInfo.refreshToken
|
|
1551
|
-
};
|
|
1552
|
-
}
|
|
1553
|
-
async refresh(req) {
|
|
1554
|
-
const { accessToken, refreshToken, params } = await executeRefreshTokenStrategy(
|
|
1555
|
-
this._strategy,
|
|
1556
|
-
req.refreshToken,
|
|
1557
|
-
req.scope
|
|
1558
|
-
);
|
|
1559
|
-
return {
|
|
1560
|
-
response: await this.handleResult({
|
|
1561
|
-
params,
|
|
1562
|
-
accessToken,
|
|
1563
|
-
...!this.skipUserProfile(accessToken) && {
|
|
1564
|
-
fullProfile: await executeFetchUserProfileStrategy(
|
|
1565
|
-
this._strategy,
|
|
1566
|
-
accessToken
|
|
1567
|
-
)
|
|
1568
|
-
}
|
|
1569
|
-
}),
|
|
1570
|
-
refreshToken
|
|
1571
|
-
};
|
|
1572
|
-
}
|
|
1573
|
-
async handleResult(result) {
|
|
1574
|
-
let profile = {};
|
|
1575
|
-
if (result.fullProfile) {
|
|
1576
|
-
const photo = await this.getUserPhoto(result.accessToken);
|
|
1577
|
-
result.fullProfile.photos = photo ? [{ value: photo }] : void 0;
|
|
1578
|
-
({ profile } = await this.authHandler(
|
|
1579
|
-
result,
|
|
1580
|
-
this.resolverContext
|
|
1581
|
-
));
|
|
1582
|
-
}
|
|
1583
|
-
const expiresInSeconds = result.params.expires_in === void 0 ? BACKSTAGE_SESSION_EXPIRATION : Math.min(result.params.expires_in, BACKSTAGE_SESSION_EXPIRATION);
|
|
1584
|
-
return {
|
|
1585
|
-
providerInfo: {
|
|
1586
|
-
accessToken: result.accessToken,
|
|
1587
|
-
scope: result.params.scope,
|
|
1588
|
-
expiresInSeconds,
|
|
1589
|
-
...{ idToken: result.params.id_token }
|
|
1590
|
-
},
|
|
1591
|
-
profile,
|
|
1592
|
-
...result.fullProfile && this.signInResolver && {
|
|
1593
|
-
backstageIdentity: await this.signInResolver(
|
|
1594
|
-
{ result, profile },
|
|
1595
|
-
this.resolverContext
|
|
1596
|
-
)
|
|
1597
|
-
}
|
|
1598
|
-
};
|
|
1599
|
-
}
|
|
1600
|
-
async getUserPhoto(accessToken) {
|
|
1601
|
-
try {
|
|
1602
|
-
const res = await fetch__default["default"](
|
|
1603
|
-
"https://graph.microsoft.com/v1.0/me/photos/48x48/$value",
|
|
1604
|
-
{
|
|
1605
|
-
headers: {
|
|
1606
|
-
Authorization: `Bearer ${accessToken}`
|
|
1607
|
-
}
|
|
1608
|
-
}
|
|
1609
|
-
);
|
|
1610
|
-
const data = await res.buffer();
|
|
1611
|
-
return `data:image/jpeg;base64,${data.toString("base64")}`;
|
|
1612
|
-
} catch (error) {
|
|
1613
|
-
this.logger.warn(
|
|
1614
|
-
`Could not retrieve user profile photo from Microsoft Graph API: ${error}`
|
|
1615
|
-
);
|
|
1616
|
-
return void 0;
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1619
|
-
}
|
|
1620
1499
|
const microsoft = createAuthProviderIntegration({
|
|
1621
1500
|
create(options) {
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
const customCallbackUrl = envConfig.getOptionalString("callbackUrl");
|
|
1628
|
-
const callbackUrl = customCallbackUrl || `${globalConfig.baseUrl}/${providerId}/handler/frame`;
|
|
1629
|
-
const authorizationUrl = `https://login.microsoftonline.com/${tenantId}/oauth2/v2.0/authorize`;
|
|
1630
|
-
const tokenUrl = `https://login.microsoftonline.com/${tenantId}/oauth2/v2.0/token`;
|
|
1631
|
-
const authHandler = (options == null ? void 0 : options.authHandler) ? options.authHandler : async ({ fullProfile, params }) => ({
|
|
1632
|
-
profile: makeProfileInfo(fullProfile != null ? fullProfile : {}, params.id_token)
|
|
1633
|
-
});
|
|
1634
|
-
const provider = new MicrosoftAuthProvider({
|
|
1635
|
-
clientId,
|
|
1636
|
-
clientSecret,
|
|
1637
|
-
callbackUrl,
|
|
1638
|
-
authorizationUrl,
|
|
1639
|
-
tokenUrl,
|
|
1640
|
-
authHandler,
|
|
1641
|
-
signInResolver: (_a = options == null ? void 0 : options.signIn) == null ? void 0 : _a.resolver,
|
|
1642
|
-
logger,
|
|
1643
|
-
resolverContext
|
|
1644
|
-
});
|
|
1645
|
-
return OAuthAdapter.fromConfig(globalConfig, provider, {
|
|
1646
|
-
providerId,
|
|
1647
|
-
callbackUrl
|
|
1648
|
-
});
|
|
1501
|
+
var _a;
|
|
1502
|
+
return pluginAuthNode.createOAuthProviderFactory({
|
|
1503
|
+
authenticator: pluginAuthBackendModuleMicrosoftProvider.microsoftAuthenticator,
|
|
1504
|
+
profileTransform: adaptLegacyOAuthHandler(options == null ? void 0 : options.authHandler),
|
|
1505
|
+
signInResolver: adaptLegacyOAuthSignInResolver((_a = options == null ? void 0 : options.signIn) == null ? void 0 : _a.resolver)
|
|
1649
1506
|
});
|
|
1650
1507
|
},
|
|
1651
|
-
resolvers: {
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
/**
|
|
1657
|
-
* Looks up the user by matching their email to the entity email.
|
|
1658
|
-
*/
|
|
1659
|
-
emailMatchingUserEntityProfileEmail: () => commonByEmailResolver,
|
|
1660
|
-
/**
|
|
1661
|
-
* Looks up the user by matching their email to the `microsoft.com/email` annotation.
|
|
1662
|
-
*/
|
|
1663
|
-
emailMatchingUserEntityAnnotation() {
|
|
1664
|
-
return async (info, ctx) => {
|
|
1665
|
-
const { profile } = info;
|
|
1666
|
-
if (!profile.email) {
|
|
1667
|
-
throw new Error("Microsoft profile contained no email");
|
|
1668
|
-
}
|
|
1669
|
-
return ctx.signInWithCatalogUser({
|
|
1670
|
-
annotations: {
|
|
1671
|
-
"microsoft.com/email": profile.email
|
|
1672
|
-
}
|
|
1673
|
-
});
|
|
1674
|
-
};
|
|
1675
|
-
}
|
|
1676
|
-
}
|
|
1508
|
+
resolvers: adaptOAuthSignInResolverToLegacy({
|
|
1509
|
+
emailLocalPartMatchingUserEntityName: pluginAuthNode.commonSignInResolvers.emailLocalPartMatchingUserEntityName(),
|
|
1510
|
+
emailMatchingUserEntityProfileEmail: pluginAuthNode.commonSignInResolvers.emailMatchingUserEntityProfileEmail(),
|
|
1511
|
+
emailMatchingUserEntityAnnotation: pluginAuthBackendModuleMicrosoftProvider.microsoftSignInResolvers.emailMatchingUserEntityAnnotation()
|
|
1512
|
+
})
|
|
1677
1513
|
});
|
|
1678
1514
|
|
|
1679
1515
|
const oauth2 = createAuthProviderIntegration({
|
|
@@ -1773,6 +1609,8 @@ const oauth2Proxy = createAuthProviderIntegration({
|
|
|
1773
1609
|
}
|
|
1774
1610
|
});
|
|
1775
1611
|
|
|
1612
|
+
const BACKSTAGE_SESSION_EXPIRATION = 3600;
|
|
1613
|
+
|
|
1776
1614
|
var __defProp$8 = Object.defineProperty;
|
|
1777
1615
|
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1778
1616
|
var __publicField$8 = (obj, key, value) => {
|