@backstage/plugin-auth-backend 0.24.1-next.0 → 0.24.1-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
CHANGED
|
@@ -1,5 +1,70 @@
|
|
|
1
1
|
# @backstage/plugin-auth-backend
|
|
2
2
|
|
|
3
|
+
## 0.24.1-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/backend-plugin-api@1.1.0-next.2
|
|
9
|
+
- @backstage/errors@1.2.6-next.0
|
|
10
|
+
- @backstage/plugin-auth-backend-module-atlassian-provider@0.3.3-next.2
|
|
11
|
+
- @backstage/plugin-auth-backend-module-auth0-provider@0.1.3-next.2
|
|
12
|
+
- @backstage/plugin-auth-backend-module-bitbucket-provider@0.2.3-next.2
|
|
13
|
+
- @backstage/plugin-auth-backend-module-bitbucket-server-provider@0.1.3-next.2
|
|
14
|
+
- @backstage/plugin-auth-backend-module-cloudflare-access-provider@0.3.3-next.2
|
|
15
|
+
- @backstage/plugin-auth-backend-module-github-provider@0.2.3-next.2
|
|
16
|
+
- @backstage/plugin-auth-backend-module-gitlab-provider@0.2.3-next.2
|
|
17
|
+
- @backstage/plugin-auth-backend-module-microsoft-provider@0.2.3-next.2
|
|
18
|
+
- @backstage/plugin-auth-backend-module-oauth2-provider@0.3.3-next.2
|
|
19
|
+
- @backstage/plugin-auth-backend-module-oidc-provider@0.3.3-next.2
|
|
20
|
+
- @backstage/plugin-auth-backend-module-okta-provider@0.1.3-next.2
|
|
21
|
+
- @backstage/plugin-auth-backend-module-onelogin-provider@0.2.3-next.2
|
|
22
|
+
- @backstage/plugin-auth-backend-module-aws-alb-provider@0.3.1-next.2
|
|
23
|
+
- @backstage/plugin-auth-backend-module-azure-easyauth-provider@0.2.3-next.2
|
|
24
|
+
- @backstage/plugin-auth-backend-module-gcp-iap-provider@0.3.3-next.2
|
|
25
|
+
- @backstage/plugin-auth-backend-module-google-provider@0.2.3-next.2
|
|
26
|
+
- @backstage/plugin-auth-backend-module-oauth2-proxy-provider@0.2.3-next.2
|
|
27
|
+
- @backstage/plugin-auth-node@0.5.5-next.2
|
|
28
|
+
- @backstage/plugin-catalog-node@1.15.0-next.2
|
|
29
|
+
- @backstage/catalog-client@1.9.0-next.2
|
|
30
|
+
- @backstage/catalog-model@1.7.2-next.0
|
|
31
|
+
- @backstage/config@1.3.1-next.0
|
|
32
|
+
- @backstage/types@1.2.0
|
|
33
|
+
|
|
34
|
+
## 0.24.1-next.1
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- c907440: Improved error forwarding for OAuth refresh endpoints
|
|
39
|
+
- 40518ab: Fix issue with `jwks` endpoint returning invalid data with `firestore`
|
|
40
|
+
- 5c9cc05: Use native fetch instead of node-fetch
|
|
41
|
+
- Updated dependencies
|
|
42
|
+
- @backstage/plugin-auth-node@0.5.5-next.1
|
|
43
|
+
- @backstage/plugin-catalog-node@1.15.0-next.1
|
|
44
|
+
- @backstage/catalog-client@1.9.0-next.1
|
|
45
|
+
- @backstage/plugin-auth-backend-module-cloudflare-access-provider@0.3.3-next.1
|
|
46
|
+
- @backstage/plugin-auth-backend-module-bitbucket-server-provider@0.1.3-next.1
|
|
47
|
+
- @backstage/plugin-auth-backend-module-microsoft-provider@0.2.3-next.1
|
|
48
|
+
- @backstage/plugin-auth-backend-module-aws-alb-provider@0.3.1-next.1
|
|
49
|
+
- @backstage/plugin-auth-backend-module-google-provider@0.2.3-next.1
|
|
50
|
+
- @backstage/backend-plugin-api@1.1.0-next.1
|
|
51
|
+
- @backstage/plugin-auth-backend-module-atlassian-provider@0.3.3-next.1
|
|
52
|
+
- @backstage/plugin-auth-backend-module-auth0-provider@0.1.3-next.1
|
|
53
|
+
- @backstage/plugin-auth-backend-module-azure-easyauth-provider@0.2.3-next.1
|
|
54
|
+
- @backstage/plugin-auth-backend-module-bitbucket-provider@0.2.3-next.1
|
|
55
|
+
- @backstage/plugin-auth-backend-module-github-provider@0.2.3-next.1
|
|
56
|
+
- @backstage/plugin-auth-backend-module-gitlab-provider@0.2.3-next.1
|
|
57
|
+
- @backstage/plugin-auth-backend-module-oauth2-provider@0.3.3-next.1
|
|
58
|
+
- @backstage/plugin-auth-backend-module-oidc-provider@0.3.3-next.1
|
|
59
|
+
- @backstage/plugin-auth-backend-module-okta-provider@0.1.3-next.1
|
|
60
|
+
- @backstage/plugin-auth-backend-module-onelogin-provider@0.2.3-next.1
|
|
61
|
+
- @backstage/plugin-auth-backend-module-gcp-iap-provider@0.3.3-next.1
|
|
62
|
+
- @backstage/plugin-auth-backend-module-oauth2-proxy-provider@0.2.3-next.1
|
|
63
|
+
- @backstage/catalog-model@1.7.1
|
|
64
|
+
- @backstage/config@1.3.0
|
|
65
|
+
- @backstage/errors@1.2.5
|
|
66
|
+
- @backstage/types@1.2.0
|
|
67
|
+
|
|
3
68
|
## 0.24.1-next.0
|
|
4
69
|
|
|
5
70
|
### Patch Changes
|
|
@@ -37,7 +37,7 @@ class FirestoreKeyStore {
|
|
|
37
37
|
await this.withTimeout(
|
|
38
38
|
this.database.collection(this.path).doc(key.kid).set({
|
|
39
39
|
kid: key.kid,
|
|
40
|
-
key
|
|
40
|
+
key
|
|
41
41
|
})
|
|
42
42
|
);
|
|
43
43
|
}
|
|
@@ -46,10 +46,13 @@ class FirestoreKeyStore {
|
|
|
46
46
|
this.database.collection(this.path).get()
|
|
47
47
|
);
|
|
48
48
|
return {
|
|
49
|
-
items: keys.docs.map((
|
|
50
|
-
key
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
items: keys.docs.map((doc) => {
|
|
50
|
+
const { key } = doc.data();
|
|
51
|
+
return {
|
|
52
|
+
createdAt: doc.createTime.toDate(),
|
|
53
|
+
key: typeof key === "string" ? JSON.parse(key) : key
|
|
54
|
+
};
|
|
55
|
+
})
|
|
53
56
|
};
|
|
54
57
|
}
|
|
55
58
|
async removeKeys(kids) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirestoreKeyStore.cjs.js","sources":["../../src/identity/FirestoreKeyStore.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LoggerService } from '@backstage/backend-plugin-api';\nimport {\n DocumentData,\n Firestore,\n QuerySnapshot,\n Settings,\n WriteResult,\n} from '@google-cloud/firestore';\n\nimport { AnyJWK, KeyStore, StoredKey } from './types';\n\nexport type FirestoreKeyStoreSettings = Settings & Options;\n\ntype Options = {\n path?: string;\n timeout?: number;\n};\n\nexport const DEFAULT_TIMEOUT_MS = 10000;\nexport const DEFAULT_DOCUMENT_PATH = 'sessions';\n\nexport class FirestoreKeyStore implements KeyStore {\n static async create(\n settings?: FirestoreKeyStoreSettings,\n ): Promise<FirestoreKeyStore> {\n const { path, timeout, ...firestoreSettings } = settings ?? {};\n const database = new Firestore(firestoreSettings);\n\n return new FirestoreKeyStore(\n database,\n path ?? DEFAULT_DOCUMENT_PATH,\n timeout ?? DEFAULT_TIMEOUT_MS,\n );\n }\n\n private constructor(\n private readonly database: Firestore,\n private readonly path: string,\n private readonly timeout: number,\n ) {}\n\n static async verifyConnection(\n keyStore: FirestoreKeyStore,\n logger?: LoggerService,\n ): Promise<void> {\n try {\n await keyStore.verify();\n } catch (error) {\n if (process.env.NODE_ENV !== 'development') {\n throw new Error(\n `Failed to connect to database: ${(error as Error).message}`,\n );\n }\n logger?.warn(\n `Failed to connect to database: ${(error as Error).message}`,\n );\n }\n }\n\n async addKey(key: AnyJWK): Promise<void> {\n await this.withTimeout<WriteResult>(\n this.database
|
|
1
|
+
{"version":3,"file":"FirestoreKeyStore.cjs.js","sources":["../../src/identity/FirestoreKeyStore.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { LoggerService } from '@backstage/backend-plugin-api';\nimport {\n DocumentData,\n Firestore,\n QuerySnapshot,\n Settings,\n WriteResult,\n} from '@google-cloud/firestore';\n\nimport { AnyJWK, KeyStore, StoredKey } from './types';\n\nexport type FirestoreKeyStoreSettings = Settings & Options;\n\ntype Options = {\n path?: string;\n timeout?: number;\n};\n\nexport const DEFAULT_TIMEOUT_MS = 10000;\nexport const DEFAULT_DOCUMENT_PATH = 'sessions';\n\nexport class FirestoreKeyStore implements KeyStore {\n static async create(\n settings?: FirestoreKeyStoreSettings,\n ): Promise<FirestoreKeyStore> {\n const { path, timeout, ...firestoreSettings } = settings ?? {};\n const database = new Firestore(firestoreSettings);\n\n return new FirestoreKeyStore(\n database,\n path ?? DEFAULT_DOCUMENT_PATH,\n timeout ?? DEFAULT_TIMEOUT_MS,\n );\n }\n\n private constructor(\n private readonly database: Firestore,\n private readonly path: string,\n private readonly timeout: number,\n ) {}\n\n static async verifyConnection(\n keyStore: FirestoreKeyStore,\n logger?: LoggerService,\n ): Promise<void> {\n try {\n await keyStore.verify();\n } catch (error) {\n if (process.env.NODE_ENV !== 'development') {\n throw new Error(\n `Failed to connect to database: ${(error as Error).message}`,\n );\n }\n logger?.warn(\n `Failed to connect to database: ${(error as Error).message}`,\n );\n }\n }\n\n async addKey(key: AnyJWK): Promise<void> {\n await this.withTimeout<WriteResult>(\n this.database.collection(this.path).doc(key.kid).set({\n kid: key.kid,\n key: key,\n }),\n );\n }\n\n async listKeys(): Promise<{ items: StoredKey[] }> {\n const keys = await this.withTimeout<QuerySnapshot<DocumentData>>(\n this.database.collection(this.path).get(),\n );\n\n return {\n items: keys.docs.map(doc => {\n const { key } = doc.data();\n\n return {\n createdAt: doc.createTime.toDate(),\n key: typeof key === 'string' ? JSON.parse(key) : key,\n };\n }),\n };\n }\n\n async removeKeys(kids: string[]): Promise<void> {\n // This is probably really slow, but it's done async in the background\n for (const kid of kids) {\n await this.withTimeout<WriteResult>(\n this.database.collection(this.path).doc(kid).delete(),\n );\n }\n\n /**\n * This could be achieved with batching but there's a couple of limitations with that:\n *\n * - A batched write can contain a maximum of 500 operations\n * https://firebase.google.com/docs/firestore/manage-data/transactions#batched-writes\n *\n * - The \"in\" operator can combine a maximum of 10 equality clauses\n * https://firebase.google.com/docs/firestore/query-data/queries#in_not-in_and_array-contains-any\n *\n * Example:\n *\n * const batch = this.database.batch();\n * const docs = await this.database\n * .collection(this.path)\n * .where('kid', 'in', kids)\n * .get();\n * docs.forEach(doc => {\n * batch.delete(doc.ref);\n * });\n * await batch.commit();\n *\n */\n }\n\n /**\n * Helper function to allow us to modify the timeout used when\n * performing Firestore database operations.\n *\n * The reason for this is that it seems that there's no other\n * practical solution to change the default timeout of 10mins\n * that Firestore has.\n *\n */\n private async withTimeout<T>(operation: Promise<T>): Promise<T> {\n const timer = new Promise<never>((_, reject) =>\n setTimeout(() => {\n reject(new Error(`Operation timed out after ${this.timeout}ms`));\n }, this.timeout),\n );\n return Promise.race<T>([operation, timer]);\n }\n\n /**\n * Used to verify that the database is reachable.\n */\n private async verify(): Promise<void> {\n await this.withTimeout(this.database.collection(this.path).limit(1).get());\n }\n}\n"],"names":["Firestore"],"mappings":";;;;AAkCO,MAAM,kBAAqB,GAAA;AAC3B,MAAM,qBAAwB,GAAA;AAE9B,MAAM,iBAAsC,CAAA;AA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CAAA,QAAA,CAAS,UAAW,CAAA,IAAA,CAAK,IAAI,CAAA,CAAE,KAAM,CAAA,CAAC,CAAE,CAAA,GAAA,EAAK,CAAA;AAAA;AAE7E;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PassportStrategyHelper.cjs.js","sources":["../../../src/lib/passport/PassportStrategyHelper.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport express from 'express';\nimport passport from 'passport';\nimport { decodeJwt } from 'jose';\nimport { InternalOAuthError } from 'passport-oauth2';\nimport { ProfileInfo } from '@backstage/plugin-auth-node';\nimport { PassportProfile } from './types';\nimport { OAuthStartResponse } from '../../providers/types';\n\nexport type PassportDoneCallback<Res, Private = never> = (\n err?: Error,\n response?: Res,\n privateInfo?: Private,\n) => void;\n\nexport const makeProfileInfo = (\n profile: PassportProfile,\n idToken?: string,\n): ProfileInfo => {\n let email: string | undefined = undefined;\n if (profile.emails && profile.emails.length > 0) {\n const [firstEmail] = profile.emails;\n email = firstEmail.value;\n }\n\n let picture: string | undefined = undefined;\n if (profile.avatarUrl) {\n picture = profile.avatarUrl;\n } else if (profile.photos && profile.photos.length > 0) {\n const [firstPhoto] = profile.photos;\n picture = firstPhoto.value;\n }\n\n let displayName: string | undefined =\n profile.displayName ?? profile.username ?? profile.id;\n\n if ((!email || !picture || !displayName) && idToken) {\n try {\n const decoded = decodeJwt(idToken) as {\n email?: string;\n name?: string;\n picture?: string;\n };\n if (!email && decoded.email) {\n email = decoded.email;\n }\n if (!picture && decoded.picture) {\n picture = decoded.picture;\n }\n if (!displayName && decoded.name) {\n displayName = decoded.name;\n }\n } catch (e) {\n throw new
|
|
1
|
+
{"version":3,"file":"PassportStrategyHelper.cjs.js","sources":["../../../src/lib/passport/PassportStrategyHelper.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport express from 'express';\nimport passport from 'passport';\nimport { decodeJwt } from 'jose';\nimport { InternalOAuthError } from 'passport-oauth2';\nimport { ProfileInfo } from '@backstage/plugin-auth-node';\nimport { PassportProfile } from './types';\nimport { OAuthStartResponse } from '../../providers/types';\nimport { ForwardedError } from '@backstage/errors';\n\nexport type PassportDoneCallback<Res, Private = never> = (\n err?: Error,\n response?: Res,\n privateInfo?: Private,\n) => void;\n\nexport const makeProfileInfo = (\n profile: PassportProfile,\n idToken?: string,\n): ProfileInfo => {\n let email: string | undefined = undefined;\n if (profile.emails && profile.emails.length > 0) {\n const [firstEmail] = profile.emails;\n email = firstEmail.value;\n }\n\n let picture: string | undefined = undefined;\n if (profile.avatarUrl) {\n picture = profile.avatarUrl;\n } else if (profile.photos && profile.photos.length > 0) {\n const [firstPhoto] = profile.photos;\n picture = firstPhoto.value;\n }\n\n let displayName: string | undefined =\n profile.displayName ?? profile.username ?? profile.id;\n\n if ((!email || !picture || !displayName) && idToken) {\n try {\n const decoded = decodeJwt(idToken) as {\n email?: string;\n name?: string;\n picture?: string;\n };\n if (!email && decoded.email) {\n email = decoded.email;\n }\n if (!picture && decoded.picture) {\n picture = decoded.picture;\n }\n if (!displayName && decoded.name) {\n displayName = decoded.name;\n }\n } catch (e) {\n throw new ForwardedError(\n `Failed to parse id token and get profile info`,\n e,\n );\n }\n }\n\n return {\n email,\n picture,\n displayName,\n };\n};\n\nexport const executeRedirectStrategy = async (\n req: express.Request,\n providerStrategy: passport.Strategy,\n options: Record<string, string>,\n): Promise<OAuthStartResponse> => {\n return new Promise(resolve => {\n const strategy = Object.create(providerStrategy);\n strategy.redirect = (url: string, status?: number) => {\n resolve({ url, status: status ?? undefined });\n };\n\n strategy.authenticate(req, { ...options });\n });\n};\n\nexport const executeFrameHandlerStrategy = async <Result, PrivateInfo = never>(\n req: express.Request,\n providerStrategy: passport.Strategy,\n options?: Record<string, string>,\n) => {\n return new Promise<{ result: Result; privateInfo: PrivateInfo }>(\n (resolve, reject) => {\n const strategy = Object.create(providerStrategy);\n strategy.success = (result: any, privateInfo: any) => {\n resolve({ result, privateInfo });\n };\n strategy.fail = (\n info: { type: 'success' | 'error'; message?: string },\n // _status: number,\n ) => {\n reject(new Error(`Authentication rejected, ${info.message ?? ''}`));\n };\n strategy.error = (error: InternalOAuthError) => {\n let message = `Authentication failed, ${error.message}`;\n\n if (error.oauthError?.data) {\n try {\n const errorData = JSON.parse(error.oauthError.data);\n\n if (errorData.message) {\n message += ` - ${errorData.message}`;\n }\n } catch (parseError) {\n message += ` - ${error.oauthError}`;\n }\n }\n\n reject(new Error(message));\n };\n strategy.redirect = () => {\n reject(new Error('Unexpected redirect'));\n };\n strategy.authenticate(req, { ...(options ?? {}) });\n },\n );\n};\n\ntype RefreshTokenResponse = {\n /**\n * An access token issued for the signed in user.\n */\n accessToken: string;\n /**\n * Optionally, the server can issue a new Refresh Token for the user\n */\n refreshToken?: string;\n params: any;\n};\n\nexport const executeRefreshTokenStrategy = async (\n providerStrategy: passport.Strategy,\n refreshToken: string,\n scope: string,\n): Promise<RefreshTokenResponse> => {\n return new Promise((resolve, reject) => {\n const anyStrategy = providerStrategy as any;\n const OAuth2 = anyStrategy._oauth2.constructor;\n const oauth2 = new OAuth2(\n anyStrategy._oauth2._clientId,\n anyStrategy._oauth2._clientSecret,\n anyStrategy._oauth2._baseSite,\n anyStrategy._oauth2._authorizeUrl,\n anyStrategy._refreshURL || anyStrategy._oauth2._accessTokenUrl,\n anyStrategy._oauth2._customHeaders,\n );\n\n oauth2.getOAuthAccessToken(\n refreshToken,\n {\n scope,\n grant_type: 'refresh_token',\n },\n (\n err: Error | null,\n accessToken: string,\n newRefreshToken: string,\n params: any,\n ) => {\n if (err) {\n reject(new ForwardedError(`Failed to refresh access token`, err));\n }\n if (!accessToken) {\n reject(\n new Error(\n `Failed to refresh access token, no access token received`,\n ),\n );\n }\n\n resolve({\n accessToken,\n refreshToken: newRefreshToken,\n params,\n });\n },\n );\n });\n};\n\ntype ProviderStrategy = {\n userProfile(accessToken: string, callback: Function): void;\n};\n\nexport const executeFetchUserProfileStrategy = async (\n providerStrategy: passport.Strategy,\n accessToken: string,\n): Promise<PassportProfile> => {\n return new Promise((resolve, reject) => {\n const anyStrategy = providerStrategy as unknown as ProviderStrategy;\n anyStrategy.userProfile(\n accessToken,\n (error: Error, rawProfile: PassportProfile) => {\n if (error) {\n reject(error);\n } else {\n resolve(rawProfile);\n }\n },\n );\n });\n};\n"],"names":[],"mappings":";;;;;AAmFO,MAAM,uBAA0B,GAAA,OACrC,GACA,EAAA,gBAAA,EACA,OACgC,KAAA;AAChC,EAAO,OAAA,IAAI,QAAQ,CAAW,OAAA,KAAA;AAC5B,IAAM,MAAA,QAAA,GAAW,MAAO,CAAA,MAAA,CAAO,gBAAgB,CAAA;AAC/C,IAAS,QAAA,CAAA,QAAA,GAAW,CAAC,GAAA,EAAa,MAAoB,KAAA;AACpD,MAAA,OAAA,CAAQ,EAAE,GAAA,EAAK,MAAQ,EAAA,MAAA,IAAU,QAAW,CAAA;AAAA,KAC9C;AAEA,IAAA,QAAA,CAAS,YAAa,CAAA,GAAA,EAAK,EAAE,GAAG,SAAS,CAAA;AAAA,GAC1C,CAAA;AACH;AAEO,MAAM,2BAA8B,GAAA,OACzC,GACA,EAA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ACF;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-auth-backend",
|
|
3
|
-
"version": "0.24.1-next.
|
|
3
|
+
"version": "0.24.1-next.2",
|
|
4
4
|
"description": "A Backstage backend plugin that handles authentication",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin",
|
|
@@ -44,30 +44,30 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@backstage/backend-common": "^0.25.0",
|
|
47
|
-
"@backstage/backend-plugin-api": "1.0
|
|
48
|
-
"@backstage/catalog-client": "1.
|
|
49
|
-
"@backstage/catalog-model": "1.7.
|
|
50
|
-
"@backstage/config": "1.3.0",
|
|
51
|
-
"@backstage/errors": "1.2.
|
|
52
|
-
"@backstage/plugin-auth-backend-module-atlassian-provider": "0.3.3-next.
|
|
53
|
-
"@backstage/plugin-auth-backend-module-auth0-provider": "0.1.3-next.
|
|
54
|
-
"@backstage/plugin-auth-backend-module-aws-alb-provider": "0.3.1-next.
|
|
55
|
-
"@backstage/plugin-auth-backend-module-azure-easyauth-provider": "0.2.3-next.
|
|
56
|
-
"@backstage/plugin-auth-backend-module-bitbucket-provider": "0.2.3-next.
|
|
57
|
-
"@backstage/plugin-auth-backend-module-bitbucket-server-provider": "0.1.3-next.
|
|
58
|
-
"@backstage/plugin-auth-backend-module-cloudflare-access-provider": "0.3.3-next.
|
|
59
|
-
"@backstage/plugin-auth-backend-module-gcp-iap-provider": "0.3.3-next.
|
|
60
|
-
"@backstage/plugin-auth-backend-module-github-provider": "0.2.3-next.
|
|
61
|
-
"@backstage/plugin-auth-backend-module-gitlab-provider": "0.2.3-next.
|
|
62
|
-
"@backstage/plugin-auth-backend-module-google-provider": "0.2.3-next.
|
|
63
|
-
"@backstage/plugin-auth-backend-module-microsoft-provider": "0.2.3-next.
|
|
64
|
-
"@backstage/plugin-auth-backend-module-oauth2-provider": "0.3.3-next.
|
|
65
|
-
"@backstage/plugin-auth-backend-module-oauth2-proxy-provider": "0.2.3-next.
|
|
66
|
-
"@backstage/plugin-auth-backend-module-oidc-provider": "0.3.3-next.
|
|
67
|
-
"@backstage/plugin-auth-backend-module-okta-provider": "0.1.3-next.
|
|
68
|
-
"@backstage/plugin-auth-backend-module-onelogin-provider": "0.2.3-next.
|
|
69
|
-
"@backstage/plugin-auth-node": "0.5.5-next.
|
|
70
|
-
"@backstage/plugin-catalog-node": "1.
|
|
47
|
+
"@backstage/backend-plugin-api": "1.1.0-next.2",
|
|
48
|
+
"@backstage/catalog-client": "1.9.0-next.2",
|
|
49
|
+
"@backstage/catalog-model": "1.7.2-next.0",
|
|
50
|
+
"@backstage/config": "1.3.1-next.0",
|
|
51
|
+
"@backstage/errors": "1.2.6-next.0",
|
|
52
|
+
"@backstage/plugin-auth-backend-module-atlassian-provider": "0.3.3-next.2",
|
|
53
|
+
"@backstage/plugin-auth-backend-module-auth0-provider": "0.1.3-next.2",
|
|
54
|
+
"@backstage/plugin-auth-backend-module-aws-alb-provider": "0.3.1-next.2",
|
|
55
|
+
"@backstage/plugin-auth-backend-module-azure-easyauth-provider": "0.2.3-next.2",
|
|
56
|
+
"@backstage/plugin-auth-backend-module-bitbucket-provider": "0.2.3-next.2",
|
|
57
|
+
"@backstage/plugin-auth-backend-module-bitbucket-server-provider": "0.1.3-next.2",
|
|
58
|
+
"@backstage/plugin-auth-backend-module-cloudflare-access-provider": "0.3.3-next.2",
|
|
59
|
+
"@backstage/plugin-auth-backend-module-gcp-iap-provider": "0.3.3-next.2",
|
|
60
|
+
"@backstage/plugin-auth-backend-module-github-provider": "0.2.3-next.2",
|
|
61
|
+
"@backstage/plugin-auth-backend-module-gitlab-provider": "0.2.3-next.2",
|
|
62
|
+
"@backstage/plugin-auth-backend-module-google-provider": "0.2.3-next.2",
|
|
63
|
+
"@backstage/plugin-auth-backend-module-microsoft-provider": "0.2.3-next.2",
|
|
64
|
+
"@backstage/plugin-auth-backend-module-oauth2-provider": "0.3.3-next.2",
|
|
65
|
+
"@backstage/plugin-auth-backend-module-oauth2-proxy-provider": "0.2.3-next.2",
|
|
66
|
+
"@backstage/plugin-auth-backend-module-oidc-provider": "0.3.3-next.2",
|
|
67
|
+
"@backstage/plugin-auth-backend-module-okta-provider": "0.1.3-next.2",
|
|
68
|
+
"@backstage/plugin-auth-backend-module-onelogin-provider": "0.2.3-next.2",
|
|
69
|
+
"@backstage/plugin-auth-node": "0.5.5-next.2",
|
|
70
|
+
"@backstage/plugin-catalog-node": "1.15.0-next.2",
|
|
71
71
|
"@backstage/types": "1.2.0",
|
|
72
72
|
"@google-cloud/firestore": "^7.0.0",
|
|
73
73
|
"@node-saml/passport-saml": "^5.0.0",
|
|
@@ -89,7 +89,6 @@
|
|
|
89
89
|
"minimatch": "^9.0.0",
|
|
90
90
|
"morgan": "^1.10.0",
|
|
91
91
|
"node-cache": "^5.1.2",
|
|
92
|
-
"node-fetch": "^2.7.0",
|
|
93
92
|
"openid-client": "^5.2.1",
|
|
94
93
|
"passport": "^0.7.0",
|
|
95
94
|
"passport-auth0": "^1.4.3",
|
|
@@ -103,9 +102,9 @@
|
|
|
103
102
|
"yn": "^4.0.0"
|
|
104
103
|
},
|
|
105
104
|
"devDependencies": {
|
|
106
|
-
"@backstage/backend-defaults": "0.6.0-next.
|
|
107
|
-
"@backstage/backend-test-utils": "1.2.0-next.
|
|
108
|
-
"@backstage/cli": "0.29.3-next.
|
|
105
|
+
"@backstage/backend-defaults": "0.6.0-next.2",
|
|
106
|
+
"@backstage/backend-test-utils": "1.2.0-next.2",
|
|
107
|
+
"@backstage/cli": "0.29.3-next.2",
|
|
109
108
|
"@types/body-parser": "^1.19.0",
|
|
110
109
|
"@types/cookie-parser": "^1.4.2",
|
|
111
110
|
"@types/express-session": "^1.17.2",
|