mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(core) Simplify authentication type (#3578)
* ⚡ Add generic auth type * ⚡ Remove queryAuth * ⚡ Remove bearer * ⚡ Remove headerAuth * ⚡ Remove basicAuth * ⚡ Adjust tests * ⚡ Small improvements * 👕 Fix lint issue
This commit is contained in:
@@ -150,6 +150,16 @@ export interface IRequestOptionsSimplified {
|
||||
qs: IDataObject;
|
||||
}
|
||||
|
||||
export interface IRequestOptionsSimplifiedAuth {
|
||||
auth?: {
|
||||
username: string;
|
||||
password: string;
|
||||
};
|
||||
body?: IDataObject;
|
||||
headers?: IDataObject;
|
||||
qs?: IDataObject;
|
||||
}
|
||||
|
||||
export abstract class ICredentialsHelper {
|
||||
encryptionKey: string;
|
||||
|
||||
@@ -191,40 +201,16 @@ export abstract class ICredentialsHelper {
|
||||
|
||||
export interface IAuthenticateBase {
|
||||
type: string;
|
||||
properties: {
|
||||
[key: string]: string;
|
||||
};
|
||||
properties:
|
||||
| {
|
||||
[key: string]: string;
|
||||
}
|
||||
| IRequestOptionsSimplifiedAuth;
|
||||
}
|
||||
|
||||
export interface IAuthenticateBasicAuth extends IAuthenticateBase {
|
||||
type: 'basicAuth';
|
||||
properties: {
|
||||
userPropertyName?: string;
|
||||
passwordPropertyName?: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface IAuthenticateBearer extends IAuthenticateBase {
|
||||
type: 'bearer';
|
||||
properties: {
|
||||
tokenPropertyName?: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface IAuthenticateHeaderAuth extends IAuthenticateBase {
|
||||
type: 'headerAuth';
|
||||
properties: {
|
||||
name: string;
|
||||
value: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface IAuthenticateQueryAuth extends IAuthenticateBase {
|
||||
type: 'queryAuth';
|
||||
properties: {
|
||||
key: string;
|
||||
value: string;
|
||||
};
|
||||
export interface IAuthenticateGeneric extends IAuthenticateBase {
|
||||
type: 'generic';
|
||||
properties: IRequestOptionsSimplifiedAuth;
|
||||
}
|
||||
|
||||
export type IAuthenticate =
|
||||
@@ -232,10 +218,7 @@ export type IAuthenticate =
|
||||
credentials: ICredentialDataDecryptedObject,
|
||||
requestOptions: IHttpRequestOptions,
|
||||
) => Promise<IHttpRequestOptions>)
|
||||
| IAuthenticateBasicAuth
|
||||
| IAuthenticateBearer
|
||||
| IAuthenticateHeaderAuth
|
||||
| IAuthenticateQueryAuth;
|
||||
| IAuthenticateGeneric;
|
||||
|
||||
export interface IAuthenticateRuleBase {
|
||||
type: string;
|
||||
|
||||
Reference in New Issue
Block a user