-
Notifications
You must be signed in to change notification settings - Fork 0
/
MyServiceClientCredentialsFactory.js
60 lines (53 loc) · 1.73 KB
/
MyServiceClientCredentialsFactory.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
const {
CertificateAppCredentials,
ServiceClientCredentialsFactory
} = require('botframework-connector');
const fs = require('fs');
class MyServiceClientCredentialsFactory extends ServiceClientCredentialsFactory
{
constructor() {
super();
this.certKey = fs.readFileSync('c:/temp/selfsign.key').toString();
this.thumbPrint = '<cert thumbprint>';
}
/**
* Validates an app ID.
*
* @param appId The app ID to validate.
* @returns {Promise<boolean>} The result is true if `appId` is valid for the controller; otherwise, false.
*/
isValidAppId(appId)
{
return true;
}
/**
* Checks whether bot authentication is disabled.
*
* @returns {Promise<boolean>} If bot authentication is disabled, the result is true; otherwise, false.
*/
isAuthenticationDisabled()
{
return false;
}
/**
* A factory method for creating ServiceClientCredentials.
*
* @param appId The appId.
* @param audience The audience.
* @param loginEndpoint The login url.
* @param validateAuthority The validate authority value to use.
* @returns {Promise<ServiceClientCredentials>} A [ServiceClientCredentials](xref:botframework-connector.ServiceClientCredentials).
*/
createCredentials(
appId,
audience,
loginEndpoint,
validateAuthority
)
{
const certificateAppCredentials = new CertificateAppCredentials(appId,
this.thumbPrint,this.certKey);
return certificateAppCredentials;
}
}
module.exports.MyServiceClientCredentialsFactory = MyServiceClientCredentialsFactory;