@gaia-ai/addon-auth-basic 0.6.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/LICENSE +21 -0
- package/README.md +5 -0
- package/dist/src/index.d.ts +13 -0
- package/dist/src/index.js +43 -0
- package/dist/src/preset.d.ts +7 -0
- package/dist/src/preset.js +12 -0
- package/package.json +25 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 keytec GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static HTTP Basic auth provider built from an inline base64 `user:pass` token
|
|
3
|
+
* (conductor.config.local.js `auth.basic`, or the GAIA_E2E_BASIC env for tests).
|
|
4
|
+
* Returns the `{ id, authProvider }` plugin shape that dropsh's resolveAuth reads
|
|
5
|
+
* from `config.plugins`. Replaces the per-file basicAuthProvider that used to be
|
|
6
|
+
* hand-written into each dropsh.config.js.
|
|
7
|
+
*/
|
|
8
|
+
export declare function basicAuthProvider(tokenBase64: string): {
|
|
9
|
+
kind: 'auth';
|
|
10
|
+
id: string;
|
|
11
|
+
authProvider: unknown;
|
|
12
|
+
};
|
|
13
|
+
export default basicAuthProvider;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// GAIA-224 (Finding 6, decision 8): the inline HTTP Basic auth provider —
|
|
2
|
+
// formerly `@gaia-ai/core`'s `plugins/auth/basic.ts` — now its own
|
|
3
|
+
// CONNECTION-surface addon. Name it in a `gaia.config.js` `addons: []` as
|
|
4
|
+
// `{ use: '@gaia-ai/addon-auth-basic', with: { basic: '<base64>' } }`; it
|
|
5
|
+
// replaces the deleted `@gaia-ai/core/builtins` `{ basic }` entry.
|
|
6
|
+
/**
|
|
7
|
+
* Static HTTP Basic auth provider built from an inline base64 `user:pass` token
|
|
8
|
+
* (conductor.config.local.js `auth.basic`, or the GAIA_E2E_BASIC env for tests).
|
|
9
|
+
* Returns the `{ id, authProvider }` plugin shape that dropsh's resolveAuth reads
|
|
10
|
+
* from `config.plugins`. Replaces the per-file basicAuthProvider that used to be
|
|
11
|
+
* hand-written into each dropsh.config.js.
|
|
12
|
+
*/
|
|
13
|
+
export function basicAuthProvider(tokenBase64) {
|
|
14
|
+
const authProvider = {
|
|
15
|
+
id: 'basic_auth',
|
|
16
|
+
displayName: 'HTTP Basic (inline)',
|
|
17
|
+
capabilities: { login: false, logout: false, status: true },
|
|
18
|
+
async login() {
|
|
19
|
+
throw new Error('GAIA uses static inline HTTP Basic auth.');
|
|
20
|
+
},
|
|
21
|
+
async logout() { },
|
|
22
|
+
async status() {
|
|
23
|
+
return { loggedIn: true, provider: 'basic_auth' };
|
|
24
|
+
},
|
|
25
|
+
createAdapter() {
|
|
26
|
+
return {
|
|
27
|
+
async apply(req) {
|
|
28
|
+
return {
|
|
29
|
+
...req,
|
|
30
|
+
headers: {
|
|
31
|
+
...(req.headers ?? {}),
|
|
32
|
+
Authorization: `Basic ${tokenBase64}`,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
// GAIA-215: `.kind='auth'` makes the plugin tag total (every GAIA plugin
|
|
40
|
+
// self-identifies); dropsh ignores the extra field and reads `authProvider`.
|
|
41
|
+
return { kind: 'auth', id: 'gaia-basic-auth', authProvider };
|
|
42
|
+
}
|
|
43
|
+
export default basicAuthProvider;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { GaiaPreset } from '@gaia-ai/core';
|
|
2
|
+
/** Options for the auth-basic addon. */
|
|
3
|
+
export interface AuthBasicOptions {
|
|
4
|
+
/** Inline HTTP Basic token (base64 `user:pass`). */
|
|
5
|
+
basic?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const connectionPlugins: GaiaPreset['connectionPlugins'];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { basicAuthProvider } from './index.js';
|
|
2
|
+
export const connectionPlugins = (acc, opts) => {
|
|
3
|
+
const o = (opts ?? {});
|
|
4
|
+
if (typeof o.basic !== 'string' || o.basic.trim() === '')
|
|
5
|
+
return acc;
|
|
6
|
+
// basicAuthProvider returns the dropsh auth-plugin shape ({ id, authProvider })
|
|
7
|
+
// minus `requiredModules` (dropsh tolerates its absence for auth-only plugins).
|
|
8
|
+
return [
|
|
9
|
+
...acc,
|
|
10
|
+
basicAuthProvider(o.basic),
|
|
11
|
+
];
|
|
12
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gaia-ai/addon-auth-basic",
|
|
3
|
+
"version": "0.6.1",
|
|
4
|
+
"description": "GAIA connection addon: inline HTTP Basic auth from a base64 user:pass token.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./dist/src/index.js",
|
|
9
|
+
"./preset": "./dist/src/preset.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist/src"
|
|
13
|
+
],
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://git.key-tec.de/keytec/gaia.git",
|
|
20
|
+
"directory": "gaia-cli/addons/auth-basic"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"@gaia-ai/core": "^0.6.1"
|
|
24
|
+
}
|
|
25
|
+
}
|