@backstage/plugin-auth-backend 0.14.2-next.0 → 0.15.0-next.3
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 +49 -0
- package/dist/index.cjs.js +112 -159
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +66 -732
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# @backstage/plugin-auth-backend
|
|
2
2
|
|
|
3
|
+
## 0.15.0-next.3
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- fe8e025af5: Allowed post method on /refresh path
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- a70869e775: Updated dependency `msw` to `^0.43.0`.
|
|
12
|
+
- 4e9a90e307: Updated dependency `luxon` to `^3.0.0`.
|
|
13
|
+
- 3a014730dc: Add new config option for okta auth server and IDP
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
- @backstage/backend-common@0.14.1-next.3
|
|
16
|
+
- @backstage/catalog-client@1.0.4-next.2
|
|
17
|
+
- @backstage/plugin-auth-node@0.2.3-next.2
|
|
18
|
+
- @backstage/catalog-model@1.1.0-next.3
|
|
19
|
+
|
|
20
|
+
## 0.15.0-next.2
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- 8e03db907a: Auth provider now also export createAuthProviderIntegration
|
|
25
|
+
- 679b32172e: Updated dependency `knex` to `^2.0.0`.
|
|
26
|
+
- Updated dependencies
|
|
27
|
+
- @backstage/catalog-model@1.1.0-next.2
|
|
28
|
+
- @backstage/backend-common@0.14.1-next.2
|
|
29
|
+
|
|
30
|
+
## 0.15.0-next.1
|
|
31
|
+
|
|
32
|
+
### Minor Changes
|
|
33
|
+
|
|
34
|
+
- 9d4040777e: **BREAKING**: Removed all directly exported auth provider factories, option types, and sign-in resolvers. For example: `AwsAlbProviderOptions`, `bitbucketUserIdSignInResolver`, `createGithubProvider`. These are all still accessible via the `providers` export. For example, use `providers.github.create()` rather than `createGithubProvider()`, and `providers.bitbucket.resolvers.userIdMatchingUserEntityAnnotation()` rather than `bitbucketUserIdSignInResolver`.
|
|
35
|
+
|
|
36
|
+
**BREAKING**: Removed the exported `AuthProviderFactoryOptions` type as well as the deprecated option fields of the `AuthProviderFactory` callback. This includes the `tokenManager`, `tokenIssuer`, `discovery`, and `catalogApi` fields. Existing usage of these should be replaced with the new utilities in the `resolverContext` field. The deprecated `TokenIssuer` type is now also removed, since it is no longer used.
|
|
37
|
+
|
|
38
|
+
**BREAKING**: Removed `getEntityClaims`, use `getDefaultOwnershipEntityRefs` instead.
|
|
39
|
+
|
|
40
|
+
**DEPRECATION**: Deprecated `AtlassianAuthProvider` as it was unintentionally exported.
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- f2cf79d62e: Added an option for the auth backend router to select the algorithm for the JWT token signing keys
|
|
45
|
+
- Updated dependencies
|
|
46
|
+
- @backstage/catalog-model@1.1.0-next.1
|
|
47
|
+
- @backstage/backend-common@0.14.1-next.1
|
|
48
|
+
- @backstage/errors@1.1.0-next.0
|
|
49
|
+
- @backstage/catalog-client@1.0.4-next.1
|
|
50
|
+
- @backstage/plugin-auth-node@0.2.3-next.1
|
|
51
|
+
|
|
3
52
|
## 0.14.2-next.0
|
|
4
53
|
|
|
5
54
|
### Patch Changes
|
package/dist/index.cjs.js
CHANGED
|
@@ -15,16 +15,16 @@ var fetch = require('node-fetch');
|
|
|
15
15
|
var NodeCache = require('node-cache');
|
|
16
16
|
var jose = require('jose');
|
|
17
17
|
var passportBitbucketOauth2 = require('passport-bitbucket-oauth2');
|
|
18
|
+
var googleAuthLibrary = require('google-auth-library');
|
|
18
19
|
var passportGithub2 = require('passport-github2');
|
|
19
20
|
var passportGitlab2 = require('passport-gitlab2');
|
|
20
21
|
var passportGoogleOauth20 = require('passport-google-oauth20');
|
|
21
22
|
var passportMicrosoft = require('passport-microsoft');
|
|
22
23
|
var pluginAuthNode = require('@backstage/plugin-auth-node');
|
|
23
24
|
var openidClient = require('openid-client');
|
|
24
|
-
var passportOktaOauth = require('passport-okta-oauth');
|
|
25
|
+
var passportOktaOauth = require('@davidzemon/passport-okta-oauth');
|
|
25
26
|
var passportOneloginOauth = require('passport-onelogin-oauth');
|
|
26
27
|
var passportSaml = require('passport-saml');
|
|
27
|
-
var googleAuthLibrary = require('google-auth-library');
|
|
28
28
|
var catalogClient = require('@backstage/catalog-client');
|
|
29
29
|
var catalogModel = require('@backstage/catalog-model');
|
|
30
30
|
var luxon = require('luxon');
|
|
@@ -645,7 +645,6 @@ const atlassian = createAuthProviderIntegration({
|
|
|
645
645
|
});
|
|
646
646
|
}
|
|
647
647
|
});
|
|
648
|
-
const createAtlassianProvider = atlassian.create;
|
|
649
648
|
|
|
650
649
|
class Auth0Strategy extends OAuth2Strategy__default["default"] {
|
|
651
650
|
constructor(options, verify) {
|
|
@@ -758,7 +757,6 @@ const auth0 = createAuthProviderIntegration({
|
|
|
758
757
|
});
|
|
759
758
|
}
|
|
760
759
|
});
|
|
761
|
-
const createAuth0Provider = auth0.create;
|
|
762
760
|
|
|
763
761
|
const ALB_JWT_HEADER = "x-amzn-oidc-data";
|
|
764
762
|
const ALB_ACCESS_TOKEN_HEADER = "x-amzn-oidc-accesstoken";
|
|
@@ -872,7 +870,6 @@ const awsAlb = createAuthProviderIntegration({
|
|
|
872
870
|
};
|
|
873
871
|
}
|
|
874
872
|
});
|
|
875
|
-
const createAwsAlbProvider = awsAlb.create;
|
|
876
873
|
|
|
877
874
|
class BitbucketAuthProvider {
|
|
878
875
|
constructor(options) {
|
|
@@ -997,9 +994,86 @@ const bitbucket = createAuthProviderIntegration({
|
|
|
997
994
|
}
|
|
998
995
|
}
|
|
999
996
|
});
|
|
1000
|
-
|
|
1001
|
-
const
|
|
1002
|
-
|
|
997
|
+
|
|
998
|
+
const IAP_JWT_HEADER = "x-goog-iap-jwt-assertion";
|
|
999
|
+
|
|
1000
|
+
function createTokenValidator(audience, mockClient) {
|
|
1001
|
+
const client = mockClient != null ? mockClient : new googleAuthLibrary.OAuth2Client();
|
|
1002
|
+
return async function tokenValidator(token) {
|
|
1003
|
+
const response = await client.getIapPublicKeys();
|
|
1004
|
+
const ticket = await client.verifySignedJwtWithCertsAsync(token, response.pubkeys, audience, ["https://cloud.google.com/iap"]);
|
|
1005
|
+
const payload = ticket.getPayload();
|
|
1006
|
+
if (!payload) {
|
|
1007
|
+
throw new TypeError("Token had no payload");
|
|
1008
|
+
}
|
|
1009
|
+
return payload;
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
async function parseRequestToken(jwtToken, tokenValidator) {
|
|
1013
|
+
if (typeof jwtToken !== "string" || !jwtToken) {
|
|
1014
|
+
throw new errors.AuthenticationError(`Missing Google IAP header: ${IAP_JWT_HEADER}`);
|
|
1015
|
+
}
|
|
1016
|
+
let payload;
|
|
1017
|
+
try {
|
|
1018
|
+
payload = await tokenValidator(jwtToken);
|
|
1019
|
+
} catch (e) {
|
|
1020
|
+
throw new errors.AuthenticationError(`Google IAP token verification failed, ${e}`);
|
|
1021
|
+
}
|
|
1022
|
+
if (!payload.sub || !payload.email) {
|
|
1023
|
+
throw new errors.AuthenticationError("Google IAP token payload is missing sub and/or email claim");
|
|
1024
|
+
}
|
|
1025
|
+
return {
|
|
1026
|
+
iapToken: {
|
|
1027
|
+
...payload,
|
|
1028
|
+
sub: payload.sub,
|
|
1029
|
+
email: payload.email
|
|
1030
|
+
}
|
|
1031
|
+
};
|
|
1032
|
+
}
|
|
1033
|
+
const defaultAuthHandler$1 = async ({
|
|
1034
|
+
iapToken
|
|
1035
|
+
}) => ({ profile: { email: iapToken.email } });
|
|
1036
|
+
|
|
1037
|
+
class GcpIapProvider {
|
|
1038
|
+
constructor(options) {
|
|
1039
|
+
this.authHandler = options.authHandler;
|
|
1040
|
+
this.signInResolver = options.signInResolver;
|
|
1041
|
+
this.tokenValidator = options.tokenValidator;
|
|
1042
|
+
this.resolverContext = options.resolverContext;
|
|
1043
|
+
}
|
|
1044
|
+
async start() {
|
|
1045
|
+
}
|
|
1046
|
+
async frameHandler() {
|
|
1047
|
+
}
|
|
1048
|
+
async refresh(req, res) {
|
|
1049
|
+
const result = await parseRequestToken(req.header(IAP_JWT_HEADER), this.tokenValidator);
|
|
1050
|
+
const { profile } = await this.authHandler(result, this.resolverContext);
|
|
1051
|
+
const backstageIdentity = await this.signInResolver({ profile, result }, this.resolverContext);
|
|
1052
|
+
const response = {
|
|
1053
|
+
providerInfo: { iapToken: result.iapToken },
|
|
1054
|
+
profile,
|
|
1055
|
+
backstageIdentity: prepareBackstageIdentityResponse(backstageIdentity)
|
|
1056
|
+
};
|
|
1057
|
+
res.json(response);
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
const gcpIap = createAuthProviderIntegration({
|
|
1061
|
+
create(options) {
|
|
1062
|
+
return ({ config, resolverContext }) => {
|
|
1063
|
+
var _a;
|
|
1064
|
+
const audience = config.getString("audience");
|
|
1065
|
+
const authHandler = (_a = options.authHandler) != null ? _a : defaultAuthHandler$1;
|
|
1066
|
+
const signInResolver = options.signIn.resolver;
|
|
1067
|
+
const tokenValidator = createTokenValidator(audience);
|
|
1068
|
+
return new GcpIapProvider({
|
|
1069
|
+
authHandler,
|
|
1070
|
+
signInResolver,
|
|
1071
|
+
tokenValidator,
|
|
1072
|
+
resolverContext
|
|
1073
|
+
});
|
|
1074
|
+
};
|
|
1075
|
+
}
|
|
1076
|
+
});
|
|
1003
1077
|
|
|
1004
1078
|
const ACCESS_TOKEN_PREFIX = "access-token.";
|
|
1005
1079
|
const BACKSTAGE_SESSION_EXPIRATION = 3600;
|
|
@@ -1144,7 +1218,6 @@ const github = createAuthProviderIntegration({
|
|
|
1144
1218
|
}
|
|
1145
1219
|
}
|
|
1146
1220
|
});
|
|
1147
|
-
const createGithubProvider = github.create;
|
|
1148
1221
|
|
|
1149
1222
|
const gitlabDefaultAuthHandler = async ({
|
|
1150
1223
|
fullProfile,
|
|
@@ -1240,7 +1313,6 @@ const gitlab = createAuthProviderIntegration({
|
|
|
1240
1313
|
});
|
|
1241
1314
|
}
|
|
1242
1315
|
});
|
|
1243
|
-
const createGitlabProvider = gitlab.create;
|
|
1244
1316
|
|
|
1245
1317
|
const commonByEmailLocalPartResolver = async (info, ctx) => {
|
|
1246
1318
|
const { profile } = info;
|
|
@@ -1375,8 +1447,6 @@ const google = createAuthProviderIntegration({
|
|
|
1375
1447
|
}
|
|
1376
1448
|
}
|
|
1377
1449
|
});
|
|
1378
|
-
const createGoogleProvider = google.create;
|
|
1379
|
-
const googleEmailSignInResolver = google.resolvers.emailMatchingUserEntityAnnotation();
|
|
1380
1450
|
|
|
1381
1451
|
class MicrosoftAuthProvider {
|
|
1382
1452
|
constructor(options) {
|
|
@@ -1505,8 +1575,6 @@ const microsoft = createAuthProviderIntegration({
|
|
|
1505
1575
|
}
|
|
1506
1576
|
}
|
|
1507
1577
|
});
|
|
1508
|
-
const createMicrosoftProvider = microsoft.create;
|
|
1509
|
-
const microsoftEmailSignInResolver = microsoft.resolvers.emailMatchingUserEntityAnnotation();
|
|
1510
1578
|
|
|
1511
1579
|
class OAuth2AuthProvider {
|
|
1512
1580
|
constructor(options) {
|
|
@@ -1627,7 +1695,6 @@ const oauth2 = createAuthProviderIntegration({
|
|
|
1627
1695
|
});
|
|
1628
1696
|
}
|
|
1629
1697
|
});
|
|
1630
|
-
const createOAuth2Provider = oauth2.create;
|
|
1631
1698
|
|
|
1632
1699
|
const OAUTH2_PROXY_JWT_HEADER = "X-OAUTH2-PROXY-ID-TOKEN";
|
|
1633
1700
|
class Oauth2ProxyAuthProvider {
|
|
@@ -1679,7 +1746,7 @@ class Oauth2ProxyAuthProvider {
|
|
|
1679
1746
|
};
|
|
1680
1747
|
}
|
|
1681
1748
|
}
|
|
1682
|
-
async function defaultAuthHandler
|
|
1749
|
+
async function defaultAuthHandler(result) {
|
|
1683
1750
|
return {
|
|
1684
1751
|
profile: {
|
|
1685
1752
|
email: result.getHeader("x-forwarded-email"),
|
|
@@ -1695,12 +1762,11 @@ const oauth2Proxy = createAuthProviderIntegration({
|
|
|
1695
1762
|
return new Oauth2ProxyAuthProvider({
|
|
1696
1763
|
resolverContext,
|
|
1697
1764
|
signInResolver,
|
|
1698
|
-
authHandler: authHandler != null ? authHandler : defaultAuthHandler
|
|
1765
|
+
authHandler: authHandler != null ? authHandler : defaultAuthHandler
|
|
1699
1766
|
});
|
|
1700
1767
|
};
|
|
1701
1768
|
}
|
|
1702
1769
|
});
|
|
1703
|
-
const createOauth2ProxyProvider = oauth2Proxy.create;
|
|
1704
1770
|
|
|
1705
1771
|
class OidcAuthProvider {
|
|
1706
1772
|
constructor(options) {
|
|
@@ -1826,7 +1892,6 @@ const oidc = createAuthProviderIntegration({
|
|
|
1826
1892
|
});
|
|
1827
1893
|
}
|
|
1828
1894
|
});
|
|
1829
|
-
const createOidcProvider = oidc.create;
|
|
1830
1895
|
|
|
1831
1896
|
class OktaAuthProvider {
|
|
1832
1897
|
constructor(options) {
|
|
@@ -1846,6 +1911,8 @@ class OktaAuthProvider {
|
|
|
1846
1911
|
clientSecret: options.clientSecret,
|
|
1847
1912
|
callbackURL: options.callbackUrl,
|
|
1848
1913
|
audience: options.audience,
|
|
1914
|
+
authServerID: options.authServerId,
|
|
1915
|
+
idp: options.idp,
|
|
1849
1916
|
passReqToCallback: false,
|
|
1850
1917
|
store: this.store,
|
|
1851
1918
|
response_type: "code"
|
|
@@ -1914,6 +1981,8 @@ const okta = createAuthProviderIntegration({
|
|
|
1914
1981
|
const clientId = envConfig.getString("clientId");
|
|
1915
1982
|
const clientSecret = envConfig.getString("clientSecret");
|
|
1916
1983
|
const audience = envConfig.getString("audience");
|
|
1984
|
+
const authServerId = envConfig.getOptionalString("authServerId");
|
|
1985
|
+
const idp = envConfig.getOptionalString("idp");
|
|
1917
1986
|
const customCallbackUrl = envConfig.getOptionalString("callbackUrl");
|
|
1918
1987
|
const callbackUrl = customCallbackUrl || `${globalConfig.baseUrl}/${providerId}/handler/frame`;
|
|
1919
1988
|
if (!audience.startsWith("https://")) {
|
|
@@ -1924,6 +1993,8 @@ const okta = createAuthProviderIntegration({
|
|
|
1924
1993
|
});
|
|
1925
1994
|
const provider = new OktaAuthProvider({
|
|
1926
1995
|
audience,
|
|
1996
|
+
authServerId,
|
|
1997
|
+
idp,
|
|
1927
1998
|
clientId,
|
|
1928
1999
|
clientSecret,
|
|
1929
2000
|
callbackUrl,
|
|
@@ -1955,8 +2026,6 @@ const okta = createAuthProviderIntegration({
|
|
|
1955
2026
|
}
|
|
1956
2027
|
}
|
|
1957
2028
|
});
|
|
1958
|
-
const createOktaProvider = okta.create;
|
|
1959
|
-
const oktaEmailSignInResolver = okta.resolvers.emailMatchingUserEntityAnnotation();
|
|
1960
2029
|
|
|
1961
2030
|
class OneLoginProvider {
|
|
1962
2031
|
constructor(options) {
|
|
@@ -2055,7 +2124,6 @@ const onelogin = createAuthProviderIntegration({
|
|
|
2055
2124
|
});
|
|
2056
2125
|
}
|
|
2057
2126
|
});
|
|
2058
|
-
const createOneLoginProvider = onelogin.create;
|
|
2059
2127
|
|
|
2060
2128
|
class SamlAuthProvider {
|
|
2061
2129
|
constructor(options) {
|
|
@@ -2147,89 +2215,6 @@ const saml = createAuthProviderIntegration({
|
|
|
2147
2215
|
}
|
|
2148
2216
|
}
|
|
2149
2217
|
});
|
|
2150
|
-
const createSamlProvider = saml.create;
|
|
2151
|
-
const samlNameIdEntityNameSignInResolver = saml.resolvers.nameIdMatchingUserEntityName();
|
|
2152
|
-
|
|
2153
|
-
const IAP_JWT_HEADER = "x-goog-iap-jwt-assertion";
|
|
2154
|
-
|
|
2155
|
-
function createTokenValidator(audience, mockClient) {
|
|
2156
|
-
const client = mockClient != null ? mockClient : new googleAuthLibrary.OAuth2Client();
|
|
2157
|
-
return async function tokenValidator(token) {
|
|
2158
|
-
const response = await client.getIapPublicKeys();
|
|
2159
|
-
const ticket = await client.verifySignedJwtWithCertsAsync(token, response.pubkeys, audience, ["https://cloud.google.com/iap"]);
|
|
2160
|
-
const payload = ticket.getPayload();
|
|
2161
|
-
if (!payload) {
|
|
2162
|
-
throw new TypeError("Token had no payload");
|
|
2163
|
-
}
|
|
2164
|
-
return payload;
|
|
2165
|
-
};
|
|
2166
|
-
}
|
|
2167
|
-
async function parseRequestToken(jwtToken, tokenValidator) {
|
|
2168
|
-
if (typeof jwtToken !== "string" || !jwtToken) {
|
|
2169
|
-
throw new errors.AuthenticationError(`Missing Google IAP header: ${IAP_JWT_HEADER}`);
|
|
2170
|
-
}
|
|
2171
|
-
let payload;
|
|
2172
|
-
try {
|
|
2173
|
-
payload = await tokenValidator(jwtToken);
|
|
2174
|
-
} catch (e) {
|
|
2175
|
-
throw new errors.AuthenticationError(`Google IAP token verification failed, ${e}`);
|
|
2176
|
-
}
|
|
2177
|
-
if (!payload.sub || !payload.email) {
|
|
2178
|
-
throw new errors.AuthenticationError("Google IAP token payload is missing sub and/or email claim");
|
|
2179
|
-
}
|
|
2180
|
-
return {
|
|
2181
|
-
iapToken: {
|
|
2182
|
-
...payload,
|
|
2183
|
-
sub: payload.sub,
|
|
2184
|
-
email: payload.email
|
|
2185
|
-
}
|
|
2186
|
-
};
|
|
2187
|
-
}
|
|
2188
|
-
const defaultAuthHandler = async ({
|
|
2189
|
-
iapToken
|
|
2190
|
-
}) => ({ profile: { email: iapToken.email } });
|
|
2191
|
-
|
|
2192
|
-
class GcpIapProvider {
|
|
2193
|
-
constructor(options) {
|
|
2194
|
-
this.authHandler = options.authHandler;
|
|
2195
|
-
this.signInResolver = options.signInResolver;
|
|
2196
|
-
this.tokenValidator = options.tokenValidator;
|
|
2197
|
-
this.resolverContext = options.resolverContext;
|
|
2198
|
-
}
|
|
2199
|
-
async start() {
|
|
2200
|
-
}
|
|
2201
|
-
async frameHandler() {
|
|
2202
|
-
}
|
|
2203
|
-
async refresh(req, res) {
|
|
2204
|
-
const result = await parseRequestToken(req.header(IAP_JWT_HEADER), this.tokenValidator);
|
|
2205
|
-
const { profile } = await this.authHandler(result, this.resolverContext);
|
|
2206
|
-
const backstageIdentity = await this.signInResolver({ profile, result }, this.resolverContext);
|
|
2207
|
-
const response = {
|
|
2208
|
-
providerInfo: { iapToken: result.iapToken },
|
|
2209
|
-
profile,
|
|
2210
|
-
backstageIdentity: prepareBackstageIdentityResponse(backstageIdentity)
|
|
2211
|
-
};
|
|
2212
|
-
res.json(response);
|
|
2213
|
-
}
|
|
2214
|
-
}
|
|
2215
|
-
const gcpIap = createAuthProviderIntegration({
|
|
2216
|
-
create(options) {
|
|
2217
|
-
return ({ config, resolverContext }) => {
|
|
2218
|
-
var _a;
|
|
2219
|
-
const audience = config.getString("audience");
|
|
2220
|
-
const authHandler = (_a = options.authHandler) != null ? _a : defaultAuthHandler;
|
|
2221
|
-
const signInResolver = options.signIn.resolver;
|
|
2222
|
-
const tokenValidator = createTokenValidator(audience);
|
|
2223
|
-
return new GcpIapProvider({
|
|
2224
|
-
authHandler,
|
|
2225
|
-
signInResolver,
|
|
2226
|
-
tokenValidator,
|
|
2227
|
-
resolverContext
|
|
2228
|
-
});
|
|
2229
|
-
};
|
|
2230
|
-
}
|
|
2231
|
-
});
|
|
2232
|
-
const createGcpIapProvider = gcpIap.create;
|
|
2233
2218
|
|
|
2234
2219
|
const providers = Object.freeze({
|
|
2235
2220
|
atlassian,
|
|
@@ -2248,21 +2233,20 @@ const providers = Object.freeze({
|
|
|
2248
2233
|
onelogin,
|
|
2249
2234
|
saml
|
|
2250
2235
|
});
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
atlassian: createAtlassianProvider()
|
|
2236
|
+
const defaultAuthProviderFactories = {
|
|
2237
|
+
google: google.create(),
|
|
2238
|
+
github: github.create(),
|
|
2239
|
+
gitlab: gitlab.create(),
|
|
2240
|
+
saml: saml.create(),
|
|
2241
|
+
okta: okta.create(),
|
|
2242
|
+
auth0: auth0.create(),
|
|
2243
|
+
microsoft: microsoft.create(),
|
|
2244
|
+
oauth2: oauth2.create(),
|
|
2245
|
+
oidc: oidc.create(),
|
|
2246
|
+
onelogin: onelogin.create(),
|
|
2247
|
+
awsalb: awsAlb.create(),
|
|
2248
|
+
bitbucket: bitbucket.create(),
|
|
2249
|
+
atlassian: atlassian.create()
|
|
2266
2250
|
};
|
|
2267
2251
|
|
|
2268
2252
|
function createOidcRouter(options) {
|
|
@@ -2598,16 +2582,6 @@ class CatalogIdentityClient {
|
|
|
2598
2582
|
}
|
|
2599
2583
|
}
|
|
2600
2584
|
|
|
2601
|
-
function getEntityClaims(entity) {
|
|
2602
|
-
var _a, _b;
|
|
2603
|
-
const userRef = catalogModel.stringifyEntityRef(entity);
|
|
2604
|
-
const membershipRefs = (_b = (_a = entity.relations) == null ? void 0 : _a.filter((r) => r.type === catalogModel.RELATION_MEMBER_OF && r.targetRef.startsWith("group:")).map((r) => r.targetRef)) != null ? _b : [];
|
|
2605
|
-
return {
|
|
2606
|
-
sub: userRef,
|
|
2607
|
-
ent: [userRef, ...membershipRefs]
|
|
2608
|
-
};
|
|
2609
|
-
}
|
|
2610
|
-
|
|
2611
2585
|
function getDefaultOwnershipEntityRefs(entity) {
|
|
2612
2586
|
var _a, _b;
|
|
2613
2587
|
const membershipRefs = (_b = (_a = entity.relations) == null ? void 0 : _a.filter((r) => r.type === catalogModel.RELATION_MEMBER_OF && r.targetRef.startsWith("group:")).map((r) => r.targetRef)) != null ? _b : [];
|
|
@@ -2687,6 +2661,7 @@ async function createRouter(options) {
|
|
|
2687
2661
|
discovery,
|
|
2688
2662
|
database,
|
|
2689
2663
|
tokenManager,
|
|
2664
|
+
tokenFactoryAlgorithm,
|
|
2690
2665
|
providerFactories
|
|
2691
2666
|
} = options;
|
|
2692
2667
|
const router = Router__default["default"]();
|
|
@@ -2698,7 +2673,8 @@ async function createRouter(options) {
|
|
|
2698
2673
|
issuer: authUrl,
|
|
2699
2674
|
keyStore,
|
|
2700
2675
|
keyDurationSeconds,
|
|
2701
|
-
logger: logger.child({ component: "token-factory" })
|
|
2676
|
+
logger: logger.child({ component: "token-factory" }),
|
|
2677
|
+
algorithm: tokenFactoryAlgorithm
|
|
2702
2678
|
});
|
|
2703
2679
|
const catalogApi = new catalogClient.CatalogClient({ discoveryApi: discovery });
|
|
2704
2680
|
const secret = config.getOptionalString("auth.session.secret");
|
|
@@ -2719,7 +2695,7 @@ async function createRouter(options) {
|
|
|
2719
2695
|
router.use(express__default["default"].urlencoded({ extended: false }));
|
|
2720
2696
|
router.use(express__default["default"].json());
|
|
2721
2697
|
const allProviderFactories = {
|
|
2722
|
-
...
|
|
2698
|
+
...defaultAuthProviderFactories,
|
|
2723
2699
|
...providerFactories
|
|
2724
2700
|
};
|
|
2725
2701
|
const providersConfig = config.getConfig("auth.providers");
|
|
@@ -2738,10 +2714,6 @@ async function createRouter(options) {
|
|
|
2738
2714
|
},
|
|
2739
2715
|
config: providersConfig.getConfig(providerId),
|
|
2740
2716
|
logger,
|
|
2741
|
-
tokenManager,
|
|
2742
|
-
tokenIssuer,
|
|
2743
|
-
discovery,
|
|
2744
|
-
catalogApi,
|
|
2745
2717
|
resolverContext: CatalogAuthResolverContext.create({
|
|
2746
2718
|
logger,
|
|
2747
2719
|
catalogApi,
|
|
@@ -2758,6 +2730,7 @@ async function createRouter(options) {
|
|
|
2758
2730
|
}
|
|
2759
2731
|
if (provider.refresh) {
|
|
2760
2732
|
r.get("/refresh", provider.refresh.bind(provider));
|
|
2733
|
+
r.post("/refresh", provider.refresh.bind(provider));
|
|
2761
2734
|
}
|
|
2762
2735
|
router.use(`/${providerId}`, r);
|
|
2763
2736
|
} catch (e) {
|
|
@@ -2800,40 +2773,20 @@ function createOriginFilter(config) {
|
|
|
2800
2773
|
};
|
|
2801
2774
|
}
|
|
2802
2775
|
|
|
2776
|
+
exports.AtlassianAuthProvider = AtlassianAuthProvider;
|
|
2803
2777
|
exports.CatalogIdentityClient = CatalogIdentityClient;
|
|
2804
2778
|
exports.OAuthAdapter = OAuthAdapter;
|
|
2805
2779
|
exports.OAuthEnvironmentHandler = OAuthEnvironmentHandler;
|
|
2806
|
-
exports.
|
|
2807
|
-
exports.bitbucketUsernameSignInResolver = bitbucketUsernameSignInResolver;
|
|
2808
|
-
exports.createAtlassianProvider = createAtlassianProvider;
|
|
2809
|
-
exports.createAuth0Provider = createAuth0Provider;
|
|
2810
|
-
exports.createAwsAlbProvider = createAwsAlbProvider;
|
|
2811
|
-
exports.createBitbucketProvider = createBitbucketProvider;
|
|
2812
|
-
exports.createGcpIapProvider = createGcpIapProvider;
|
|
2813
|
-
exports.createGithubProvider = createGithubProvider;
|
|
2814
|
-
exports.createGitlabProvider = createGitlabProvider;
|
|
2815
|
-
exports.createGoogleProvider = createGoogleProvider;
|
|
2816
|
-
exports.createMicrosoftProvider = createMicrosoftProvider;
|
|
2817
|
-
exports.createOAuth2Provider = createOAuth2Provider;
|
|
2818
|
-
exports.createOauth2ProxyProvider = createOauth2ProxyProvider;
|
|
2819
|
-
exports.createOidcProvider = createOidcProvider;
|
|
2820
|
-
exports.createOktaProvider = createOktaProvider;
|
|
2821
|
-
exports.createOneLoginProvider = createOneLoginProvider;
|
|
2780
|
+
exports.createAuthProviderIntegration = createAuthProviderIntegration;
|
|
2822
2781
|
exports.createOriginFilter = createOriginFilter;
|
|
2823
2782
|
exports.createRouter = createRouter;
|
|
2824
|
-
exports.
|
|
2825
|
-
exports.defaultAuthProviderFactories = factories;
|
|
2783
|
+
exports.defaultAuthProviderFactories = defaultAuthProviderFactories;
|
|
2826
2784
|
exports.encodeState = encodeState;
|
|
2827
2785
|
exports.ensuresXRequestedWith = ensuresXRequestedWith;
|
|
2828
2786
|
exports.getDefaultOwnershipEntityRefs = getDefaultOwnershipEntityRefs;
|
|
2829
|
-
exports.getEntityClaims = getEntityClaims;
|
|
2830
|
-
exports.googleEmailSignInResolver = googleEmailSignInResolver;
|
|
2831
|
-
exports.microsoftEmailSignInResolver = microsoftEmailSignInResolver;
|
|
2832
|
-
exports.oktaEmailSignInResolver = oktaEmailSignInResolver;
|
|
2833
2787
|
exports.postMessageResponse = postMessageResponse;
|
|
2834
2788
|
exports.prepareBackstageIdentityResponse = prepareBackstageIdentityResponse;
|
|
2835
2789
|
exports.providers = providers;
|
|
2836
2790
|
exports.readState = readState;
|
|
2837
|
-
exports.samlNameIdEntityNameSignInResolver = samlNameIdEntityNameSignInResolver;
|
|
2838
2791
|
exports.verifyNonce = verifyNonce;
|
|
2839
2792
|
//# sourceMappingURL=index.cjs.js.map
|