Add auth plugins

This commit is contained in:
Gregory Schier
2025-01-16 15:28:25 -08:00
parent e213c76870
commit ebb7b69dd8
6 changed files with 295 additions and 7 deletions

View File

@@ -0,0 +1,28 @@
import { PluginDefinition } from '@yaakapp/api';
export const plugin: PluginDefinition = {
authentication: {
name: 'Basic',
config: [{
type: 'text',
name: 'username',
label: 'Username',
optional: true,
}, {
type: 'text',
name: 'password',
label: 'Password',
optional: true,
}],
async onApply(_ctx: any, args: any): Promise<any> {
const { username, password } = args.config;
return {
url: args.url,
headers: [{
name: 'Authorization',
value: 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64'),
}],
};
},
},
};