@backstage/plugin-auth-backend 0.13.0-next.2 → 0.13.0

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.
Files changed (2) hide show
  1. package/CHANGELOG.md +140 -0
  2. package/package.json +9 -9
package/CHANGELOG.md CHANGED
@@ -1,5 +1,145 @@
1
1
  # @backstage/plugin-auth-backend
2
2
 
3
+ ## 0.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 15d3a3c39a: **BREAKING**: All sign-in resolvers must now return a `token` in their sign-in result. Returning an `id` is no longer supported.
8
+ - c5aeaf339d: **BREAKING**: All auth providers have had their default sign-in resolvers removed. This means that if you want to use a particular provider for sign-in, you must provide an explicit sign-in resolver. For more information on how to configure sign-in resolvers, see the [sign-in resolver documentation](https://backstage.io/docs/auth/identity-resolver).
9
+
10
+ ### Patch Changes
11
+
12
+ - c5aeaf339d: **DEPRECATION**: The `AuthProviderFactoryOptions` type has been deprecated, as the options are now instead inlined in the `AuthProviderFactory` type. This will make it possible to more easily introduce new options in the future without a possibly breaking change.
13
+ - 794f7542b6: Updated openid-client from 4.1.2 to 5.1.3
14
+ - c5aeaf339d: **DEPRECATION**: The `getEntityClaims` helper has been deprecated, with `getDefaultOwnershipEntityRefs` being added to replace it.
15
+ - de231e5b06: Declare oauth2 `clientSecret` with visibility secret
16
+ - c5aeaf339d: **DEPRECATION**: All `create<Provider>Provider` and `<provider>*SignInResolver` have been deprecated. Instead, a single `providers` object is exported which contains all built-in auth providers.
17
+
18
+ If you have a setup that currently looks for example like this:
19
+
20
+ ```ts
21
+ import {
22
+ createRouter,
23
+ defaultAuthProviderFactories,
24
+ createGoogleProvider,
25
+ googleEmailSignInResolver,
26
+ } from '@backstage/plugin-auth-backend';
27
+ import { Router } from 'express';
28
+ import { PluginEnvironment } from '../types';
29
+
30
+ export default async function createPlugin(
31
+ env: PluginEnvironment,
32
+ ): Promise<Router> {
33
+ return await createRouter({
34
+ ...env,
35
+ providerFactories: {
36
+ ...defaultAuthProviderFactories,
37
+ google: createGoogleProvider({
38
+ signIn: {
39
+ resolver: googleEmailSignInResolver,
40
+ },
41
+ }),
42
+ },
43
+ });
44
+ }
45
+ ```
46
+
47
+ You would migrate it to something like this:
48
+
49
+ ```ts
50
+ import {
51
+ createRouter,
52
+ providers,
53
+ defaultAuthProviderFactories,
54
+ } from '@backstage/plugin-auth-backend';
55
+ import { Router } from 'express';
56
+ import { PluginEnvironment } from '../types';
57
+
58
+ export default async function createPlugin(
59
+ env: PluginEnvironment,
60
+ ): Promise<Router> {
61
+ return await createRouter({
62
+ ...env,
63
+ providerFactories: {
64
+ ...defaultAuthProviderFactories,
65
+ google: providers.google.create({
66
+ signIn: {
67
+ resolver:
68
+ providers.google.resolvers.emailMatchingUserEntityAnnotation(),
69
+ },
70
+ }),
71
+ },
72
+ });
73
+ }
74
+ ```
75
+
76
+ - 2cc1d1b235: Applied the fix from version 0.12.3 of this package, which is part of the v1.0.1 release of Backstage.
77
+ - c5aeaf339d: **DEPRECATION** The `AuthResolverContext` has received a number of changes, which is the context used by auth handlers and sign-in resolvers.
78
+
79
+ The following fields deprecated: `logger`, `tokenIssuer`, `catalogIdentityClient`. If you need to access the `logger`, you can do so through a closure instead. The `tokenIssuer` has been replaced with an `issueToken` method, which is available directory on the context. The `catalogIdentityClient` has been replaced by the `signInWithCatalogUser` method, as well as the lower level `findCatalogUser` method and `getDefaultOwnershipEntityRefs` helper.
80
+
81
+ It should be possible to migrate most sign-in resolvers to more or less only use `signInWithCatalogUser`, for example an email lookup resolver like this one:
82
+
83
+ ```ts
84
+ async ({ profile }, ctx) => {
85
+ if (!profile.email) {
86
+ throw new Error('Profile contained no email');
87
+ }
88
+
89
+ const entity = await ctx.catalogIdentityClient.findUser({
90
+ annotations: {
91
+ 'acme.org/email': profile.email,
92
+ },
93
+ });
94
+
95
+ const claims = getEntityClaims(entity);
96
+ const token = await ctx.tokenIssuer.issueToken({ claims });
97
+
98
+ return { id: entity.metadata.name, entity, token };
99
+ };
100
+ ```
101
+
102
+ can be migrated to the following:
103
+
104
+ ```ts
105
+ async ({ profile }, ctx) => {
106
+ if (!profile.email) {
107
+ throw new Error('Profile contained no email');
108
+ }
109
+
110
+ return ctx.signInWithCatalogUser({
111
+ annotations: {
112
+ 'acme.org/email': profile.email,
113
+ },
114
+ });
115
+ };
116
+ ```
117
+
118
+ While a direct entity name lookup using a user ID might look like this:
119
+
120
+ ```ts
121
+ async ({ result: { fullProfile } }, ctx) => {
122
+ return ctx.signInWithCatalogUser({
123
+ entityRef: {
124
+ name: fullProfile.userId,
125
+ },
126
+ });
127
+ };
128
+ ```
129
+
130
+ If you want more control over the way that users are looked up, ownership is assigned, or tokens are issued, you can use a combination of the `findCatalogUser`, `getDefaultOwnershipEntityRefs`, and `issueToken` instead.
131
+
132
+ - f4cdf4cac1: Defensively encode URL parameters when fetching ELB keys
133
+ - 6ee04078e1: **DEPRECATION**: The `tokenIssuer` option for `OAuthAdapter` is no longer needed and has been deprecated.
134
+ - a45bce06e3: Handle trailing slashes on GitHub `enterpriseInstanceUrl` settings
135
+ - 45f7a261c7: Bumped passport-microsoft to resolve CVE-2021-41580
136
+ - c5aeaf339d: Added exports of the following types: `AuthProviderConfig`, `StateEncoder`, `TokenParams`, `AwsAlbResult`.
137
+ - Updated dependencies
138
+ - @backstage/catalog-model@1.0.1
139
+ - @backstage/plugin-auth-node@0.2.0
140
+ - @backstage/backend-common@0.13.2
141
+ - @backstage/catalog-client@1.0.1
142
+
3
143
  ## 0.13.0-next.2
4
144
 
5
145
  ### Minor Changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/plugin-auth-backend",
3
3
  "description": "A Backstage backend plugin that handles authentication",
4
- "version": "0.13.0-next.2",
4
+ "version": "0.13.0",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -33,12 +33,12 @@
33
33
  "clean": "backstage-cli package clean"
34
34
  },
