@backstage/plugin-auth-backend 0.13.0-next.1 → 0.13.1-next.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,300 @@
1
1
  # @backstage/plugin-auth-backend
2
2
 
3
+ ## 0.13.1-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - cfc0f19699: Updated dependency `fs-extra` to `10.1.0`.
8
+ - 787ae0d541: Add more common predefined sign-in resolvers to auth providers.
9
+
10
+ Add the existing resolver to more providers (already available at `google`):
11
+
12
+ - `providers.microsoft.resolvers.emailLocalPartMatchingUserEntityName()`
13
+ - `providers.okta.resolvers.emailLocalPartMatchingUserEntityName()`
14
+
15
+ Add a new resolver for simple email-to-email matching:
16
+
17
+ - `providers.google.resolvers.emailMatchingUserEntityProfileEmail()`
18
+ - `providers.microsoft.resolvers.emailMatchingUserEntityProfileEmail()`
19
+ - `providers.okta.resolvers.emailMatchingUserEntityProfileEmail()`
20
+
21
+ - 9ec4e0613e: Update to `jose` 4.6.0
22
+ - Updated dependencies
23
+ - @backstage/backend-common@0.13.3-next.0
24
+ - @backstage/plugin-auth-node@0.2.1-next.0
25
+
26
+ ## 0.13.0
27
+
28
+ ### Minor Changes
29
+
30
+ - 15d3a3c39a: **BREAKING**: All sign-in resolvers must now return a `token` in their sign-in result. Returning an `id` is no longer supported.
31
+ - 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).
32
+
33
+ ### Patch Changes
34
+
35
+ - 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.
36
+ - 794f7542b6: Updated openid-client from 4.1.2 to 5.1.3
37
+ - c5aeaf339d: **DEPRECATION**: The `getEntityClaims` helper has been deprecated, with `getDefaultOwnershipEntityRefs` being added to replace it.
38
+ - de231e5b06: Declare oauth2 `clientSecret` with visibility secret
39
+ - 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.
40
+
41
+ If you have a setup that currently looks for example like this:
42
+
43
+ ```ts
44
+ import {
45
+ createRouter,
46
+ defaultAuthProviderFactories,
47
+ createGoogleProvider,
48
+ googleEmailSignInResolver,
49
+ } from '@backstage/plugin-auth-backend';
50
+ import { Router } from 'express';
51
+ import { PluginEnvironment } from '../types';
52
+
53
+ export default async function createPlugin(
54
+ env: PluginEnvironment,
55
+ ): Promise<Router> {
56
+ return await createRouter({
57
+ ...env,
58
+ providerFactories: {
59
+ ...defaultAuthProviderFactories,
60
+ google: createGoogleProvider({
61
+ signIn: {
62
+ resolver: googleEmailSignInResolver,
63
+ },
64
+ }),
65
+ },
66
+ });
67
+ }
68
+ ```
69
+
70
+ You would migrate it to something like this:
71
+
72
+ ```ts
73
+ import {
74
+ createRouter,
75
+ providers,
76
+ defaultAuthProviderFactories,
77
+ } from '@backstage/plugin-auth-backend';
78
+ import { Router } from 'express';
79
+ import { PluginEnvironment } from '../types';
80
+
81
+ export default async function createPlugin(
82
+ env: PluginEnvironment,
83
+ ): Promise<Router> {
84
+ return await createRouter({
85
+ ...env,
86
+ providerFactories: {
87
+ ...defaultAuthProviderFactories,
88
+ google: providers.google.create({
89
+ signIn: {
90
+ resolver:
91
+ providers.google.resolvers.emailMatchingUserEntityAnnotation(),
92
+ },
93
+ }),
94
+ },
95
+ });
96
+ }
97
+ ```
98
+
99
+ - 2cc1d1b235: Applied the fix from version 0.12.3 of this package, which is part of the v1.0.1 release of Backstage.
100
+ - c5aeaf339d: **DEPRECATION** The `AuthResolverContext` has received a number of changes, which is the context used by auth handlers and sign-in resolvers.
101
+
102
+ 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.
103
+
104
+ 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:
105
+
106
+ ```ts
107
+ async ({ profile }, ctx) => {
108
+ if (!profile.email) {
109
+ throw new Error('Profile contained no email');
110
+ }
111
+
112
+ const entity = await ctx.catalogIdentityClient.findUser({
113
+ annotations: {
114
+ 'acme.org/email': profile.email,
115
+ },
116
+ });
117
+
118
+ const claims = getEntityClaims(entity);
119
+ const token = await ctx.tokenIssuer.issueToken({ claims });
120
+
121
+ return { id: entity.metadata.name, entity, token };
122
+ };
123
+ ```
124
+
125
+ can be migrated to the following:
126
+
127
+ ```ts
128
+ async ({ profile }, ctx) => {
129
+ if (!profile.email) {
130
+ throw new Error('Profile contained no email');
131
+ }
132
+
133
+ return ctx.signInWithCatalogUser({
134
+ annotations: {
135
+ 'acme.org/email': profile.email,
136
+ },
137
+ });
138
+ };
139
+ ```
140
+
141
+ While a direct entity name lookup using a user ID might look like this:
142
+
143
+ ```ts
144
+ async ({ result: { fullProfile } }, ctx) => {
145
+ return ctx.signInWithCatalogUser({
146
+ entityRef: {
147
+ name: fullProfile.userId,
148
+ },
149
+ });
150
+ };
151
+ ```
152
+
153
+ 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.
154
+
155
+ - f4cdf4cac1: Defensively encode URL parameters when fetching ELB keys
156
+ - 6ee04078e1: **DEPRECATION**: The `tokenIssuer` option for `OAuthAdapter` is no longer needed and has been deprecated.
157
+ - a45bce06e3: Handle trailing slashes on GitHub `enterpriseInstanceUrl` settings
158
+ - 45f7a261c7: Bumped passport-microsoft to resolve CVE-2021-41580
159
+ - c5aeaf339d: Added exports of the following types: `AuthProviderConfig`, `StateEncoder`, `TokenParams`, `AwsAlbResult`.
160
+ - Updated dependencies
161
+ - @backstage/catalog-model@1.0.1
162
+ - @backstage/plugin-auth-node@0.2.0
163
+ - @backstage/backend-common@0.13.2
164
+ - @backstage/catalog-client@1.0.1
165
+
166
+ ## 0.13.0-next.2
167
+
168
+ ### Minor Changes
169
+
170
+ - 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).
171
+
172
+ ### Patch Changes
173
+
174
+ - 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.
175
+ - 794f7542b6: Updated openid-client from 4.1.2 to 5.1.3
176
+ - c5aeaf339d: **DEPRECATION**: The `getEntityClaims` helper has been deprecated, with `getDefaultOwnershipEntityRefs` being added to replace it.
177
+ - de231e5b06: Declare oauth2 `clientSecret` with visibility secret
178
+ - 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.
179
+
180
+ If you have a setup that currently looks for example like this:
181
+
182
+ ```ts
183
+ import {
184
+ createRouter,
185
+ defaultAuthProviderFactories,
186
+ createGoogleProvider,
187
+ googleEmailSignInResolver,
188
+ } from '@backstage/plugin-auth-backend';
189
+ import { Router } from 'express';
190
+ import { PluginEnvironment } from '../types';
191
+
192
+ export default async function createPlugin(
193
+ env: PluginEnvironment,
194
+ ): Promise<Router> {
195
+ return await createRouter({
196
+ ...env,
197
+ providerFactories: {
198
+ ...defaultAuthProviderFactories,
199
+ google: createGoogleProvider({
200
+ signIn: {
201
+ resolver: googleEmailSignInResolver,
202
+ },
203
+ }),
204
+ },
205
+ });
206
+ }
207
+ ```
208
+
209
+ You would migrate it to something like this:
210
+
211
+ ```ts
212
+ import {
213
+ createRouter,
214
+ providers,
215
+ defaultAuthProviderFactories,
216
+ } from '@backstage/plugin-auth-backend';
217
+ import { Router } from 'express';
218
+ import { PluginEnvironment } from '../types';
219
+
220
+ export default async function createPlugin(
221
+ env: PluginEnvironment,
222
+ ): Promise<Router> {
223
+ return await createRouter({
224
+ ...env,
225
+ providerFactories: {
226
+ ...defaultAuthProviderFactories,
227
+ google: providers.google.create({
228
+ signIn: {
229
+ resolver:
230
+ providers.google.resolvers.emailMatchingUserEntityAnnotation(),
231
+ },
232
+ }),
233
+ },
234
+ });
235
+ }
236
+ ```
237
+
238
+ - c5aeaf339d: **DEPRECATION** The `AuthResolverContext` has received a number of changes, which is the context used by auth handlers and sign-in resolvers.
239
+
240
+ 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.
241
+
242
+ 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:
243
+
244
+ ```ts
245
+ async ({ profile }, ctx) => {
246
+ if (!profile.email) {
247
+ throw new Error('Profile contained no email');
248
+ }
249
+
250
+ const entity = await ctx.catalogIdentityClient.findUser({
251
+ annotations: {
252
+ 'acme.org/email': profile.email,
253
+ },
254
+ });
255
+
256
+ const claims = getEntityClaims(entity);
257
+ const token = await ctx.tokenIssuer.issueToken({ claims });
258
+
259
+ return { id: entity.metadata.name, entity, token };
260
+ };
261
+ ```
262
+
263
+ can be migrated to the following:
264
+
265
+ ```ts
266
+ async ({ profile }, ctx) => {
267
+ if (!profile.email) {
268
+ throw new Error('Profile contained no email');
269
+ }
270
+
271
+ return ctx.signInWithCatalogUser({
272
+ annotations: {
273
+ 'acme.org/email': profile.email,
274
+ },
275
+ });
276
+ };
277
+ ```
278
+
279
+ While a direct entity name lookup using a user ID might look like this:
280
+
281
+ ```ts
282
+ async ({ result: { fullProfile } }, ctx) => {
283
+ return ctx.signInWithCatalogUser({
284
+ entityRef: {
285
+ name: fullProfile.userId,
286
+ },
287
+ });
288
+ };
289
+ ```
290
+
291
+ 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.
292
+
293
+ - f4cdf4cac1: Defensively encode URL parameters when fetching ELB keys
294
+ - c5aeaf339d: Added exports of the following types: `AuthProviderConfig`, `StateEncoder`, `TokenParams`, `AwsAlbResult`.
295
+ - Updated dependencies
296
+ - @backstage/backend-common@0.13.2-next.2
297
+
3
298
  ## 0.13.0-next.1
4
299
 
5
300
  ### Patch Changes
package/config.d.ts CHANGED
@@ -90,6 +90,9 @@ export interface Config {
90
90
  oauth2?: {
91
91
  [authEnv: string]: {
92
92
  clientId: string;
93
+ /**
94
+ * @visibility secret
95
+ */
93
96
  clientSecret: string;
94
97
  authorizationUrl: string;
95
98
  tokenUrl: string;