-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathexample_key_thumb_auth.js
80 lines (59 loc) · 2.19 KB
/
example_key_thumb_auth.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
var StatefulProcessCommandProxy = require("stateful-process-command-proxy");
var PSCommandService = require('./psCommandService');
var o365Utils = require('./o365Utils');
var statefulProcessCommandProxy = new StatefulProcessCommandProxy({
name: "StatefulProcessCommandProxy",
max: 1,
min: 1,
idleTimeoutMS:120000,
log: function(severity,origin,msg) {
console.log(severity.toUpperCase() + " " +origin+" "+ msg);
},
processCommand: 'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe',
processArgs: ['-Command','-'],
processRetainMaxCmdHistory : 20,
processInvalidateOnRegex : {
'any':[],
'stdout':[],
'stderr':[{'regex':'.*error.*'}]
},
processCwd : null,
processEnvMap : null,
processUid : null,
processGid : null,
initCommands: o365Utils.getO365PSThumbprintInitCommands(
'C:\\pathto\\decryptUtil.ps1',
'C:\\pathto\\encrypted.credentials',
'C:\\pathto\\secret.key',
'certificatethumbprint',
'00000000-00000000-00000000-00000000',
'your.exhange.domain.name',
10000,30000,60000),
validateFunction: function(processProxy) {
var isValid = processProxy.isValid();
if(!isValid) {
console.log("ProcessProxy.isValid() returns FALSE!");
}
return isValid;
},
preDestroyCommands: o365Utils.getO365PSThumbprintDestroyCommands(),
processCmdWhitelistRegex: o365Utils.getO365WhitelistedCommands(),
processCmdBlacklistRegex: o365Utils.getO365BlacklistedCommands(),
autoInvalidationConfig: o365Utils.getO365AutoInvalidationConfig(30000)
});
var myLogFunction = function(severity,origin,message) {
console.log(severity.toUpperCase() + ' ' + origin + ' ' + message);
}
/**
* Fetch a group!
*/
var psCommandService = new PSCommandService(statefulProcessCommandProxy,
o365Utils.o365CommandRegistry,
myLogFunction);
psCommandService.execute('getDistributionGroup',{'Identity':"someGroupName"})
.then(function(groupJson) {
console.log(groupJson);
}).catch(function(error) {
console.log(error);
});
setTimeout(function(){statefulProcessCommandProxy.shutdown()},80000);