Package org.forgerock.audit.events
Class AuthenticationAuditEventBuilder<T extends AuthenticationAuditEventBuilder<T>>
- java.lang.Object
-
- org.forgerock.audit.events.AuditEventBuilder<T>
-
- org.forgerock.audit.events.AuthenticationAuditEventBuilder<T>
-
- Type Parameters:
T
- the type of the builder
public class AuthenticationAuditEventBuilder<T extends AuthenticationAuditEventBuilder<T>> extends AuditEventBuilder<T>
Builder for audit authentication events.This builder should not be used directly but be specialized for each product to allow to define new specific fields, e.g
class OpenProductAuthenticationAuditEventBuilder<T extends OpenProductAuthenticationAuditEventBuilder<T>> extends AuthenticationAuditEventBuilder<T> { protected OpenProductAuthenticationAuditEventBuilder(DnsUtils dnsUtils) { super(dnsUtils); } public static <T> OpenProductAuthenticationAuditEventBuilder<?> productAuthenticationEvent() { return new OpenProductAuthenticationAuditEventBuilder(new DnsUtils()); } public T someField(String v) { jsonValue.put("someField", v); return self(); } ... }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AuthenticationAuditEventBuilder.Status
Defines a fixed set of authentication statuses that can be logged.
-
Field Summary
Fields Modifier and Type Field Description static String
CONTEXT
Defines the context key.static String
ENTRIES
Defines the entries key.static String
PRINCIPAL
Defines the principal key.static String
RESULT
Defines the authentication result key.-
Fields inherited from class org.forgerock.audit.events.AuditEventBuilder
EVENT_NAME, ISO_OFFSET_DATE_TIME_FORMAT, jsonValue, TIMESTAMP, TRACKING_IDS, TRANSACTION_ID, USER_ID
-
-
Constructor Summary
Constructors Constructor Description AuthenticationAuditEventBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AuthenticationAuditEventBuilder<?>
authenticationEvent()
Starts to build an audit authentication event.T
context(Map<String,Object> context)
Sets the context used in the authentication event.T
entries(List<?> entries)
Sets the list of auth modules used in the authentication event and their state.T
principal(List<String> principals)
Sets the principals of the authentication event.T
result(AuthenticationAuditEventBuilder.Status result)
Sets the authentication audit event overall result.-
Methods inherited from class org.forgerock.audit.events.AuditEventBuilder
eventName, requireField, self, setDefaults, timestamp, toEvent, trackingId, trackingIds, transactionId, transactionIdFromContext, userId, validate
-
-
-
-
Field Detail
-
RESULT
public static final String RESULT
Defines the authentication result key.- See Also:
- Constant Field Values
-
PRINCIPAL
public static final String PRINCIPAL
Defines the principal key.- See Also:
- Constant Field Values
-
CONTEXT
public static final String CONTEXT
Defines the context key.- See Also:
- Constant Field Values
-
ENTRIES
public static final String ENTRIES
Defines the entries key.- See Also:
- Constant Field Values
-
-
Method Detail
-
authenticationEvent
public static AuthenticationAuditEventBuilder<?> authenticationEvent()
Starts to build an audit authentication event.Note: it is preferable to use a specialized builder that allow to add fields specific to a product.
- Returns:
- an audit authentication event builder
-
result
public T result(AuthenticationAuditEventBuilder.Status result)
Sets the authentication audit event overall result.- Parameters:
result
- the authentication overall result.- Returns:
- an audit authentication event builder
-
principal
public T principal(List<String> principals)
Sets the principals of the authentication event.- Parameters:
principals
- the list of principals- Returns:
- an audit authentication event builder
-
context
public T context(Map<String,Object> context)
Sets the context used in the authentication event.- Parameters:
context
- the authentication event context- Returns:
- an audit authentication event builder
-
-