mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat: Add support for preAuthentication and add Metabase credentials (#3399)
* ⚡ Add preAuthentication method to credentials * Improvements * ⚡ Improvements * ⚡ Add feedback * 🔥 Remove comments * ⚡ Add generic type to autheticate method * ⚡ Fix typo * ⚡ Remove console.log and fix indentation * ⚡ Minor improvements * ⚡ Expire credentials in every credential test run Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
@@ -166,6 +166,9 @@ export interface IRequestOptionsSimplifiedAuth {
|
||||
skipSslCertificateValidation?: boolean | string;
|
||||
}
|
||||
|
||||
export interface IHttpRequestHelper {
|
||||
helpers: { httpRequest: IAllExecuteFunctions['helpers']['httpRequest'] };
|
||||
}
|
||||
export abstract class ICredentialsHelper {
|
||||
encryptionKey: string;
|
||||
|
||||
@@ -184,6 +187,14 @@ export abstract class ICredentialsHelper {
|
||||
defaultTimezone: string,
|
||||
): Promise<IHttpRequestOptions>;
|
||||
|
||||
abstract preAuthentication(
|
||||
helpers: IHttpRequestHelper,
|
||||
credentials: ICredentialDataDecryptedObject,
|
||||
typeName: string,
|
||||
node: INode,
|
||||
credentialsExpired: boolean,
|
||||
): Promise<ICredentialDataDecryptedObject | undefined>;
|
||||
|
||||
abstract getCredentials(
|
||||
nodeCredentials: INodeCredentialsDetails,
|
||||
type: string,
|
||||
@@ -269,6 +280,10 @@ export interface ICredentialType {
|
||||
documentationUrl?: string;
|
||||
__overwrittenProperties?: string[];
|
||||
authenticate?: IAuthenticate;
|
||||
preAuthentication?: (
|
||||
this: IHttpRequestHelper,
|
||||
credentials: ICredentialDataDecryptedObject,
|
||||
) => Promise<IDataObject>;
|
||||
test?: ICredentialTestRequest;
|
||||
genericAuth?: boolean;
|
||||
}
|
||||
@@ -894,6 +909,7 @@ export interface INodePropertyTypeOptions {
|
||||
rows?: number; // Supported by: string
|
||||
showAlpha?: boolean; // Supported by: color
|
||||
sortable?: boolean; // Supported when "multipleValues" set to true
|
||||
expirable?: boolean; // Supported by: hidden (only in the credentials)
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
IExecuteResponsePromiseData,
|
||||
IExecuteSingleFunctions,
|
||||
IExecuteWorkflowInfo,
|
||||
IHttpRequestHelper,
|
||||
IHttpRequestOptions,
|
||||
IN8nHttpFullResponse,
|
||||
IN8nHttpResponse,
|
||||
@@ -111,6 +112,16 @@ export class CredentialsHelper extends ICredentialsHelper {
|
||||
return requestParams;
|
||||
}
|
||||
|
||||
async preAuthentication(
|
||||
helpers: IHttpRequestHelper,
|
||||
credentials: ICredentialDataDecryptedObject,
|
||||
typeName: string,
|
||||
node: INode,
|
||||
credentialsExpired: boolean,
|
||||
): Promise<{ updatedCredentials: boolean; data: ICredentialDataDecryptedObject }> {
|
||||
return { updatedCredentials: false, data: {} }
|
||||
};
|
||||
|
||||
getParentTypes(name: string): string[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user