Work required to support the JWT plugin

This commit is contained in:
Gregory Schier
2025-01-17 14:36:55 -08:00
parent 153a40cfb1
commit 6ae0bc1ef6
31 changed files with 300 additions and 170 deletions

View File

@@ -42,13 +42,8 @@ var plugin = {
}],
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 }] };
}
}
};

View File

@@ -37,13 +37,8 @@ var plugin = {
}],
async onApply(_ctx, args) {
const { token } = args.config;
return {
url: args.url,
headers: [{
name: "Authorization",
value: `Bearer ${token}`.trim()
}]
};
const value = `Bearer ${token}`.trim();
return { setHeaders: [{ name: "Authorization", value }] };
}
}
};

View File

@@ -3844,10 +3844,8 @@ var plugin = {
const { algorithm, secret: _secret, secretBase64, payload } = args.config;
const secret = secretBase64 ? Buffer.from(`${_secret}`, "base64") : `${_secret}`;
const token = import_jsonwebtoken.default.sign(`${payload}`, secret, { algorithm });
return {
url: args.url,
headers: [{ name: "Authorization", value: `Bearer ${token}` }]
};
const value = `Bearer ${token}`;
return { setHeaders: [{ name: "Authorization", value }] };
}
}
};

View File

@@ -8824,8 +8824,8 @@ var behaviorArg = {
label: "Sending Behavior",
defaultValue: "smart",
options: [
{ label: "When no responses", value: "smart" },
{ label: "Always", value: "always" }
{ name: "When no responses", value: "smart" },
{ name: "Always", value: "always" }
]
};
var requestArg = {