JWT plugin

This commit is contained in:
Gregory Schier
2025-01-17 14:38:17 -08:00
parent 064416398b
commit 16af8bf008
6 changed files with 22 additions and 33 deletions

View File

@@ -17,15 +17,10 @@ export const plugin: PluginDefinition = {
optional: true,
password: true,
}],
async onApply(_ctx: any, args: any): Promise<any> {
async onApply(_ctx, args) {
const { username, password } = args.config;
return {
url: args.url,
headers: [{
name: 'Authorization',
value: 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64'),
}],
};
const value = 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64');
return { setHeaders: [{ name: 'Authorization', value }] };
},
},
};