@backstage/plugin-auth-backend 0.6.1 → 0.6.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 +17 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +9 -24
- package/package.json +9 -9
package/dist/index.d.ts
CHANGED
|
@@ -116,17 +116,16 @@ declare type OAuthRefreshRequest = express.Request<{}> & {
|
|
|
116
116
|
* Any OAuth provider needs to implement this interface which has provider specific
|
|
117
117
|
* handlers for different methods to perform authentication, get access tokens,
|
|
118
118
|
* refresh tokens and perform sign out.
|
|
119
|
+
*
|
|
120
|
+
* @public
|
|
119
121
|
*/
|
|
120
122
|
interface OAuthHandlers {
|
|
121
123
|
/**
|
|
122
|
-
*
|
|
123
|
-
* @param {express.Request} req
|
|
124
|
-
* @param options
|
|
124
|
+
* Initiate a sign in request with an auth provider.
|
|
125
125
|
*/
|
|
126
126
|
start(req: OAuthStartRequest): Promise<RedirectInfo>;
|
|
127
127
|
/**
|
|
128
|
-
*
|
|
129
|
-
* @param {express.Request} req
|
|
128
|
+
* Handle the redirect from the auth provider when the user has signed in.
|
|
130
129
|
*/
|
|
131
130
|
handler(req: express.Request): Promise<{
|
|
132
131
|
response: OAuthResponse;
|
|
@@ -134,8 +133,6 @@ interface OAuthHandlers {
|
|
|
134
133
|
}>;
|
|
135
134
|
/**
|
|
136
135
|
* (Optional) Given a refresh token and scope fetches a new access token from the auth provider.
|
|
137
|
-
* @param {string} refreshToken
|
|
138
|
-
* @param {string} scope
|
|
139
136
|
*/
|
|
140
137
|
refresh?(req: OAuthRefreshRequest): Promise<{
|
|
141
138
|
response: OAuthResponse;
|
|
@@ -256,10 +253,10 @@ declare type RedirectInfo = {
|
|
|
256
253
|
*
|
|
257
254
|
* The routes in the auth backend API are tied to these methods like below
|
|
258
255
|
*
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
256
|
+
* `/auth/[provider]/start -> start`
|
|
257
|
+
* `/auth/[provider]/handler/frame -> frameHandler`
|
|
258
|
+
* `/auth/[provider]/refresh -> refresh`
|
|
259
|
+
* `/auth/[provider]/logout -> logout`
|
|
263
260
|
*/
|
|
264
261
|
interface AuthProviderRouteHandlers {
|
|
265
262
|
/**
|
|
@@ -270,9 +267,6 @@ interface AuthProviderRouteHandlers {
|
|
|
270
267
|
* Response
|
|
271
268
|
* - redirect to the auth provider for the user to sign in or consent.
|
|
272
269
|
* - sets a nonce cookie and also pass the nonce as 'state' query parameter in the redirect request
|
|
273
|
-
*
|
|
274
|
-
* @param {express.Request} req
|
|
275
|
-
* @param {express.Response} res
|
|
276
270
|
*/
|
|
277
271
|
start(req: express.Request, res: express.Response): Promise<void>;
|
|
278
272
|
/**
|
|
@@ -284,9 +278,6 @@ interface AuthProviderRouteHandlers {
|
|
|
284
278
|
* Response
|
|
285
279
|
* - postMessage to the window with a payload that contains accessToken, expiryInSeconds?, idToken? and scope.
|
|
286
280
|
* - sets a refresh token cookie if the auth provider supports refresh tokens
|
|
287
|
-
*
|
|
288
|
-
* @param {express.Request} req
|
|
289
|
-
* @param {express.Response} res
|
|
290
281
|
*/
|
|
291
282
|
frameHandler(req: express.Request, res: express.Response): Promise<void>;
|
|
292
283
|
/**
|
|
@@ -297,9 +288,6 @@ interface AuthProviderRouteHandlers {
|
|
|
297
288
|
* - to contain a refresh token cookie and scope (Optional) query parameter.
|
|
298
289
|
* Response
|
|
299
290
|
* - payload with accessToken, expiryInSeconds?, idToken?, scope and user profile information.
|
|
300
|
-
*
|
|
301
|
-
* @param {express.Request} req
|
|
302
|
-
* @param {express.Response} res
|
|
303
291
|
*/
|
|
304
292
|
refresh?(req: express.Request, res: express.Response): Promise<void>;
|
|
305
293
|
/**
|
|
@@ -307,9 +295,6 @@ interface AuthProviderRouteHandlers {
|
|
|
307
295
|
*
|
|
308
296
|
* Response
|
|
309
297
|
* - removes the refresh token cookie
|
|
310
|
-
*
|
|
311
|
-
* @param {express.Request} req
|
|
312
|
-
* @param {express.Response} res
|
|
313
298
|
*/
|
|
314
299
|
logout?(req: express.Request, res: express.Response): Promise<void>;
|
|
315
300
|
}
|
|
@@ -688,7 +673,7 @@ declare type GithubProviderOptions = {
|
|
|
688
673
|
* Providing your own stateEncoder will allow you to add addition parameters to the state field.
|
|
689
674
|
*
|
|
690
675
|
* It is typed as follows:
|
|
691
|
-
* export type StateEncoder = (input: OAuthState) => Promise<{encodedState: string}
|
|
676
|
+
* `export type StateEncoder = (input: OAuthState) => Promise<{encodedState: string}>;`
|
|
692
677
|
*
|
|
693
678
|
* Note: the stateEncoder must encode a 'nonce' value and an 'env' value. Without this, the OAuth flow will fail
|
|
694
679
|
* (These two values will be set by the req.state by default)
|
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.6.
|
|
4
|
+
"version": "0.6.2",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -30,12 +30,11 @@
|
|
|
30
30
|
"clean": "backstage-cli clean"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@backstage/backend-common": "^0.10.
|
|
34
|
-
"@backstage/catalog-client": "^0.5.
|
|
35
|
-
"@backstage/catalog-model": "^0.9.
|
|
36
|
-
"@backstage/config": "^0.1.
|
|
37
|
-
"@backstage/errors": "^0.
|
|
38
|
-
"@backstage/test-utils": "^0.2.1",
|
|
33
|
+
"@backstage/backend-common": "^0.10.3",
|
|
34
|
+
"@backstage/catalog-client": "^0.5.4",
|
|
35
|
+
"@backstage/catalog-model": "^0.9.9",
|
|
36
|
+
"@backstage/config": "^0.1.12",
|
|
37
|
+
"@backstage/errors": "^0.2.0",
|
|
39
38
|
"@backstage/types": "^0.1.1",
|
|
40
39
|
"@google-cloud/firestore": "^4.15.1",
|
|
41
40
|
"@types/express": "^4.17.6",
|
|
@@ -74,7 +73,8 @@
|
|
|
74
73
|
"yn": "^4.0.0"
|
|
75
74
|
},
|
|
76
75
|
"devDependencies": {
|
|
77
|
-
"@backstage/cli": "^0.
|
|
76
|
+
"@backstage/cli": "^0.11.0",
|
|
77
|
+
"@backstage/test-utils": "^0.2.2",
|
|
78
78
|
"@types/body-parser": "^1.19.0",
|
|
79
79
|
"@types/cookie-parser": "^1.4.2",
|
|
80
80
|
"@types/express-session": "^1.17.2",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"config.d.ts"
|
|
95
95
|
],
|
|
96
96
|
"configSchema": "config.d.ts",
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "da66c61bdd63cdb3f0f0cd2e26dc9e6454d93c7b"
|
|
98
98
|
}
|