T
- the type of the builderpublic class AccessAuditEventBuilder<T extends AccessAuditEventBuilder<T>> extends AuditEventBuilder<T>
This builder should not be used directly but be specialized for each product to allow to define new specific fields, e.g
class OpenProductAccessAuditEventBuilder <T extends OpenProductAccessAuditEventBuilder<T>>
extends AccessAuditEventBuilder <T>
{
protected OpenProductAccessAuditEventBuilder(DnsUtils dnsUtils) {
super(dnsUtils);
}
public static <T>
OpenProductAccessAuditEventBuilder <?>
productAccessEvent() {
return new OpenProductAccessAuditEventBuilder(new DnsUtils());
}
public T someField(String v) {
jsonValue.put("someField", v);
return self();
}
...
}
Modifier and Type | Class and Description |
---|---|
static class |
AccessAuditEventBuilder.ResponseStatus
The status of the access request.
|
Modifier and Type | Field and Description |
---|---|
static String |
CLIENT
The client event payload field name.
|
static String |
COOKIES
The cookies event payload field name.
|
static String |
CREST_PROTOCOL
The protocol field CREST value.
|
static String |
DETAIL
The detail event payload field name.
|
static String |
ELAPSED_TIME
The elapsed time event payload field name.
|
static String |
ELAPSED_TIME_UNITS
The elapsed time unit event payload field name.
|
static String |
HEADERS
The headers event payload field name.
|
static String |
HTTP
The http event payload field name.
|
static String |
IP
The IP event payload field name.
|
static String |
METHOD
The method event payload field name.
|
static String |
OPERATION
The operation event payload field name.
|
static String |
PATH
The path event payload field name.
|
static String |
PORT
The port event payload field name.
|
static String |
PROTOCOL
The protocol event payload field name.
|
static String |
QUERY_PARAMETERS
The query parameters event payload field name.
|
static String |
REQUEST
The request event payload field name.
|
static String |
RESPONSE
The response event payload field name.
|
static String |
SECURE
The secure event payload field name.
|
static String |
SERVER
The server event payload field name.
|
static String |
STATUS
The status event payload field name.
|
static String |
STATUS_CODE
The status code event payload field name.
|
EVENT_NAME, jsonValue, TIMESTAMP, TRACKING_IDS, TRANSACTION_ID, USER_ID
Constructor and Description |
---|
AccessAuditEventBuilder() |
Modifier and Type | Method and Description |
---|---|
static AccessAuditEventBuilder<?> |
accessEvent()
Starts to build an audit access event.
|
T |
client(String ip)
Sets the provided client ip for the event.
|
T |
client(String ip,
int port)
Sets the provided client ip and port for the event.
|
T |
clientFromContext(Context context)
Sets client ip, port and host from
ClientContext , if the provided
Context contains a ClientContext . |
T |
forContext(Context context)
Sets common fields from services contexts.
|
T |
forHttpRequest(Context context,
Request request)
Sets common fields from CREST contexts and request.
|
T |
httpFromContext(Context context)
Sets HTTP method, path, queryString and headers from
HttpContext , if the provided
Context contains a HttpContext . |
T |
httpRequest(boolean secure,
String method,
String path,
Map<String,List<String>> queryParameters,
Map<String,List<String>> headers)
Sets the provided HTTP request fields for the event.
|
T |
httpRequest(boolean secure,
String method,
String path,
Map<String,List<String>> queryParameters,
Map<String,List<String>> headers,
Map<String,String> cookies)
Sets the provided HTTP request fields for the event.
|
T |
httpResponse(Map<String,List<String>> headers)
Sets the provided HTTP fields for the event.
|
protected boolean |
isReverseDnsLookupEnabled()
Whether the client.host should be looked up from client.ip.
|
T |
request(String protocol,
String operation)
Sets the provided request details for the event.
|
T |
request(String protocol,
String operation,
JsonValue detail)
Sets the provided request details for the event.
|
T |
requestFromCrestRequest(Request request)
Sets request detail from
Request . |
T |
response(AccessAuditEventBuilder.ResponseStatus status,
String statusCode,
long elapsedTime,
TimeUnit elapsedTimeUnits)
Sets the provided response for the event.
|
T |
responseWithDetail(AccessAuditEventBuilder.ResponseStatus status,
String statusCode,
long elapsedTime,
TimeUnit elapsedTimeUnits,
JsonValue detail)
Sets the provided response for the event, with an additional detail.
|
T |
server(String ip,
int port)
Sets the provided server values for the event.
|
T |
serverFromContext(Context context)
Sets the server fields for the event, if the provided
Context contains a ClientContext .. |
T |
withReverseDnsLookup()
Instructs the builder to lookup client.host from client.ip when populating client details.
|
eventName, requireField, self, setDefaults, timestamp, toEvent, trackingId, trackingIds, transactionId, transactionIdFromContext, userId, validate
public static final String SERVER
public static final String CLIENT
public static final String IP
public static final String PORT
public static final String REQUEST
public static final String PROTOCOL
public static final String OPERATION
public static final String SECURE
public static final String METHOD
public static final String DETAIL
public static final String PATH
public static final String QUERY_PARAMETERS
public static final String HEADERS
public static final String HTTP
public static final String STATUS
public static final String STATUS_CODE
public static final String ELAPSED_TIME
public static final String ELAPSED_TIME_UNITS
public static final String RESPONSE
public static final String COOKIES
public static final String CREST_PROTOCOL
public static AccessAuditEventBuilder<?> accessEvent()
Note: it is preferable to use a specialized builder that allow to add fields specific to a product.
public final T withReverseDnsLookup()
protected boolean isReverseDnsLookupEnabled()
public final T server(String ip, int port)
ip
- the ip of the server.port
- the port of the server.public final T client(String ip, int port)
ip
- the ip of the client.port
- the port of the client.public final T client(String ip)
ip
- the ip of the client.public final T request(String protocol, String operation)
protocol
- the type of request.operation
- the type of operation (e.g. CREATE, READ, UPDATE, DELETE, PATCH, ACTION, or QUERY).public final T request(String protocol, String operation, JsonValue detail)
protocol
- the type of request.operation
- the type of operation (e.g. CREATE, READ, UPDATE, DELETE, PATCH, ACTION, or QUERY).detail
- additional details relating to the request (e.g. the ACTION name or summary of the payload).public final T httpRequest(boolean secure, String method, String path, Map<String,List<String>> queryParameters, Map<String,List<String>> headers)
secure
- Was the request secure ?method
- the HTTP method.path
- the path of HTTP request.queryParameters
- the query parameters of HTTP request.headers
- the list of headers of HTTP request. The headers are optional.public final T httpRequest(boolean secure, String method, String path, Map<String,List<String>> queryParameters, Map<String,List<String>> headers, Map<String,String> cookies)
secure
- Was the request secure ?method
- the HTTP method.path
- the path of HTTP request.queryParameters
- the query parameters of HTTP request.headers
- the list of headers of HTTP request. The headers are optional.cookies
- the list of cookies of HTTP request. The cookies are optional.public final T httpResponse(Map<String,List<String>> headers)
headers
- the list of headers of HTTP response. The headers are optional.public final T response(AccessAuditEventBuilder.ResponseStatus status, String statusCode, long elapsedTime, TimeUnit elapsedTimeUnits)
status
- the status of the operation.statusCode
- the status code of the operation.elapsedTime
- the execution time of the action.elapsedTimeUnits
- the unit of measure for the execution time value.public final T responseWithDetail(AccessAuditEventBuilder.ResponseStatus status, String statusCode, long elapsedTime, TimeUnit elapsedTimeUnits, JsonValue detail)
status
- the status of the operation.statusCode
- the status code of the operation.elapsedTime
- the execution time of the action.elapsedTimeUnits
- the unit of measure for the execution time value.detail
- additional details relating to the response (e.g. failure description or summary of the payload).public final T clientFromContext(Context context)
ClientContext
, if the provided
Context
contains a ClientContext
.context
- The root CHF context.public final T serverFromContext(Context context)
Context
contains a ClientContext
..context
- the CREST contextpublic final T httpFromContext(Context context)
HttpContext
, if the provided
Context
contains a HttpContext
.context
- The CREST context.public final T requestFromCrestRequest(Request request)
Request
.request
- The CREST request.public final T forContext(Context context)
context
- The services context.AuditEventBuilder.transactionIdFromContext(Context)
,
clientFromContext(Context)
,
serverFromContext(Context)
,
httpFromContext(Context)
public final T forHttpRequest(Context context, Request request)
context
- The CREST context.request
- The CREST request.AuditEventBuilder.transactionIdFromContext(Context)
,
clientFromContext(Context)
,
serverFromContext(Context)
,
httpFromContext(Context)
,
requestFromCrestRequest(Request)
Copyright © 2025 Open Identity Platform Community. All rights reserved.