-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathping-protect-initialize-callback.ts
More file actions
80 lines (71 loc) · 2.8 KB
/
ping-protect-initialize-callback.ts
File metadata and controls
80 lines (71 loc) · 2.8 KB
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
/*
* @forgerock/javascript-sdk
*
* ping-protect-initialize-callback.ts
*
* Copyright (c) 2024 - 2026 Ping Identity Corporation. All rights reserved.
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
import FRCallback from '.';
import type { Callback } from '../../auth/interfaces';
/**
* @class - Represents a callback used to initialize and start device and behavioral data collection.
*/
class PingOneProtectInitializeCallback extends FRCallback {
/**
* @param payload The raw payload returned by OpenAM
*/
constructor(public payload: Callback) {
super(payload);
}
/**
* Get callback's initialization config settings
*/
public getConfig() {
const signalsInitializationOptions = this.getOutputByName<Record<string, unknown> | undefined>(
'signalsInitializationOptions',
undefined,
);
if (
signalsInitializationOptions !== null &&
typeof signalsInitializationOptions === 'object' &&
!Array.isArray(signalsInitializationOptions)
) {
return signalsInitializationOptions;
}
const agentIdentification = this.getOutputByName<boolean | undefined>(
'agentIdentification',
undefined,
);
const agentTimeout = this.getOutputByName<number | undefined>('agentTimeout', undefined);
const agentPort = this.getOutputByName<number | undefined>('agentPort', undefined);
const config = {
// Required parameter
envId: this.getOutputByName<string>('envId', ''),
// Optional parameters
...(agentIdentification !== undefined ? { agentIdentification } : {}),
...(agentTimeout !== undefined ? { agentTimeout } : {}),
...(agentPort !== undefined ? { agentPort } : {}),
behavioralDataCollection: this.getOutputByName<boolean>('behavioralDataCollection', true),
disableTags: this.getOutputByName<boolean>('disableTags', false),
universalDeviceIdentification: this.getOutputByName<boolean>(
'universalDeviceIdentification',
false,
),
// Deprecated parameters
consoleLogEnabled: this.getOutputByName<boolean>('consoleLogEnabled', false),
deviceAttributesToIgnore: this.getOutputByName<string[]>('deviceAttributesToIgnore', []),
customHost: this.getOutputByName<string>('customHost', ''),
lazyMetadata: this.getOutputByName<boolean>('lazyMetadata', false),
deviceKeyRsyncIntervals: this.getOutputByName<number>('deviceKeyRsyncIntervals', 14),
enableTrust: this.getOutputByName<boolean>('enableTrust', false),
disableHub: this.getOutputByName<boolean>('disableHub', false),
};
return config;
}
public setClientError(errorMessage: string): void {
this.setInputValue(errorMessage, /clientError/);
}
}
export default PingOneProtectInitializeCallback;