-
Notifications
You must be signed in to change notification settings - Fork 329
Expand file tree
/
Copy pathEventTrackerV2.java
More file actions
52 lines (45 loc) · 1.77 KB
/
EventTrackerV2.java
File metadata and controls
52 lines (45 loc) · 1.77 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
package datadog.appsec.api.login;
import java.util.Map;
public class EventTrackerV2 {
private static volatile EventTrackerService SERVICE = EventTrackerService.NO_OP;
/**
* Controls the implementation for service. The AppSec subsystem calls this method on startup.
* This can be called explicitly for e.g. testing purposes.
*
* @param service the implementation for the user service.
*/
public static void setEventTrackerService(final EventTrackerService service) {
SERVICE = service;
}
/**
* Tracks a successful user login event.
*
* @param login the non-null login data (e.g., username or email) used for authentication.
* @param userId an optional user ID string; can be null.
* @param metadata optional metadata for the login event; can be null.
*/
public static void trackUserLoginSuccess(
final String login, final String userId, Map<String, String> metadata) {
SERVICE.trackUserLoginSuccess(login, userId, metadata);
}
/**
* Tracks a failed user login event.
*
* @param login the non-null login data (e.g., username or email) used for authentication.
* @param exists indicates whether the provided login identifier corresponds to an existing user.
* @param metadata optional metadata for the login event; can be null.
*/
public static void trackUserLoginFailure(
String login, boolean exists, Map<String, String> metadata) {
SERVICE.trackUserLoginFailure(login, exists, metadata);
}
/**
* Method for tracking custom events.
*
* @param eventName name of the custom event
* @param metadata custom metadata data represented as key/value map
*/
public static void trackCustomEvent(String eventName, Map<String, String> metadata) {
SERVICE.trackCustomEventV2(eventName, metadata);
}
}