forked from SAP-archive/yaas-node-red-contrib-yaas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcredentials.js
44 lines (33 loc) · 1.03 KB
/
credentials.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
'use strict';
module.exports = function(RED) {
function YaasCredentialsNode(n) {
RED.nodes.createNode(this,n);
var node = this;
node.client_id = n.client_id;
node.application_id = n.application_id;
if (node.credentials) {
node.client_secret = node.credentials.client_secret;
}
var parts = node.application_id.split('.');
node.tenant = parts[0];
node.application = parts[1];
}
function YaasCustomerCredentialsNode(n) {
RED.nodes.createNode(this,n);
var node = this;
node.email = n.email;
if (node.credentials) {
node.password = node.credentials.password;
}
}
RED.nodes.registerType('yaas-credentials',YaasCredentialsNode,{
credentials: {
client_secret: {type: 'password'}
}
});
RED.nodes.registerType('yaas-customer-credentials',YaasCustomerCredentialsNode,{
credentials: {
password: {type: 'password'}
}
});
};