Make it possible to set credentials to fixed values

This commit is contained in:
Jan Oberhauser
2020-01-25 23:48:38 -08:00
parent 8228b8505f
commit eb285ef711
19 changed files with 316 additions and 117 deletions

View File

@@ -35,6 +35,27 @@ export interface IGetCredentials {
get(type: string, name: string): Promise<ICredentialsEncrypted>;
}
export abstract class ICredentials {
name: string;
type: string;
data: string | undefined;
nodesAccess: ICredentialNodeAccess[];
constructor(name: string, type: string, nodesAccess: ICredentialNodeAccess[], data?: string) {
this.name = name;
this.type = type;
this.nodesAccess = nodesAccess;
this.data = data;
}
abstract getData(encryptionKey: string, nodeType?: string): ICredentialDataDecryptedObject;
abstract getDataKey(key: string, encryptionKey: string, nodeType?: string): CredentialInformation;
abstract getDataToSave(): ICredentialsEncrypted;
abstract hasNodeAccess(nodeType: string): boolean;
abstract setData(data: ICredentialDataDecryptedObject, encryptionKey: string): void;
abstract setDataKey(key: string, data: CredentialInformation, encryptionKey: string): void;
}
// Defines which nodes are allowed to access the credentials and
// when that access got grented from which user
export interface ICredentialNodeAccess {
@@ -57,11 +78,26 @@ export interface ICredentialsEncrypted {
data?: string;
}
export abstract class ICredentialsHelper {
encryptionKey: string;
workflowCredentials: IWorkflowCredentials;
constructor(workflowCredentials: IWorkflowCredentials, encryptionKey: string) {
this.encryptionKey = encryptionKey;
this.workflowCredentials = workflowCredentials;
}
abstract getCredentials(name: string, type: string): ICredentials;
abstract getDecrypted(name: string, type: string): ICredentialDataDecryptedObject;
abstract updateCredentials(name: string, type: string, data: ICredentialDataDecryptedObject): Promise<void>;
}
export interface ICredentialType {
name: string;
displayName: string;
extends?: string[];
properties: INodeProperties[];
__overwrittenProperties?: string[];
}
export interface ICredentialTypes {
@@ -644,6 +680,7 @@ export interface IWorkflowExecuteHooks {
export interface IWorkflowExecuteAdditionalData {
credentials: IWorkflowCredentials;
credentialsHelper: ICredentialsHelper;
encryptionKey: string;
executeWorkflow: (workflowInfo: IExecuteWorkflowInfo, additionalData: IWorkflowExecuteAdditionalData, inputData?: INodeExecutionData[]) => Promise<any>; // tslint:disable-line:no-any
// hooks?: IWorkflowExecuteHooks;
@@ -652,7 +689,6 @@ export interface IWorkflowExecuteAdditionalData {
httpRequest?: express.Request;
restApiUrl: string;
timezone: string;
updateCredentials: (name: string, type: string, data: ICredentialDataDecryptedObject, encryptionKey: string) => Promise<void>;
webhookBaseUrl: string;
webhookTestBaseUrl: string;
currentNodeParameters? : INodeParameters[];