@acarmisc/backstage-plugin-litellm-backend 0.17.3 → 0.17.4
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/dist/index.cjs.js +7 -5
- package/dist/index.cjs.js.map +2 -2
- package/dist/plugin.d.ts +6 -0
- package/dist/plugin.js +13 -6
- package/package.json +1 -1
package/dist/plugin.d.ts
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridge routes exempt from Backstage's default auth policy (they verify the
|
|
3
|
+
* Keycloak JWT themselves). Every route registered in routes/bridge.ts must be
|
|
4
|
+
* listed here, or the framework answers 401 before the bridge verifier runs.
|
|
5
|
+
*/
|
|
6
|
+
export declare const BRIDGE_UNAUTHENTICATED_PATHS: string[];
|
|
1
7
|
export declare const litellmPlugin: import("@backstage/backend-plugin-api").BackendFeature;
|
package/dist/plugin.js
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.litellmPlugin = void 0;
|
|
3
|
+
exports.litellmPlugin = exports.BRIDGE_UNAUTHENTICATED_PATHS = void 0;
|
|
4
4
|
const backend_plugin_api_1 = require("@backstage/backend-plugin-api");
|
|
5
5
|
const router_1 = require("./router");
|
|
6
6
|
const bridge_1 = require("./bridge");
|
|
7
7
|
const backstage_plugin_litellm_common_1 = require("@acarmisc/backstage-plugin-litellm-common");
|
|
8
|
+
/**
|
|
9
|
+
* Bridge routes exempt from Backstage's default auth policy (they verify the
|
|
10
|
+
* Keycloak JWT themselves). Every route registered in routes/bridge.ts must be
|
|
11
|
+
* listed here, or the framework answers 401 before the bridge verifier runs.
|
|
12
|
+
*/
|
|
13
|
+
exports.BRIDGE_UNAUTHENTICATED_PATHS = [
|
|
14
|
+
'/bridge/health',
|
|
15
|
+
'/bridge/keys',
|
|
16
|
+
'/bridge/models',
|
|
17
|
+
'/bridge/user/info',
|
|
18
|
+
];
|
|
8
19
|
exports.litellmPlugin = (0, backend_plugin_api_1.createBackendPlugin)({
|
|
9
20
|
pluginId: 'litellm',
|
|
10
21
|
register(reg) {
|
|
@@ -33,11 +44,7 @@ exports.litellmPlugin = (0, backend_plugin_api_1.createBackendPlugin)({
|
|
|
33
44
|
// policy, otherwise the framework rejects the Keycloak Bearer with
|
|
34
45
|
// "Illegal token" before the bridge verifier ever runs.
|
|
35
46
|
if ((0, bridge_1.readBridgeConfig)(config).enabled) {
|
|
36
|
-
for (const path of
|
|
37
|
-
'/bridge/health',
|
|
38
|
-
'/bridge/keys',
|
|
39
|
-
'/bridge/models',
|
|
40
|
-
]) {
|
|
47
|
+
for (const path of exports.BRIDGE_UNAUTHENTICATED_PATHS) {
|
|
41
48
|
httpRouter.addAuthPolicy({ path, allow: 'unauthenticated' });
|
|
42
49
|
}
|
|
43
50
|
}
|