35
35
  "dependencies": {
36
- "@backstage/backend-common": "^0.13.2-next.2",
37
- "@backstage/catalog-client": "^1.0.1-next.0",
38
- "@backstage/catalog-model": "^1.0.1-next.0",
36
+ "@backstage/backend-common": "^0.13.2",
37
+ "@backstage/catalog-client": "^1.0.1",
38
+ "@backstage/catalog-model": "^1.0.1",
39
39
  "@backstage/config": "^1.0.0",
40
40
  "@backstage/errors": "^1.0.0",
41
- "@backstage/plugin-auth-node": "^0.2.0-next.0",
41
+ "@backstage/plugin-auth-node": "^0.2.0",
42
42
  "@backstage/types": "^1.0.0",
43
43
  "@google-cloud/firestore": "^5.0.2",
44
44
  "@types/express": "^4.17.6",
@@ -66,7 +66,7 @@
66
66
  "passport-github2": "^0.1.12",
67
67
  "passport-gitlab2": "^5.0.0",
68
68
  "passport-google-oauth20": "^2.0.0",
69
- "passport-microsoft": "^0.1.0",
69
+ "passport-microsoft": "^1.0.0",
70
70
  "passport-oauth2": "^1.6.1",
71
71
  "passport-okta-oauth": "^0.0.1",
72
72
  "passport-onelogin-oauth": "^0.0.1",
@@ -76,8 +76,8 @@
76
76
  "yn": "^4.0.0"
77
77
  },
78
78
  "devDependencies": {
79
- "@backstage/backend-test-utils": "^0.1.23-next.1",
80
- "@backstage/cli": "^0.17.0-next.3",
79
+ "@backstage/backend-test-utils": "^0.1.23",
80
+ "@backstage/cli": "^0.17.0",
81
81
  "@types/body-parser": "^1.19.0",
82
82
  "@types/cookie-parser": "^1.4.2",
83
83
  "@types/express-session": "^1.17.2",
@@ -97,5 +97,5 @@
97
97
  "config.d.ts"
98
98
  ],
99
99
  "configSchema": "config.d.ts",
100
- "gitHead": "2eca57d93ef1081f4a76a19fc994a8e9e1a19e00"
100
+ "gitHead": "e0e44c433319711c2fb8b175db411a621f7aaec2"
101
101
  }