mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-21 02:40:14 +01:00
🔐 feat: Implement Allowed Action Domains (#4964)
* chore: RequestExecutor typing * feat: allowed action domains * fix: rename TAgentsEndpoint to TAssistantEndpoint in typedefs * chore: update librechat-data-provider version to 0.7.62
This commit is contained in:
parent
e82af236bc
commit
69bd8e3644
18 changed files with 364 additions and 97 deletions
|
|
@ -201,15 +201,21 @@ class RequestExecutor {
|
|||
oauth_client_secret,
|
||||
} = metadata;
|
||||
|
||||
const isApiKey = api_key && type === AuthTypeEnum.ServiceHttp;
|
||||
const isOAuth =
|
||||
const isApiKey = api_key != null && api_key.length > 0 && type === AuthTypeEnum.ServiceHttp;
|
||||
const isOAuth = !!(
|
||||
oauth_client_id != null &&
|
||||
oauth_client_id &&
|
||||
oauth_client_secret != null &&
|
||||
oauth_client_secret &&
|
||||
type === AuthTypeEnum.OAuth &&
|
||||
authorization_url != null &&
|
||||
authorization_url &&
|
||||
client_url != null &&
|
||||
client_url &&
|
||||
scope != null &&
|
||||
scope &&
|
||||
token_exchange_method;
|
||||
token_exchange_method
|
||||
);
|
||||
|
||||
if (isApiKey && authorization_type === AuthorizationTypeEnum.Basic) {
|
||||
const basicToken = Buffer.from(api_key).toString('base64');
|
||||
|
|
@ -219,11 +225,13 @@ class RequestExecutor {
|
|||
} else if (
|
||||
isApiKey &&
|
||||
authorization_type === AuthorizationTypeEnum.Custom &&
|
||||
custom_auth_header != null &&
|
||||
custom_auth_header
|
||||
) {
|
||||
this.authHeaders[custom_auth_header] = api_key;
|
||||
} else if (isOAuth) {
|
||||
if (!this.authToken) {
|
||||
const authToken = this.authToken ?? '';
|
||||
if (!authToken) {
|
||||
const tokenResponse = await axios.post(
|
||||
client_url,
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue