@backstage/integration-react 1.1.32 → 1.2.0-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 +29 -2
- package/dist/api/ScmAuth.esm.js +39 -2
- package/dist/api/ScmAuth.esm.js.map +1 -1
- package/dist/index.d.ts +24 -0
- package/package.json +20 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,37 @@
|
|
|
1
1
|
# @backstage/integration-react
|
|
2
2
|
|
|
3
|
-
## 1.
|
|
3
|
+
## 1.2.0-next.2
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/integration@1.15.1-next.1
|
|
9
|
+
- @backstage/config@1.2.0
|
|
10
|
+
- @backstage/core-plugin-api@1.10.0-next.1
|
|
11
|
+
|
|
12
|
+
## 1.2.0-next.1
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- a11495a: Added new ScmAuth method `forBitbucketServer` that uses correct OAuth scopes by default. Also updated `forBitbucket` method to allow overriding the default OAuth scopes.
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- e969dc7: Move `@types/react` to a peer dependency.
|
|
21
|
+
- 3dbac17: Revert of change #26430
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
- @backstage/core-plugin-api@1.10.0-next.1
|
|
24
|
+
- @backstage/integration@1.15.1-next.0
|
|
25
|
+
- @backstage/config@1.2.0
|
|
26
|
+
|
|
27
|
+
## 1.1.32-next.0
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies
|
|
32
|
+
- @backstage/core-plugin-api@1.10.0-next.0
|
|
33
|
+
- @backstage/config@1.2.0
|
|
34
|
+
- @backstage/integration@1.15.0
|
|
8
35
|
|
|
9
36
|
## 1.1.31
|
|
10
37
|
|
package/dist/api/ScmAuth.esm.js
CHANGED
|
@@ -125,9 +125,46 @@ class ScmAuth {
|
|
|
125
125
|
*/
|
|
126
126
|
static forBitbucket(bitbucketAuthApi, options) {
|
|
127
127
|
const host = options?.host ?? "bitbucket.org";
|
|
128
|
+
const defaultScopes = options?.scopeMapping?.default ?? [
|
|
129
|
+
"account",
|
|
130
|
+
"team",
|
|
131
|
+
"pullrequest",
|
|
132
|
+
"snippet",
|
|
133
|
+
"issue"
|
|
134
|
+
];
|
|
135
|
+
const repoWriteScopes = options?.scopeMapping?.repoWrite ?? [
|
|
136
|
+
"pullrequest:write",
|
|
137
|
+
"snippet:write",
|
|
138
|
+
"issue:write"
|
|
139
|
+
];
|
|
128
140
|
return new ScmAuth("bitbucket", bitbucketAuthApi, host, {
|
|
129
|
-
default:
|
|
130
|
-
repoWrite:
|
|
141
|
+
default: defaultScopes,
|
|
142
|
+
repoWrite: repoWriteScopes
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Creates a new ScmAuth instance that handles authentication towards Bitbucket Server.
|
|
147
|
+
*
|
|
148
|
+
* The host option determines which URLs that are handled by this instance.
|
|
149
|
+
*
|
|
150
|
+
* The default scopes are:
|
|
151
|
+
*
|
|
152
|
+
* `PUBLIC_REPOS REPOS_READ`
|
|
153
|
+
*
|
|
154
|
+
* If the additional `repoWrite` permission is requested, these scopes are added:
|
|
155
|
+
*
|
|
156
|
+
* `REPO_WRITE`
|
|
157
|
+
*/
|
|
158
|
+
static forBitbucketServer(bitbucketAuthApi, options) {
|
|
159
|
+
return this.forBitbucket(bitbucketAuthApi, {
|
|
160
|
+
host: options.host,
|
|
161
|
+
scopeMapping: {
|
|
162
|
+
default: options.scopeMapping?.default ?? [
|
|
163
|
+
"PUBLIC_REPOS",
|
|
164
|
+
"REPOS_READ"
|
|
165
|
+
],
|
|
166
|
+
repoWrite: options.scopeMapping?.repoWrite ?? ["REPO_WRITE"]
|
|
167
|
+
}
|
|
131
168
|
});
|
|
132
169
|
}
|
|
133
170
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScmAuth.esm.js","sources":["../../src/api/ScmAuth.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 {\n bitbucketAuthApiRef,\n createApiFactory,\n githubAuthApiRef,\n gitlabAuthApiRef,\n microsoftAuthApiRef,\n OAuthApi,\n} from '@backstage/core-plugin-api';\nimport {\n ScmAuthApi,\n scmAuthApiRef,\n ScmAuthTokenOptions,\n ScmAuthTokenResponse,\n} from './ScmAuthApi';\n\ntype ScopeMapping = {\n /** The base scopes used for all requests */\n default: string[];\n /** Additional scopes added if `repoWrite` is requested */\n repoWrite: string[];\n};\n\n// An enum of all supported providers\ntype ProviderName = 'generic' | 'github' | 'azure' | 'bitbucket' | 'gitlab';\n\nclass ScmAuthMux implements ScmAuthApi {\n #providers: Array<ScmAuth>;\n\n constructor(providers: ScmAuth[]) {\n this.#providers = providers;\n }\n\n async getCredentials(\n options: ScmAuthTokenOptions,\n ): Promise<ScmAuthTokenResponse> {\n const url = new URL(options.url);\n const provider = this.#providers.find(p => p.isUrlSupported(url));\n if (!provider) {\n throw new Error(\n `No auth provider available for '${options.url}', see https://backstage.io/link?scm-auth`,\n );\n }\n\n return provider.getCredentials(options);\n }\n}\n\n/**\n * An implementation of the ScmAuthApi that merges together OAuthApi instances\n * to form a single instance that can handles authentication for multiple providers.\n *\n * @public\n *\n * @example\n * ```\n * // Supports authentication towards both public GitHub and GHE:\n * createApiFactory({\n * api: scmAuthApiRef,\n * deps: {\n * gheAuthApi: gheAuthApiRef,\n * githubAuthApi: githubAuthApiRef,\n * },\n * factory: ({ githubAuthApi, gheAuthApi }) =>\n * ScmAuth.merge(\n * ScmAuth.forGithub(githubAuthApi),\n * ScmAuth.forGithub(gheAuthApi, {\n * host: 'ghe.example.com',\n * }),\n * )\n * })\n * ```\n */\nexport class ScmAuth implements ScmAuthApi {\n /**\n * Creates an API factory that enables auth for each of the default SCM providers.\n */\n static createDefaultApiFactory() {\n return createApiFactory({\n api: scmAuthApiRef,\n deps: {\n github: githubAuthApiRef,\n gitlab: gitlabAuthApiRef,\n azure: microsoftAuthApiRef,\n bitbucket: bitbucketAuthApiRef,\n },\n factory: ({ github, gitlab, azure, bitbucket }) =>\n ScmAuth.merge(\n ScmAuth.forGithub(github),\n ScmAuth.forGitlab(gitlab),\n ScmAuth.forAzure(azure),\n ScmAuth.forBitbucket(bitbucket),\n ),\n });\n }\n\n /**\n * Creates a general purpose ScmAuth instance with a custom scope mapping.\n */\n static forAuthApi(\n authApi: OAuthApi,\n options: {\n host: string;\n scopeMapping: {\n default: string[];\n repoWrite: string[];\n };\n },\n ): ScmAuth {\n return new ScmAuth('generic', authApi, options.host, options.scopeMapping);\n }\n\n /**\n * Creates a new ScmAuth instance that handles authentication towards GitHub.\n *\n * The host option determines which URLs that are handled by this instance and defaults to `github.com`.\n *\n * The default scopes are:\n *\n * `repo read:org read:user`\n *\n * If the additional `repoWrite` permission is requested, these scopes are added:\n *\n * `gist`\n */\n static forGithub(\n githubAuthApi: OAuthApi,\n options?: {\n host?: string;\n },\n ): ScmAuth {\n const host = options?.host ?? 'github.com';\n return new ScmAuth('github', githubAuthApi, host, {\n default: ['repo', 'read:org', 'read:user'],\n repoWrite: ['gist'],\n });\n }\n\n /**\n * Creates a new ScmAuth instance that handles authentication towards GitLab.\n *\n * The host option determines which URLs that are handled by this instance and defaults to `gitlab.com`.\n *\n * The default scopes are:\n *\n * `read_user read_api read_repository`\n *\n * If the additional `repoWrite` permission is requested, these scopes are added:\n *\n * `write_repository api`\n */\n static forGitlab(\n gitlabAuthApi: OAuthApi,\n options?: {\n host?: string;\n },\n ): ScmAuth {\n const host = options?.host ?? 'gitlab.com';\n return new ScmAuth('gitlab', gitlabAuthApi, host, {\n default: ['read_user', 'read_api', 'read_repository'],\n repoWrite: ['write_repository api'],\n });\n }\n\n /**\n * Creates a new ScmAuth instance that handles authentication towards Azure.\n *\n * The host option determines which URLs that are handled by this instance and defaults to `dev.azure.com`.\n *\n * The default scopes are:\n *\n * `vso.build vso.code vso.graph vso.project vso.profile`\n *\n * If the additional `repoWrite` permission is requested, these scopes are added:\n *\n * `vso.code_manage`\n */\n static forAzure(\n microsoftAuthApi: OAuthApi,\n options?: {\n host?: string;\n },\n ): ScmAuth {\n const host = options?.host ?? 'dev.azure.com';\n return new ScmAuth('azure', microsoftAuthApi, host, {\n default: [\n '499b84ac-1321-427f-aa17-267ca6975798/vso.build',\n '499b84ac-1321-427f-aa17-267ca6975798/vso.code',\n '499b84ac-1321-427f-aa17-267ca6975798/vso.graph',\n '499b84ac-1321-427f-aa17-267ca6975798/vso.project',\n '499b84ac-1321-427f-aa17-267ca6975798/vso.profile',\n ],\n repoWrite: ['499b84ac-1321-427f-aa17-267ca6975798/vso.code_manage'],\n });\n }\n\n /**\n * Creates a new ScmAuth instance that handles authentication towards Bitbucket.\n *\n * The host option determines which URLs that are handled by this instance and defaults to `bitbucket.org`.\n *\n * The default scopes are:\n *\n * `account team pullrequest snippet issue`\n *\n * If the additional `repoWrite` permission is requested, these scopes are added:\n *\n * `pullrequest:write snippet:write issue:write`\n */\n static forBitbucket(\n bitbucketAuthApi: OAuthApi,\n options?: {\n host?: string;\n },\n ): ScmAuth {\n const host = options?.host ?? 'bitbucket.org';\n return new ScmAuth('bitbucket', bitbucketAuthApi, host, {\n default: ['account', 'team', 'pullrequest', 'snippet', 'issue'],\n repoWrite: ['pullrequest:write', 'snippet:write', 'issue:write'],\n });\n }\n\n /**\n * Merges together multiple ScmAuth instances into one that\n * routes requests to the correct instance based on the URL.\n */\n static merge(...providers: ScmAuth[]): ScmAuthApi {\n return new ScmAuthMux(providers);\n }\n\n #api: OAuthApi;\n #host: string;\n #scopeMapping: ScopeMapping;\n #providerName: ProviderName;\n\n private constructor(\n providerName: ProviderName,\n api: OAuthApi,\n host: string,\n scopeMapping: ScopeMapping,\n ) {\n this.#api = api;\n this.#host = host;\n this.#scopeMapping = scopeMapping;\n this.#providerName = providerName;\n }\n\n /**\n * Checks whether the implementation is able to provide authentication for the given URL.\n */\n isUrlSupported(url: URL): boolean {\n return url.host === this.#host;\n }\n\n private getAdditionalScopesForProvider(\n additionalScopes: ScmAuthTokenOptions['additionalScope'],\n ): string[] {\n if (!additionalScopes?.customScopes || this.#providerName === 'generic') {\n return [];\n }\n\n return additionalScopes.customScopes?.[this.#providerName] ?? [];\n }\n\n /**\n * Fetches credentials for the given resource.\n */\n async getCredentials(\n options: ScmAuthTokenOptions,\n ): Promise<ScmAuthTokenResponse> {\n const { url, additionalScope, ...restOptions } = options;\n\n const scopes = this.#scopeMapping.default.slice();\n if (additionalScope?.repoWrite) {\n scopes.push(...this.#scopeMapping.repoWrite);\n }\n\n const additionalScopes =\n this.getAdditionalScopesForProvider(additionalScope);\n\n if (additionalScopes.length) {\n scopes.push(...additionalScopes);\n }\n\n const uniqueScopes = [...new Set(scopes)];\n\n const token = await this.#api.getAccessToken(uniqueScopes, restOptions);\n\n return {\n token,\n headers: {\n Authorization: `Bearer ${token}`,\n },\n };\n }\n}\n"],"names":[],"mappings":";;;AAyCA,MAAM,UAAiC,CAAA;AAAA,EACrC,UAAA,CAAA;AAAA,EAEA,YAAY,SAAsB,EAAA;AAChC,IAAA,IAAA,CAAK,UAAa,GAAA,SAAA,CAAA;AAAA,GACpB;AAAA,EAEA,MAAM,eACJ,OAC+B,EAAA;AAC/B,IAAA,MAAM,GAAM,GAAA,IAAI,GAAI,CAAA,OAAA,CAAQ,GAAG,CAAA,CAAA;AAC/B,IAAM,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,IAAK,CAAA,aAAa,KAAK,EAAC,CAAA;AAAA,GACjE;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,eACJ,OAC+B,EAAA;AAC/B,IAAA,MAAM,EAAE,GAAA,EAAK,eAAiB,EAAA,GAAG,aAAgB,GAAA,OAAA,CAAA;AAEjD,IAAA,MAAM,MAAS,GAAA,IAAA,CAAK,aAAc,CAAA,OAAA,CAAQ,KAAM,EAAA,CAAA;AAChD,IAAA,IAAI,iBAAiB,SAAW,EAAA;AAC9B,MAAA,MAAA,CAAO,IAAK,CAAA,GAAG,IAAK,CAAA,aAAA,CAAc,SAAS,CAAA,CAAA;AAAA,KAC7C;AAEA,IAAM,MAAA,gBAAA,GACJ,IAAK,CAAA,8BAAA,CAA+B,eAAe,CAAA,CAAA;AAErD,IAAA,IAAI,iBAAiB,MAAQ,EAAA;AAC3B,MAAO,MAAA,CAAA,IAAA,CAAK,GAAG,gBAAgB,CAAA,CAAA;AAAA,KACjC;AAEA,IAAA,MAAM,eAAe,CAAC,GAAG,IAAI,GAAA,CAAI,MAAM,CAAC,CAAA,CAAA;AAExC,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,IAAK,CAAA,cAAA,CAAe,cAAc,WAAW,CAAA,CAAA;AAEtE,IAAO,OAAA;AAAA,MACL,KAAA;AAAA,MACA,OAAS,EAAA;AAAA,QACP,aAAA,EAAe,UAAU,KAAK,CAAA,CAAA;AAAA,OAChC;AAAA,KACF,CAAA;AAAA,GACF;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"ScmAuth.esm.js","sources":["../../src/api/ScmAuth.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 {\n bitbucketAuthApiRef,\n createApiFactory,\n githubAuthApiRef,\n gitlabAuthApiRef,\n microsoftAuthApiRef,\n OAuthApi,\n} from '@backstage/core-plugin-api';\nimport {\n ScmAuthApi,\n scmAuthApiRef,\n ScmAuthTokenOptions,\n ScmAuthTokenResponse,\n} from './ScmAuthApi';\n\ntype ScopeMapping = {\n /** The base scopes used for all requests */\n default: string[];\n /** Additional scopes added if `repoWrite` is requested */\n repoWrite: string[];\n};\n\n// An enum of all supported providers\ntype ProviderName = 'generic' | 'github' | 'azure' | 'bitbucket' | 'gitlab';\n\nclass ScmAuthMux implements ScmAuthApi {\n #providers: Array<ScmAuth>;\n\n constructor(providers: ScmAuth[]) {\n this.#providers = providers;\n }\n\n async getCredentials(\n options: ScmAuthTokenOptions,\n ): Promise<ScmAuthTokenResponse> {\n const url = new URL(options.url);\n const provider = this.#providers.find(p => p.isUrlSupported(url));\n if (!provider) {\n throw new Error(\n `No auth provider available for '${options.url}', see https://backstage.io/link?scm-auth`,\n );\n }\n\n return provider.getCredentials(options);\n }\n}\n\n/**\n * An implementation of the ScmAuthApi that merges together OAuthApi instances\n * to form a single instance that can handles authentication for multiple providers.\n *\n * @public\n *\n * @example\n * ```\n * // Supports authentication towards both public GitHub and GHE:\n * createApiFactory({\n * api: scmAuthApiRef,\n * deps: {\n * gheAuthApi: gheAuthApiRef,\n * githubAuthApi: githubAuthApiRef,\n * },\n * factory: ({ githubAuthApi, gheAuthApi }) =>\n * ScmAuth.merge(\n * ScmAuth.forGithub(githubAuthApi),\n * ScmAuth.forGithub(gheAuthApi, {\n * host: 'ghe.example.com',\n * }),\n * )\n * })\n * ```\n */\nexport class ScmAuth implements ScmAuthApi {\n /**\n * Creates an API factory that enables auth for each of the default SCM providers.\n */\n static createDefaultApiFactory() {\n return createApiFactory({\n api: scmAuthApiRef,\n deps: {\n github: githubAuthApiRef,\n gitlab: gitlabAuthApiRef,\n azure: microsoftAuthApiRef,\n bitbucket: bitbucketAuthApiRef,\n },\n factory: ({ github, gitlab, azure, bitbucket }) =>\n ScmAuth.merge(\n ScmAuth.forGithub(github),\n ScmAuth.forGitlab(gitlab),\n ScmAuth.forAzure(azure),\n ScmAuth.forBitbucket(bitbucket),\n ),\n });\n }\n\n /**\n * Creates a general purpose ScmAuth instance with a custom scope mapping.\n */\n static forAuthApi(\n authApi: OAuthApi,\n options: {\n host: string;\n scopeMapping: {\n default: string[];\n repoWrite: string[];\n };\n },\n ): ScmAuth {\n return new ScmAuth('generic', authApi, options.host, options.scopeMapping);\n }\n\n /**\n * Creates a new ScmAuth instance that handles authentication towards GitHub.\n *\n * The host option determines which URLs that are handled by this instance and defaults to `github.com`.\n *\n * The default scopes are:\n *\n * `repo read:org read:user`\n *\n * If the additional `repoWrite` permission is requested, these scopes are added:\n *\n * `gist`\n */\n static forGithub(\n githubAuthApi: OAuthApi,\n options?: {\n host?: string;\n },\n ): ScmAuth {\n const host = options?.host ?? 'github.com';\n return new ScmAuth('github', githubAuthApi, host, {\n default: ['repo', 'read:org', 'read:user'],\n repoWrite: ['gist'],\n });\n }\n\n /**\n * Creates a new ScmAuth instance that handles authentication towards GitLab.\n *\n * The host option determines which URLs that are handled by this instance and defaults to `gitlab.com`.\n *\n * The default scopes are:\n *\n * `read_user read_api read_repository`\n *\n * If the additional `repoWrite` permission is requested, these scopes are added:\n *\n * `write_repository api`\n */\n static forGitlab(\n gitlabAuthApi: OAuthApi,\n options?: {\n host?: string;\n },\n ): ScmAuth {\n const host = options?.host ?? 'gitlab.com';\n return new ScmAuth('gitlab', gitlabAuthApi, host, {\n default: ['read_user', 'read_api', 'read_repository'],\n repoWrite: ['write_repository api'],\n });\n }\n\n /**\n * Creates a new ScmAuth instance that handles authentication towards Azure.\n *\n * The host option determines which URLs that are handled by this instance and defaults to `dev.azure.com`.\n *\n * The default scopes are:\n *\n * `vso.build vso.code vso.graph vso.project vso.profile`\n *\n * If the additional `repoWrite` permission is requested, these scopes are added:\n *\n * `vso.code_manage`\n */\n static forAzure(\n microsoftAuthApi: OAuthApi,\n options?: {\n host?: string;\n },\n ): ScmAuth {\n const host = options?.host ?? 'dev.azure.com';\n return new ScmAuth('azure', microsoftAuthApi, host, {\n default: [\n '499b84ac-1321-427f-aa17-267ca6975798/vso.build',\n '499b84ac-1321-427f-aa17-267ca6975798/vso.code',\n '499b84ac-1321-427f-aa17-267ca6975798/vso.graph',\n '499b84ac-1321-427f-aa17-267ca6975798/vso.project',\n '499b84ac-1321-427f-aa17-267ca6975798/vso.profile',\n ],\n repoWrite: ['499b84ac-1321-427f-aa17-267ca6975798/vso.code_manage'],\n });\n }\n\n /**\n * Creates a new ScmAuth instance that handles authentication towards Bitbucket.\n *\n * The host option determines which URLs that are handled by this instance and defaults to `bitbucket.org`.\n *\n * The default scopes are:\n *\n * `account team pullrequest snippet issue`\n *\n * If the additional `repoWrite` permission is requested, these scopes are added:\n *\n * `pullrequest:write snippet:write issue:write`\n */\n static forBitbucket(\n bitbucketAuthApi: OAuthApi,\n options?: {\n host?: string;\n scopeMapping?: {\n default?: string[];\n repoWrite?: string[];\n };\n },\n ): ScmAuth {\n const host = options?.host ?? 'bitbucket.org';\n const defaultScopes = options?.scopeMapping?.default ?? [\n 'account',\n 'team',\n 'pullrequest',\n 'snippet',\n 'issue',\n ];\n const repoWriteScopes = options?.scopeMapping?.repoWrite ?? [\n 'pullrequest:write',\n 'snippet:write',\n 'issue:write',\n ];\n return new ScmAuth('bitbucket', bitbucketAuthApi, host, {\n default: defaultScopes,\n repoWrite: repoWriteScopes,\n });\n }\n\n /**\n * Creates a new ScmAuth instance that handles authentication towards Bitbucket Server.\n *\n * The host option determines which URLs that are handled by this instance.\n *\n * The default scopes are:\n *\n * `PUBLIC_REPOS REPOS_READ`\n *\n * If the additional `repoWrite` permission is requested, these scopes are added:\n *\n * `REPO_WRITE`\n */\n static forBitbucketServer(\n bitbucketAuthApi: OAuthApi,\n options: {\n host: string;\n scopeMapping?: {\n default?: string[];\n repoWrite?: string[];\n };\n },\n ): ScmAuth {\n return this.forBitbucket(bitbucketAuthApi, {\n host: options.host,\n scopeMapping: {\n default: options.scopeMapping?.default ?? [\n 'PUBLIC_REPOS',\n 'REPOS_READ',\n ],\n repoWrite: options.scopeMapping?.repoWrite ?? ['REPO_WRITE'],\n },\n });\n }\n\n /**\n * Merges together multiple ScmAuth instances into one that\n * routes requests to the correct instance based on the URL.\n */\n static merge(...providers: ScmAuth[]): ScmAuthApi {\n return new ScmAuthMux(providers);\n }\n\n #api: OAuthApi;\n #host: string;\n #scopeMapping: ScopeMapping;\n #providerName: ProviderName;\n\n private constructor(\n providerName: ProviderName,\n api: OAuthApi,\n host: string,\n scopeMapping: ScopeMapping,\n ) {\n this.#api = api;\n this.#host = host;\n this.#scopeMapping = scopeMapping;\n this.#providerName = providerName;\n }\n\n /**\n * Checks whether the implementation is able to provide authentication for the given URL.\n */\n isUrlSupported(url: URL): boolean {\n return url.host === this.#host;\n }\n\n private getAdditionalScopesForProvider(\n additionalScopes: ScmAuthTokenOptions['additionalScope'],\n ): string[] {\n if (!additionalScopes?.customScopes || this.#providerName === 'generic') {\n return [];\n }\n\n return additionalScopes.customScopes?.[this.#providerName] ?? [];\n }\n\n /**\n * Fetches credentials for the given resource.\n */\n async getCredentials(\n options: ScmAuthTokenOptions,\n ): Promise<ScmAuthTokenResponse> {\n const { url, additionalScope, ...restOptions } = options;\n\n const scopes = this.#scopeMapping.default.slice();\n if (additionalScope?.repoWrite) {\n scopes.push(...this.#scopeMapping.repoWrite);\n }\n\n const additionalScopes =\n this.getAdditionalScopesForProvider(additionalScope);\n\n if (additionalScopes.length) {\n scopes.push(...additionalScopes);\n }\n\n const uniqueScopes = [...new Set(scopes)];\n\n const token = await this.#api.getAccessToken(uniqueScopes, restOptions);\n\n return {\n token,\n headers: {\n Authorization: `Bearer ${token}`,\n },\n };\n }\n}\n"],"names":[],"mappings":";;;AAyCA,MAAM,UAAiC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,iBAAiB,SAAW,EAAA;AAC9B,MAAA,MAAA,CAAO,IAAK,CAAA,GAAG,IAAK,CAAA,aAAA,CAAc,SAAS,CAAA,CAAA;AAAA,KAC7C;AAEA,IAAM,MAAA,gBAAA,GACJ,IAAK,CAAA,8BAAA,CAA+B,eAAe,CAAA,CAAA;AAErD,IAAA,IAAI,iBAAiB,MAAQ,EAAA;AAC3B,MAAO,MAAA,CAAA,IAAA,CAAK,GAAG,gBAAgB,CAAA,CAAA;AAAA,KACjC;AAEA,IAAA,MAAM,eAAe,CAAC,GAAG,IAAI,GAAA,CAAI,MAAM,CAAC,CAAA,CAAA;AAExC,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,IAAK,CAAA,cAAA,CAAe,cAAc,WAAW,CAAA,CAAA;AAEtE,IAAO,OAAA;AAAA,MACL,KAAA;AAAA,MACA,OAAS,EAAA;AAAA,QACP,aAAA,EAAe,UAAU,KAAK,CAAA,CAAA;AAAA,OAChC;AAAA,KACF,CAAA;AAAA,GACF;AACF;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -186,6 +186,30 @@ declare class ScmAuth implements ScmAuthApi {
|
|
|
186
186
|
*/
|
|
187
187
|
static forBitbucket(bitbucketAuthApi: OAuthApi, options?: {
|
|
188
188
|
host?: string;
|
|
189
|
+
scopeMapping?: {
|
|
190
|
+
default?: string[];
|
|
191
|
+
repoWrite?: string[];
|
|
192
|
+
};
|
|
193
|
+
}): ScmAuth;
|
|
194
|
+
/**
|
|
195
|
+
* Creates a new ScmAuth instance that handles authentication towards Bitbucket Server.
|
|
196
|
+
*
|
|
197
|
+
* The host option determines which URLs that are handled by this instance.
|
|
198
|
+
*
|
|
199
|
+
* The default scopes are:
|
|
200
|
+
*
|
|
201
|
+
* `PUBLIC_REPOS REPOS_READ`
|
|
202
|
+
*
|
|
203
|
+
* If the additional `repoWrite` permission is requested, these scopes are added:
|
|
204
|
+
*
|
|
205
|
+
* `REPO_WRITE`
|
|
206
|
+
*/
|
|
207
|
+
static forBitbucketServer(bitbucketAuthApi: OAuthApi, options: {
|
|
208
|
+
host: string;
|
|
209
|
+
scopeMapping?: {
|
|
210
|
+
default?: string[];
|
|
211
|
+
repoWrite?: string[];
|
|
212
|
+
};
|
|
189
213
|
}): ScmAuth;
|
|
190
214
|
/**
|
|
191
215
|
* Merges together multiple ScmAuth instances into one that
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/integration-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0-next.2",
|
|
4
4
|
"description": "Frontend package for managing integrations towards external systems",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "web-library"
|
|
@@ -33,26 +33,35 @@
|
|
|
33
33
|
"test": "backstage-cli package test"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@backstage/config": "
|
|
37
|
-
"@backstage/core-plugin-api": "
|
|
38
|
-
"@backstage/integration": "
|
|
36
|
+
"@backstage/config": "1.2.0",
|
|
37
|
+
"@backstage/core-plugin-api": "1.10.0-next.1",
|
|
38
|
+
"@backstage/integration": "1.15.1-next.1",
|
|
39
39
|
"@material-ui/core": "^4.12.2",
|
|
40
|
-
"@material-ui/icons": "^4.9.1"
|
|
41
|
-
"@types/react": "^16.13.1 || ^17.0.0"
|
|
40
|
+
"@material-ui/icons": "^4.9.1"
|
|
42
41
|
},
|
|
43
42
|
"devDependencies": {
|
|
44
|
-
"@backstage/cli": "
|
|
45
|
-
"@backstage/core-components": "
|
|
46
|
-
"@backstage/dev-utils": "
|
|
47
|
-
"@backstage/test-utils": "
|
|
43
|
+
"@backstage/cli": "0.28.0-next.2",
|
|
44
|
+
"@backstage/core-components": "0.15.1-next.2",
|
|
45
|
+
"@backstage/dev-utils": "1.1.2-next.2",
|
|
46
|
+
"@backstage/test-utils": "1.6.1-next.2",
|
|
48
47
|
"@testing-library/dom": "^10.0.0",
|
|
49
48
|
"@testing-library/jest-dom": "^6.0.0",
|
|
50
|
-
"
|
|
49
|
+
"@types/react": "^18.0.0",
|
|
50
|
+
"msw": "^1.0.0",
|
|
51
|
+
"react": "^18.0.2",
|
|
52
|
+
"react-dom": "^18.0.2",
|
|
53
|
+
"react-router-dom": "^6.3.0"
|
|
51
54
|
},
|
|
52
55
|
"peerDependencies": {
|
|
56
|
+
"@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
53
57
|
"react": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
54
58
|
"react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
55
59
|
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
|
|
56
60
|
},
|
|
61
|
+
"peerDependenciesMeta": {
|
|
62
|
+
"@types/react": {
|
|
63
|
+
"optional": true
|
|
64
|
+
}
|
|
65
|
+
},
|
|
57
66
|
"module": "./dist/index.esm.js"
|
|
58
67
|
}
|