Version Packages
This commit is contained in:
@@ -1,5 +1,100 @@
|
||||
# @backstage/integration-react
|
||||
|
||||
## 0.1.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 18148f23da: Added `ScmAuthApi` along with the implementation `ScmAuth`. The `ScmAuthApi` provides methods for client-side authentication towards multiple different source code management services simultaneously.
|
||||
|
||||
When requesting credentials you supply a URL along with the same options as the other `OAuthApi`s, and optionally a request for additional high-level scopes.
|
||||
|
||||
For example like this:
|
||||
|
||||
```ts
|
||||
const { token } = await scmAuthApi.getCredentials({
|
||||
url: 'https://ghe.example.com/backstage/backstage',
|
||||
additionalScope: {
|
||||
repoWrite: true,
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
The instantiation of the API can either be done with a default factory that adds support for the public providers (github.com, gitlab.com, etc.):
|
||||
|
||||
```ts
|
||||
// in packages/app/apis.ts
|
||||
ScmAuth.createDefaultApiFactory();
|
||||
```
|
||||
|
||||
Or with a more custom setup that can add support for additional providers, for example like this:
|
||||
|
||||
```ts
|
||||
createApiFactory({
|
||||
api: scmAuthApiRef,
|
||||
deps: {
|
||||
gheAuthApi: gheAuthApiRef,
|
||||
githubAuthApi: githubAuthApiRef,
|
||||
},
|
||||
factory: ({ githubAuthApi, gheAuthApi }) =>
|
||||
ScmAuth.merge(
|
||||
ScmAuth.forGithub(githubAuthApi),
|
||||
ScmAuth.forGithub(gheAuthApi, {
|
||||
host: 'ghe.example.com',
|
||||
}),
|
||||
),
|
||||
});
|
||||
```
|
||||
|
||||
The additional `gheAuthApiRef` utility API can be defined either inside the app itself if it's only used for this purpose, for inside an internal common package for APIs, such as `@internal/apis`:
|
||||
|
||||
```ts
|
||||
const gheAuthApiRef: ApiRef<OAuthApi & ProfileInfoApi & SessionApi> =
|
||||
createApiRef({
|
||||
id: 'internal.auth.ghe',
|
||||
});
|
||||
```
|
||||
|
||||
And then implemented using the `GithubAuth` class from `@backstage/core-app-api`:
|
||||
|
||||
```ts
|
||||
createApiFactory({
|
||||
api: githubAuthApiRef,
|
||||
deps: {
|
||||
discoveryApi: discoveryApiRef,
|
||||
oauthRequestApi: oauthRequestApiRef,
|
||||
configApi: configApiRef,
|
||||
},
|
||||
factory: ({ discoveryApi, oauthRequestApi, configApi }) =>
|
||||
GithubAuth.create({
|
||||
provider: {
|
||||
id: 'ghe',
|
||||
icon: ...,
|
||||
title: 'GHE'
|
||||
},
|
||||
discoveryApi,
|
||||
oauthRequestApi,
|
||||
defaultScopes: ['read:user'],
|
||||
environment: configApi.getOptionalString('auth.environment'),
|
||||
}),
|
||||
})
|
||||
```
|
||||
|
||||
Finally you also need to add and configure another GitHub provider to the `auth-backend` using the provider ID `ghe`:
|
||||
|
||||
```ts
|
||||
// Add the following options to `createRouter` in packages/backend/src/plugins/auth.ts
|
||||
providerFactories: {
|
||||
ghe: createGithubProvider(),
|
||||
},
|
||||
```
|
||||
|
||||
Other providers follow the same steps, but you will want to use the appropriate auth API implementation in the frontend, such as for example `GitlabAuth`.
|
||||
|
||||
- Updated dependencies
|
||||
- @backstage/integration@0.6.6
|
||||
- @backstage/core-plugin-api@0.1.9
|
||||
- @backstage/core-components@0.6.0
|
||||
|
||||
## 0.1.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@backstage/integration-react",
|
||||
"description": "Frontend package for managing integrations towards external systems",
|
||||
"version": "0.1.10",
|
||||
"version": "0.1.11",
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"license": "Apache-2.0",
|
||||
@@ -22,9 +22,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/config": "^0.1.10",
|
||||
"@backstage/core-components": "^0.5.0",
|
||||
"@backstage/core-plugin-api": "^0.1.8",
|
||||
"@backstage/integration": "^0.6.5",
|
||||
"@backstage/core-components": "^0.6.0",
|
||||
"@backstage/core-plugin-api": "^0.1.9",
|
||||
"@backstage/integration": "^0.6.6",
|
||||
"@backstage/theme": "^0.2.9",
|
||||
"@material-ui/core": "^4.12.2",
|
||||
"@material-ui/icons": "^4.9.1",
|
||||
@@ -34,8 +34,8 @@
|
||||
"react-use": "^17.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "^0.7.13",
|
||||
"@backstage/dev-utils": "^0.2.10",
|
||||
"@backstage/cli": "^0.7.14",
|
||||
"@backstage/dev-utils": "^0.2.11",
|
||||
"@backstage/test-utils": "^0.1.17",
|
||||
"@testing-library/jest-dom": "^5.10.1",
|
||||
"@testing-library/react": "^11.2.5",
|
||||
|
||||
Reference in New Issue
Block a user