Class StoreBackedJSentinelAuditService
java.lang.Object
com.svenruppert.jsentinel.audit.StoreBackedJSentinelAuditService
- All Implemented Interfaces:
JSentinelAuditService
@ExperimentalJSentinelApi
public final class StoreBackedJSentinelAuditService
extends Object
implements JSentinelAuditService
JSentinelAuditService that persists events through an
AuditEventStore (Phase 2). Complementary to
CompositeAuditService, which writes to a
RingBufferAuditSink and any extra AuditSinks but
never persists.
The service is bound to one TenantId at construction time —
single-tenant applications use the no-argument constructor and the
resolved tenant defaults to TenantId.DEFAULT. Multi-tenant
applications instantiate one service per tenant or wrap this class
with a tenant-resolving facade.
Failures propagating from the underlying store are swallowed in
publish(AuditEvent) so audit failure cannot break the
security flow that emitted the event. query(AuditQuery)
does propagate them — read-side failures are an explicit caller
concern.
-
Constructor Summary
ConstructorsConstructorDescriptionBuilds a service that operates againstTenantId.DEFAULT.StoreBackedJSentinelAuditService(AuditEventStore store, TenantId tenant) Builds a service that operates against the supplied tenant. -
Method Summary
Modifier and TypeMethodDescriptionvoidpublish(AuditEvent event) Records the given event.query(AuditQuery query) Returns retained events matchingquery, oldest first.tenant()Returns the tenant this service is bound to.
-
Constructor Details
-
StoreBackedJSentinelAuditService
Builds a service that operates againstTenantId.DEFAULT.- Parameters:
store- backing store; must not benull
-
StoreBackedJSentinelAuditService
Builds a service that operates against the supplied tenant.- Parameters:
store- backing store; must not benulltenant- tenant scope for every published / queried event;nullbecomesTenantId.DEFAULT
-
-
Method Details
-
publish
Description copied from interface:JSentinelAuditServiceRecords the given event. Never throws.- Specified by:
publishin interfaceJSentinelAuditService- Parameters:
event- non-nulltyped audit event
-
query
Description copied from interface:JSentinelAuditServiceReturns retained events matchingquery, oldest first. Implementations that do not retain events return an empty list.- Specified by:
queryin interfaceJSentinelAuditService- Parameters:
query- filter, nevernull- Returns:
- retained matching events, never
null
-
tenant
Returns the tenant this service is bound to. Test seam / debug accessor.- Returns:
- tenant scope
-