@backstage/plugin-auth-backend 0.18.8-next.0 → 0.18.9-next.1
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 +20 -0
- package/config.d.ts +0 -12
- package/dist/index.cjs.js +78 -192
- package/dist/index.cjs.js.map +1 -1
- package/package.json +15 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @backstage/plugin-auth-backend
|
|
2
2
|
|
|
3
|
+
## 0.18.9-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 080cc7794700: Migrated the GitLab auth provider to be implemented using the new `@backstage/plugin-auth-backend-module-gitlab-provider` module.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/config@1.1.0-next.0
|
|
10
|
+
- @backstage/plugin-auth-backend-module-gitlab-provider@0.1.0-next.0
|
|
11
|
+
- @backstage/plugin-auth-backend-module-github-provider@0.1.0-next.1
|
|
12
|
+
- @backstage/plugin-auth-backend-module-google-provider@0.1.0-next.1
|
|
13
|
+
- @backstage/backend-common@0.19.5-next.1
|
|
14
|
+
- @backstage/backend-plugin-api@0.6.3-next.1
|
|
15
|
+
- @backstage/catalog-model@1.4.2-next.0
|
|
16
|
+
- @backstage/plugin-auth-node@0.3.0-next.1
|
|
17
|
+
- @backstage/plugin-catalog-node@1.4.4-next.1
|
|
18
|
+
- @backstage/plugin-auth-backend-module-gcp-iap-provider@0.1.0-next.1
|
|
19
|
+
- @backstage/catalog-client@1.4.4-next.0
|
|
20
|
+
- @backstage/errors@1.2.1
|
|
21
|
+
- @backstage/types@1.1.0
|
|
22
|
+
|
|
3
23
|
## 0.18.8-next.0
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/config.d.ts
CHANGED
|
@@ -96,18 +96,6 @@ export interface Config {
|
|
|
96
96
|
};
|
|
97
97
|
};
|
|
98
98
|
/** @visibility frontend */
|
|
99
|
-
gitlab?: {
|
|
100
|
-
[authEnv: string]: {
|
|
101
|
-
clientId: string;
|
|
102
|
-
/**
|
|
103
|
-
* @visibility secret
|
|
104
|
-
*/
|
|
105
|
-
clientSecret: string;
|
|
106
|
-
audience?: string;
|
|
107
|
-
callbackUrl?: string;
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
/** @visibility frontend */
|
|
111
99
|
saml?: {
|
|
112
100
|
entryPoint: string;
|
|
113
101
|
logoutUrl?: string;
|
package/dist/index.cjs.js
CHANGED
|
@@ -20,7 +20,7 @@ var jose = require('jose');
|
|
|
20
20
|
var passportBitbucketOauth2 = require('passport-bitbucket-oauth2');
|
|
21
21
|
var pluginAuthBackendModuleGcpIapProvider = require('@backstage/plugin-auth-backend-module-gcp-iap-provider');
|
|
22
22
|
var pluginAuthBackendModuleGithubProvider = require('@backstage/plugin-auth-backend-module-github-provider');
|
|
23
|
-
var
|
|
23
|
+
var pluginAuthBackendModuleGitlabProvider = require('@backstage/plugin-auth-backend-module-gitlab-provider');
|
|
24
24
|
var pluginAuthBackendModuleGoogleProvider = require('@backstage/plugin-auth-backend-module-google-provider');
|
|
25
25
|
var passportMicrosoft = require('passport-microsoft');
|
|
26
26
|
var openidClient = require('openid-client');
|
|
@@ -74,10 +74,10 @@ var session__default = /*#__PURE__*/_interopDefaultLegacy(session);
|
|
|
74
74
|
var connectSessionKnex__default = /*#__PURE__*/_interopDefaultLegacy(connectSessionKnex);
|
|
75
75
|
var passport__default = /*#__PURE__*/_interopDefaultLegacy(passport);
|
|
76
76
|
|
|
77
|
-
var __defProp$
|
|
78
|
-
var __defNormalProp$
|
|
79
|
-
var __publicField$
|
|
80
|
-
__defNormalProp$
|
|
77
|
+
var __defProp$i = Object.defineProperty;
|
|
78
|
+
var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
79
|
+
var __publicField$i = (obj, key, value) => {
|
|
80
|
+
__defNormalProp$i(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
81
81
|
return value;
|
|
82
82
|
};
|
|
83
83
|
const defaultScopes = ["offline_access", "read:me"];
|
|
@@ -94,7 +94,7 @@ class AtlassianStrategy extends OAuth2Strategy__default["default"] {
|
|
|
94
94
|
scope: Array.from(/* @__PURE__ */ new Set([...defaultScopes, ...scopes]))
|
|
95
95
|
};
|
|
96
96
|
super(optionsWithURLs, verify);
|
|
97
|
-
__publicField$
|
|
97
|
+
__publicField$i(this, "profileURL");
|
|
98
98
|
this.profileURL = "https://api.atlassian.com/me";
|
|
99
99
|
this.name = "atlassian";
|
|
100
100
|
this._oauth2.useAuthorizationHeaderforGET(true);
|
|
@@ -209,10 +209,10 @@ const ensuresXRequestedWith = (req) => {
|
|
|
209
209
|
|
|
210
210
|
const prepareBackstageIdentityResponse = pluginAuthNode.prepareBackstageIdentityResponse;
|
|
211
211
|
|
|
212
|
-
var __defProp$
|
|
213
|
-
var __defNormalProp$
|
|
214
|
-
var __publicField$
|
|
215
|
-
__defNormalProp$
|
|
212
|
+
var __defProp$h = Object.defineProperty;
|
|
213
|
+
var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
214
|
+
var __publicField$h = (obj, key, value) => {
|
|
215
|
+
__defNormalProp$h(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
216
216
|
return value;
|
|
217
217
|
};
|
|
218
218
|
const THOUSAND_DAYS_MS = 1e3 * 24 * 60 * 60 * 1e3;
|
|
@@ -221,8 +221,8 @@ class OAuthAdapter {
|
|
|
221
221
|
constructor(handlers, options) {
|
|
222
222
|
this.handlers = handlers;
|
|
223
223
|
this.options = options;
|
|
224
|
-
__publicField$
|
|
225
|
-
__publicField$
|
|
224
|
+
__publicField$h(this, "baseCookieOptions");
|
|
225
|
+
__publicField$h(this, "setNonceCookie", (res, nonce, cookieConfig) => {
|
|
226
226
|
res.cookie(`${this.options.providerId}-nonce`, nonce, {
|
|
227
227
|
maxAge: TEN_MINUTES_MS,
|
|
228
228
|
...this.baseCookieOptions,
|
|
@@ -230,34 +230,34 @@ class OAuthAdapter {
|
|
|
230
230
|
path: `${cookieConfig.path}/handler`
|
|
231
231
|
});
|
|
232
232
|
});
|
|
233
|
-
__publicField$
|
|
233
|
+
__publicField$h(this, "setGrantedScopeCookie", (res, scope, cookieConfig) => {
|
|
234
234
|
res.cookie(`${this.options.providerId}-granted-scope`, scope, {
|
|
235
235
|
maxAge: THOUSAND_DAYS_MS,
|
|
236
236
|
...this.baseCookieOptions,
|
|
237
237
|
...cookieConfig
|
|
238
238
|
});
|
|
239
239
|
});
|
|
240
|
-
__publicField$
|
|
240
|
+
__publicField$h(this, "getRefreshTokenFromCookie", (req) => {
|
|
241
241
|
return req.cookies[`${this.options.providerId}-refresh-token`];
|
|
242
242
|
});
|
|
243
|
-
__publicField$
|
|
243
|
+
__publicField$h(this, "getGrantedScopeFromCookie", (req) => {
|
|
244
244
|
return req.cookies[`${this.options.providerId}-granted-scope`];
|
|
245
245
|
});
|
|
246
|
-
__publicField$
|
|
246
|
+
__publicField$h(this, "setRefreshTokenCookie", (res, refreshToken, cookieConfig) => {
|
|
247
247
|
res.cookie(`${this.options.providerId}-refresh-token`, refreshToken, {
|
|
248
248
|
maxAge: THOUSAND_DAYS_MS,
|
|
249
249
|
...this.baseCookieOptions,
|
|
250
250
|
...cookieConfig
|
|
251
251
|
});
|
|
252
252
|
});
|
|
253
|
-
__publicField$
|
|
253
|
+
__publicField$h(this, "removeRefreshTokenCookie", (res, cookieConfig) => {
|
|
254
254
|
res.cookie(`${this.options.providerId}-refresh-token`, "", {
|
|
255
255
|
maxAge: 0,
|
|
256
256
|
...this.baseCookieOptions,
|
|
257
257
|
...cookieConfig
|
|
258
258
|
});
|
|
259
259
|
});
|
|
260
|
-
__publicField$
|
|
260
|
+
__publicField$h(this, "getCookieConfig", (origin) => {
|
|
261
261
|
return this.options.cookieConfigurer({
|
|
262
262
|
providerId: this.options.providerId,
|
|
263
263
|
baseUrl: this.options.baseUrl,
|
|
@@ -563,10 +563,10 @@ function createAuthProviderIntegration(config) {
|
|
|
563
563
|
});
|
|
564
564
|
}
|
|
565
565
|
|
|
566
|
-
var __defProp$
|
|
567
|
-
var __defNormalProp$
|
|
568
|
-
var __publicField$
|
|
569
|
-
__defNormalProp$
|
|
566
|
+
var __defProp$g = Object.defineProperty;
|
|
567
|
+
var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
568
|
+
var __publicField$g = (obj, key, value) => {
|
|
569
|
+
__defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
570
570
|
return value;
|
|
571
571
|
};
|
|
572
572
|
const atlassianDefaultAuthHandler = async ({
|
|
@@ -577,10 +577,10 @@ const atlassianDefaultAuthHandler = async ({
|
|
|
577
577
|
});
|
|
578
578
|
class AtlassianAuthProvider {
|
|
579
579
|
constructor(options) {
|
|
580
|
-
__publicField$
|
|
581
|
-
__publicField$
|
|
582
|
-
__publicField$
|
|
583
|
-
__publicField$
|
|
580
|
+
__publicField$g(this, "_strategy");
|
|
581
|
+
__publicField$g(this, "signInResolver");
|
|
582
|
+
__publicField$g(this, "authHandler");
|
|
583
|
+
__publicField$g(this, "resolverContext");
|
|
584
584
|
this.resolverContext = options.resolverContext;
|
|
585
585
|
this.authHandler = options.authHandler;
|
|
586
586
|
this.signInResolver = options.signInResolver;
|
|
@@ -698,21 +698,21 @@ class Auth0Strategy extends Auth0InternalStrategy__default["default"] {
|
|
|
698
698
|
}
|
|
699
699
|
}
|
|
700
700
|
|
|
701
|
-
var __defProp$
|
|
702
|
-
var __defNormalProp$
|
|
703
|
-
var __publicField$
|
|
704
|
-
__defNormalProp$
|
|
701
|
+
var __defProp$f = Object.defineProperty;
|
|
702
|
+
var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
703
|
+
var __publicField$f = (obj, key, value) => {
|
|
704
|
+
__defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
705
705
|
return value;
|
|
706
706
|
};
|
|
707
707
|
class Auth0AuthProvider {
|
|
708
708
|
constructor(options) {
|
|
709
|
-
__publicField$
|
|
710
|
-
__publicField$
|
|
711
|
-
__publicField$
|
|
712
|
-
__publicField$
|
|
713
|
-
__publicField$
|
|
714
|
-
__publicField$
|
|
715
|
-
__publicField$
|
|
709
|
+
__publicField$f(this, "_strategy");
|
|
710
|
+
__publicField$f(this, "signInResolver");
|
|
711
|
+
__publicField$f(this, "authHandler");
|
|
712
|
+
__publicField$f(this, "resolverContext");
|
|
713
|
+
__publicField$f(this, "audience");
|
|
714
|
+
__publicField$f(this, "connection");
|
|
715
|
+
__publicField$f(this, "connectionScope");
|
|
716
716
|
/**
|
|
717
717
|
* Due to passport-auth0 forcing options.state = true,
|
|
718
718
|
* passport-oauth2 requires express-session to be installed
|
|
@@ -721,7 +721,7 @@ class Auth0AuthProvider {
|
|
|
721
721
|
* passport-oauth2, which is the StateStore implementation used when options.state = false,
|
|
722
722
|
* allowing us to avoid using express-session in order to integrate with auth0.
|
|
723
723
|
*/
|
|
724
|
-
__publicField$
|
|
724
|
+
__publicField$f(this, "store", {
|
|
725
725
|
store(_req, cb) {
|
|
726
726
|
cb(null, null);
|
|
727
727
|
},
|
|
@@ -862,23 +862,23 @@ const auth0 = createAuthProviderIntegration({
|
|
|
862
862
|
}
|
|
863
863
|
});
|
|
864
864
|
|
|
865
|
-
var __defProp$
|
|
866
|
-
var __defNormalProp$
|
|
867
|
-
var __publicField$
|
|
868
|
-
__defNormalProp$
|
|
865
|
+
var __defProp$e = Object.defineProperty;
|
|
866
|
+
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
867
|
+
var __publicField$e = (obj, key, value) => {
|
|
868
|
+
__defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
869
869
|
return value;
|
|
870
870
|
};
|
|
871
871
|
const ALB_JWT_HEADER = "x-amzn-oidc-data";
|
|
872
872
|
const ALB_ACCESS_TOKEN_HEADER = "x-amzn-oidc-accesstoken";
|
|
873
873
|
class AwsAlbAuthProvider {
|
|
874
874
|
constructor(options) {
|
|
875
|
-
__publicField$
|
|
876
|
-
__publicField$
|
|
877
|
-
__publicField$
|
|
878
|
-
__publicField$
|
|
879
|
-
__publicField$
|
|
880
|
-
__publicField$
|
|
881
|
-
__publicField$
|
|
875
|
+
__publicField$e(this, "region");
|
|
876
|
+
__publicField$e(this, "issuer");
|
|
877
|
+
__publicField$e(this, "resolverContext");
|
|
878
|
+
__publicField$e(this, "keyCache");
|
|
879
|
+
__publicField$e(this, "authHandler");
|
|
880
|
+
__publicField$e(this, "signInResolver");
|
|
881
|
+
__publicField$e(this, "getKey", async (header) => {
|
|
882
882
|
if (!header.kid) {
|
|
883
883
|
throw new errors.AuthenticationError("No key id was specified in header");
|
|
884
884
|
}
|
|
@@ -1006,18 +1006,18 @@ const awsAlb = createAuthProviderIntegration({
|
|
|
1006
1006
|
}
|
|
1007
1007
|
});
|
|
1008
1008
|
|
|
1009
|
-
var __defProp$
|
|
1010
|
-
var __defNormalProp$
|
|
1011
|
-
var __publicField$
|
|
1012
|
-
__defNormalProp$
|
|
1009
|
+
var __defProp$d = Object.defineProperty;
|
|
1010
|
+
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1011
|
+
var __publicField$d = (obj, key, value) => {
|
|
1012
|
+
__defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1013
1013
|
return value;
|
|
1014
1014
|
};
|
|
1015
1015
|
class BitbucketAuthProvider {
|
|
1016
1016
|
constructor(options) {
|
|
1017
|
-
__publicField$
|
|
1018
|
-
__publicField$
|
|
1019
|
-
__publicField$
|
|
1020
|
-
__publicField$
|
|
1017
|
+
__publicField$d(this, "_strategy");
|
|
1018
|
+
__publicField$d(this, "signInResolver");
|
|
1019
|
+
__publicField$d(this, "authHandler");
|
|
1020
|
+
__publicField$d(this, "resolverContext");
|
|
1021
1021
|
this.signInResolver = options.signInResolver;
|
|
1022
1022
|
this.authHandler = options.authHandler;
|
|
1023
1023
|
this.resolverContext = options.resolverContext;
|
|
@@ -1185,10 +1185,10 @@ const commonByEmailResolver = async (info, ctx) => {
|
|
|
1185
1185
|
});
|
|
1186
1186
|
};
|
|
1187
1187
|
|
|
1188
|
-
var __defProp$
|
|
1189
|
-
var __defNormalProp$
|
|
1190
|
-
var __publicField$
|
|
1191
|
-
__defNormalProp$
|
|
1188
|
+
var __defProp$c = Object.defineProperty;
|
|
1189
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1190
|
+
var __publicField$c = (obj, key, value) => {
|
|
1191
|
+
__defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1192
1192
|
return value;
|
|
1193
1193
|
};
|
|
1194
1194
|
const CF_JWT_HEADER = "cf-access-jwt-assertion";
|
|
@@ -1196,12 +1196,12 @@ const COOKIE_AUTH_NAME = "CF_Authorization";
|
|
|
1196
1196
|
const CACHE_PREFIX = "providers/cloudflare-access/profile-v1";
|
|
1197
1197
|
class CloudflareAccessAuthProvider {
|
|
1198
1198
|
constructor(options) {
|
|
1199
|
-
__publicField$
|
|
1200
|
-
__publicField$
|
|
1201
|
-
__publicField$
|
|
1202
|
-
__publicField$
|
|
1203
|
-
__publicField$
|
|
1204
|
-
__publicField$
|
|
1199
|
+
__publicField$c(this, "teamName");
|
|
1200
|
+
__publicField$c(this, "resolverContext");
|
|
1201
|
+
__publicField$c(this, "authHandler");
|
|
1202
|
+
__publicField$c(this, "signInResolver");
|
|
1203
|
+
__publicField$c(this, "jwtKeySet");
|
|
1204
|
+
__publicField$c(this, "cache");
|
|
1205
1205
|
this.teamName = options.teamName;
|
|
1206
1206
|
this.authHandler = options.authHandler;
|
|
1207
1207
|
this.signInResolver = options.signInResolver;
|
|
@@ -1404,131 +1404,6 @@ const github = createAuthProviderIntegration({
|
|
|
1404
1404
|
}
|
|
1405
1405
|
});
|
|
1406
1406
|
|
|
1407
|
-
var __defProp$c = Object.defineProperty;
|
|
1408
|
-
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1409
|
-
var __publicField$c = (obj, key, value) => {
|
|
1410
|
-
__defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1411
|
-
return value;
|
|
1412
|
-
};
|
|
1413
|
-
const gitlabDefaultAuthHandler = async ({
|
|
1414
|
-
fullProfile,
|
|
1415
|
-
params
|
|
1416
|
-
}) => ({
|
|
1417
|
-
profile: makeProfileInfo(fullProfile, params.id_token)
|
|
1418
|
-
});
|
|
1419
|
-
class GitlabAuthProvider {
|
|
1420
|
-
constructor(options) {
|
|
1421
|
-
__publicField$c(this, "_strategy");
|
|
1422
|
-
__publicField$c(this, "signInResolver");
|
|
1423
|
-
__publicField$c(this, "authHandler");
|
|
1424
|
-
__publicField$c(this, "resolverContext");
|
|
1425
|
-
this.resolverContext = options.resolverContext;
|
|
1426
|
-
this.authHandler = options.authHandler;
|
|
1427
|
-
this.signInResolver = options.signInResolver;
|
|
1428
|
-
this._strategy = new passportGitlab2.Strategy(
|
|
1429
|
-
{
|
|
1430
|
-
clientID: options.clientId,
|
|
1431
|
-
clientSecret: options.clientSecret,
|
|
1432
|
-
callbackURL: options.callbackUrl,
|
|
1433
|
-
baseURL: options.baseUrl,
|
|
1434
|
-
authorizationURL: `${options.baseUrl}/oauth/authorize`,
|
|
1435
|
-
tokenURL: `${options.baseUrl}/oauth/token`,
|
|
1436
|
-
profileURL: `${options.baseUrl}/api/v4/user`
|
|
1437
|
-
},
|
|
1438
|
-
(accessToken, refreshToken, params, fullProfile, done) => {
|
|
1439
|
-
done(
|
|
1440
|
-
void 0,
|
|
1441
|
-
{ fullProfile, params, accessToken },
|
|
1442
|
-
{
|
|
1443
|
-
refreshToken
|
|
1444
|
-
}
|
|
1445
|
-
);
|
|
1446
|
-
}
|
|
1447
|
-
);
|
|
1448
|
-
}
|
|
1449
|
-
async start(req) {
|
|
1450
|
-
return await executeRedirectStrategy(req, this._strategy, {
|
|
1451
|
-
scope: req.scope,
|
|
1452
|
-
state: encodeState(req.state)
|
|
1453
|
-
});
|
|
1454
|
-
}
|
|
1455
|
-
async handler(req) {
|
|
1456
|
-
const { result, privateInfo } = await executeFrameHandlerStrategy(req, this._strategy);
|
|
1457
|
-
return {
|
|
1458
|
-
response: await this.handleResult(result),
|
|
1459
|
-
refreshToken: privateInfo.refreshToken
|
|
1460
|
-
};
|
|
1461
|
-
}
|
|
1462
|
-
async refresh(req) {
|
|
1463
|
-
const { accessToken, refreshToken, params } = await executeRefreshTokenStrategy(
|
|
1464
|
-
this._strategy,
|
|
1465
|
-
req.refreshToken,
|
|
1466
|
-
req.scope
|
|
1467
|
-
);
|
|
1468
|
-
const fullProfile = await executeFetchUserProfileStrategy(
|
|
1469
|
-
this._strategy,
|
|
1470
|
-
accessToken
|
|
1471
|
-
);
|
|
1472
|
-
return {
|
|
1473
|
-
response: await this.handleResult({
|
|
1474
|
-
fullProfile,
|
|
1475
|
-
params,
|
|
1476
|
-
accessToken
|
|
1477
|
-
}),
|
|
1478
|
-
refreshToken
|
|
1479
|
-
};
|
|
1480
|
-
}
|
|
1481
|
-
async handleResult(result) {
|
|
1482
|
-
const { profile } = await this.authHandler(result, this.resolverContext);
|
|
1483
|
-
const response = {
|
|
1484
|
-
providerInfo: {
|
|
1485
|
-
idToken: result.params.id_token,
|
|
1486
|
-
accessToken: result.accessToken,
|
|
1487
|
-
scope: result.params.scope,
|
|
1488
|
-
expiresInSeconds: result.params.expires_in
|
|
1489
|
-
},
|
|
1490
|
-
profile
|
|
1491
|
-
};
|
|
1492
|
-
if (this.signInResolver) {
|
|
1493
|
-
response.backstageIdentity = await this.signInResolver(
|
|
1494
|
-
{
|
|
1495
|
-
result,
|
|
1496
|
-
profile
|
|
1497
|
-
},
|
|
1498
|
-
this.resolverContext
|
|
1499
|
-
);
|
|
1500
|
-
}
|
|
1501
|
-
return response;
|
|
1502
|
-
}
|
|
1503
|
-
}
|
|
1504
|
-
const gitlab = createAuthProviderIntegration({
|
|
1505
|
-
create(options) {
|
|
1506
|
-
return ({ providerId, globalConfig, config, resolverContext }) => OAuthEnvironmentHandler.mapConfig(config, (envConfig) => {
|
|
1507
|
-
var _a, _b;
|
|
1508
|
-
const clientId = envConfig.getString("clientId");
|
|
1509
|
-
const clientSecret = envConfig.getString("clientSecret");
|
|
1510
|
-
const audience = envConfig.getOptionalString("audience");
|
|
1511
|
-
const baseUrl = audience || "https://gitlab.com";
|
|
1512
|
-
const customCallbackUrl = envConfig.getOptionalString("callbackUrl");
|
|
1513
|
-
const callbackUrl = customCallbackUrl || `${globalConfig.baseUrl}/${providerId}/handler/frame`;
|
|
1514
|
-
const authHandler = (_a = options == null ? void 0 : options.authHandler) != null ? _a : gitlabDefaultAuthHandler;
|
|
1515
|
-
const provider = new GitlabAuthProvider({
|
|
1516
|
-
clientId,
|
|
1517
|
-
clientSecret,
|
|
1518
|
-
callbackUrl,
|
|
1519
|
-
baseUrl,
|
|
1520
|
-
authHandler,
|
|
1521
|
-
signInResolver: (_b = options == null ? void 0 : options.signIn) == null ? void 0 : _b.resolver,
|
|
1522
|
-
resolverContext
|
|
1523
|
-
});
|
|
1524
|
-
return OAuthAdapter.fromConfig(globalConfig, provider, {
|
|
1525
|
-
providerId,
|
|
1526
|
-
callbackUrl
|
|
1527
|
-
});
|
|
1528
|
-
});
|
|
1529
|
-
}
|
|
1530
|
-
});
|
|
1531
|
-
|
|
1532
1407
|
function adaptLegacyOAuthHandler(authHandler) {
|
|
1533
1408
|
return authHandler && (async (result, ctx) => authHandler(
|
|
1534
1409
|
{
|
|
@@ -1593,6 +1468,17 @@ function adaptOAuthSignInResolverToLegacy(resolvers) {
|
|
|
1593
1468
|
return legacyResolvers;
|
|
1594
1469
|
}
|
|
1595
1470
|
|
|
1471
|
+
const gitlab = createAuthProviderIntegration({
|
|
1472
|
+
create(options) {
|
|
1473
|
+
var _a;
|
|
1474
|
+
return pluginAuthNode.createOAuthProviderFactory({
|
|
1475
|
+
authenticator: pluginAuthBackendModuleGitlabProvider.gitlabAuthenticator,
|
|
1476
|
+
profileTransform: adaptLegacyOAuthHandler(options == null ? void 0 : options.authHandler),
|
|
1477
|
+
signInResolver: adaptLegacyOAuthSignInResolver((_a = options == null ? void 0 : options.signIn) == null ? void 0 : _a.resolver)
|
|
1478
|
+
});
|
|
1479
|
+
}
|
|
1480
|
+
});
|
|
1481
|
+
|
|
1596
1482
|
const google = createAuthProviderIntegration({
|
|
1597
1483
|
create(options) {
|
|
1598
1484
|
var _a;
|