@backstage/plugin-auth-backend 0.17.1-next.0 → 0.17.1
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 +33 -0
- package/README.md +2 -2
- package/dist/index.cjs.js +12 -11
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @backstage/plugin-auth-backend
|
|
2
2
|
|
|
3
|
+
## 0.17.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0d6837ca4e: Fix wrong GitHub callback URL documentation
|
|
8
|
+
- cbe11d1e23: Tweak README
|
|
9
|
+
- 89d705e806: Add support for custom JWT header name in GCP IAP auth.
|
|
10
|
+
- abaed9770e: Improve logging
|
|
11
|
+
- d80833fe0c: Inject optional `CatalogApi` into auth-backend `createRouter` function. This will enable developers to use customized `CatalogApi` when creating the router.
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
- @backstage/backend-common@0.16.0
|
|
14
|
+
- @backstage/catalog-model@1.1.3
|
|
15
|
+
- @backstage/plugin-auth-node@0.2.7
|
|
16
|
+
- @backstage/types@1.0.1
|
|
17
|
+
- @backstage/catalog-client@1.1.2
|
|
18
|
+
- @backstage/config@1.0.4
|
|
19
|
+
- @backstage/errors@1.1.3
|
|
20
|
+
|
|
21
|
+
## 0.17.1-next.1
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- 0d6837ca4e: Fix wrong GitHub callback URL documentation
|
|
26
|
+
- abaed9770e: Improve logging
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
- @backstage/backend-common@0.16.0-next.1
|
|
29
|
+
- @backstage/plugin-auth-node@0.2.7-next.1
|
|
30
|
+
- @backstage/catalog-client@1.1.2-next.0
|
|
31
|
+
- @backstage/catalog-model@1.1.3-next.0
|
|
32
|
+
- @backstage/config@1.0.4-next.0
|
|
33
|
+
- @backstage/errors@1.1.3-next.0
|
|
34
|
+
- @backstage/types@1.0.1-next.0
|
|
35
|
+
|
|
3
36
|
## 0.17.1-next.0
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -34,8 +34,8 @@ Follow this link, [Create new OAuth App](https://github.com/settings/application
|
|
|
34
34
|
1. Set Application Name to `backstage-dev` or something along those lines.
|
|
35
35
|
1. You can set the Homepage URL to whatever you want to.
|
|
36
36
|
1. The Authorization Callback URL should match the redirect URI set in Backstage.
|
|
37
|
-
1. Set this to `http://localhost:7007/api/auth/github` for local development.
|
|
38
|
-
1. Set this to `http://{APP_FQDN}:{APP_BACKEND_PORT}/api/auth/github` for non-local deployments.
|
|
37
|
+
1. Set this to `http://localhost:7007/api/auth/github/handler/frame` for local development.
|
|
38
|
+
1. Set this to `http://{APP_FQDN}:{APP_BACKEND_PORT}/api/auth/github/handler/frame` for non-local deployments.
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
41
|
export AUTH_GITHUB_CLIENT_ID=x
|
package/dist/index.cjs.js
CHANGED
|
@@ -1316,8 +1316,6 @@ const cfAccess = createAuthProviderIntegration({
|
|
|
1316
1316
|
}
|
|
1317
1317
|
});
|
|
1318
1318
|
|
|
1319
|
-
const IAP_JWT_HEADER = "x-goog-iap-jwt-assertion";
|
|
1320
|
-
|
|
1321
1319
|
function createTokenValidator(audience, mockClient) {
|
|
1322
1320
|
const client = mockClient != null ? mockClient : new googleAuthLibrary.OAuth2Client();
|
|
1323
1321
|
return async function tokenValidator(token) {
|
|
@@ -1337,9 +1335,7 @@ function createTokenValidator(audience, mockClient) {
|
|
|
1337
1335
|
}
|
|
1338
1336
|
async function parseRequestToken(jwtToken, tokenValidator) {
|
|
1339
1337
|
if (typeof jwtToken !== "string" || !jwtToken) {
|
|
1340
|
-
throw new errors.AuthenticationError(
|
|
1341
|
-
`Missing Google IAP header: ${IAP_JWT_HEADER}`
|
|
1342
|
-
);
|
|
1338
|
+
throw new errors.AuthenticationError("Missing Google IAP header");
|
|
1343
1339
|
}
|
|
1344
1340
|
let payload;
|
|
1345
1341
|
try {
|
|
@@ -1364,12 +1360,15 @@ const defaultAuthHandler$1 = async ({
|
|
|
1364
1360
|
iapToken
|
|
1365
1361
|
}) => ({ profile: { email: iapToken.email } });
|
|
1366
1362
|
|
|
1363
|
+
const DEFAULT_IAP_JWT_HEADER = "x-goog-iap-jwt-assertion";
|
|
1364
|
+
|
|
1367
1365
|
class GcpIapProvider {
|
|
1368
1366
|
constructor(options) {
|
|
1369
1367
|
this.authHandler = options.authHandler;
|
|
1370
1368
|
this.signInResolver = options.signInResolver;
|
|
1371
1369
|
this.tokenValidator = options.tokenValidator;
|
|
1372
1370
|
this.resolverContext = options.resolverContext;
|
|
1371
|
+
this.jwtHeader = (options == null ? void 0 : options.jwtHeader) || DEFAULT_IAP_JWT_HEADER;
|
|
1373
1372
|
}
|
|
1374
1373
|
async start() {
|
|
1375
1374
|
}
|
|
@@ -1377,7 +1376,7 @@ class GcpIapProvider {
|
|
|
1377
1376
|
}
|
|
1378
1377
|
async refresh(req, res) {
|
|
1379
1378
|
const result = await parseRequestToken(
|
|
1380
|
-
req.header(
|
|
1379
|
+
req.header(this.jwtHeader),
|
|
1381
1380
|
this.tokenValidator
|
|
1382
1381
|
);
|
|
1383
1382
|
const { profile } = await this.authHandler(result, this.resolverContext);
|
|
@@ -1398,6 +1397,7 @@ const gcpIap = createAuthProviderIntegration({
|
|
|
1398
1397
|
return ({ config, resolverContext }) => {
|
|
1399
1398
|
var _a;
|
|
1400
1399
|
const audience = config.getString("audience");
|
|
1400
|
+
const jwtHeader = config.getOptionalString("jwtHeader");
|
|
1401
1401
|
const authHandler = (_a = options.authHandler) != null ? _a : defaultAuthHandler$1;
|
|
1402
1402
|
const signInResolver = options.signIn.resolver;
|
|
1403
1403
|
const tokenValidator = createTokenValidator(audience);
|
|
@@ -1405,7 +1405,8 @@ const gcpIap = createAuthProviderIntegration({
|
|
|
1405
1405
|
authHandler,
|
|
1406
1406
|
signInResolver,
|
|
1407
1407
|
tokenValidator,
|
|
1408
|
-
resolverContext
|
|
1408
|
+
resolverContext,
|
|
1409
|
+
jwtHeader
|
|
1409
1410
|
});
|
|
1410
1411
|
};
|
|
1411
1412
|
}
|
|
@@ -3176,7 +3177,8 @@ async function createRouter(options) {
|
|
|
3176
3177
|
database,
|
|
3177
3178
|
tokenManager,
|
|
3178
3179
|
tokenFactoryAlgorithm,
|
|
3179
|
-
providerFactories
|
|
3180
|
+
providerFactories,
|
|
3181
|
+
catalogApi
|
|
3180
3182
|
} = options;
|
|
3181
3183
|
const router = Router__default["default"]();
|
|
3182
3184
|
const appUrl = config.getString("app.baseUrl");
|
|
@@ -3190,7 +3192,6 @@ async function createRouter(options) {
|
|
|
3190
3192
|
logger: logger.child({ component: "token-factory" }),
|
|
3191
3193
|
algorithm: tokenFactoryAlgorithm
|
|
3192
3194
|
});
|
|
3193
|
-
const catalogApi = new catalogClient.CatalogClient({ discoveryApi: discovery });
|
|
3194
3195
|
const secret = config.getOptionalString("auth.session.secret");
|
|
3195
3196
|
if (secret) {
|
|
3196
3197
|
router.use(cookieParser__default["default"](secret));
|
|
@@ -3221,7 +3222,7 @@ async function createRouter(options) {
|
|
|
3221
3222
|
allProviderFactories
|
|
3222
3223
|
)) {
|
|
3223
3224
|
if (configuredProviders.includes(providerId)) {
|
|
3224
|
-
logger.info(`Configuring provider
|
|
3225
|
+
logger.info(`Configuring auth provider: ${providerId}`);
|
|
3225
3226
|
try {
|
|
3226
3227
|
const provider = providerFactory({
|
|
3227
3228
|
providerId,
|
|
@@ -3234,7 +3235,7 @@ async function createRouter(options) {
|
|
|
3234
3235
|
logger,
|
|
3235
3236
|
resolverContext: CatalogAuthResolverContext.create({
|
|
3236
3237
|
logger,
|
|
3237
|
-
catalogApi,
|
|
3238
|
+
catalogApi: catalogApi != null ? catalogApi : new catalogClient.CatalogClient({ discoveryApi: discovery }),
|
|
3238
3239
|
tokenIssuer,
|
|
3239
3240
|
tokenManager
|
|
3240
3241
|
})
|