Unicon/inspektr

Name: inspektr

Owner: Unicon, Inc.

Description: Lightweight non-Intruisive Auditing and Logging capabilities for Java

Created: 2016-05-09 20:59:32.0

Updated: 2018-03-08 07:38:02.0

Pushed: 2016-05-12 18:19:14.0

Homepage:

Size: 457

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Inspektr Maven Central Build Status

Inspektr is a very small library designed to capture and record the following pieces of runtime information from Spring framework's managed beans i.e. running inside Spring DI container:

Nothing more, nothing less.

The architecture

The architecture of Inspektr Auditing library is very simple. At its core it has 3 main components:

In addition to the main components, Inspektr defines the following pluggable strategy interfaces to resolve the WHO, WHAT, ACTION, CLIENT_IP and SERVER_IP audit data, namely:

Out of the box, Inspektr comes with the following default implementations for all the pluggable components:

/**
 * Simple <code>AuditTrailManager</code> that dumps auditable information to output stream.
 * <p>
 * Useful for testing.
 */
 public final class ConsoleAuditTrailManager extends AbstractStringAuditTrailManager { .. }


/**
 * <code>AuditTrailManager</code> that dumps auditable information to a configured logger.
 * 
 */
 public final class Slf4jLoggingAuditTrailManager extends AbstractStringAuditTrailManager { .. }


 /**
 * Implementation of {@link org.apereo.inspektr.audit.AuditTrailManager} to persist the
 * audit trail to the  AUDIT_TRAIL table in RDBMS of choice
 * <p/>
 * <pre>
 * CREATE TABLE COM_AUDIT_TRAIL
 * (
 *  AUD_USER      VARCHAR2(100) NOT NULL,
 *  AUD_CLIENT_IP VARCHAR(15)   NOT NULL,
 *  AUD_SERVER_IP VARCHAR(15)   NOT NULL,
 *  AUD_RESOURCE  VARCHAR2(100) NOT NULL,
 *  AUD_ACTION    VARCHAR2(100) NOT NULL,
 *  APPLIC_CD     VARCHAR2(5)   NOT NULL,
 *  AUD_DATE      TIMESTAMP     NOT NULL
 * )
 * </pre>
 *
 */
 public final class JdbcAuditTrailManager extends SimpleJdbcDaoSupport implements AuditTrailManager, Cleanable { .. }

In addition to the above AuditTrailManager imlementations, the default resolvers are available in the org.apereo.inspektr.audit.spi.support package

Configuration
  1. First enable AuditTrailManagementAspect via either Spring proxy-based AOP by including the following directive in the application context definition file: <aop:aspectj-autoproxy/> or via AspectJ compile-time weaving by using ajc compiler e.g by using AspectJ compiler Maven plugin if using Maven, etc.

  2. Configure org.apereo.inspektr.common.web.ClientInfoThreadLocalFilter in web.xml (if deploying Servlet-based web application)

  3. Configure AuditTrailManagers, all the resolvers and wire all of this into the AuditTrailManagementAspect in the Spring application context definition file.

  4. Define audit points which would expose auditing data to the Inspektr auditing facility by annotating methods of Spring-managed beans with Audit or Audits annotations:

it(action="SERVICE_TICKET",
   actionResolverName="GRANT_SERVICE_TICKET_RESOLVER",
   resourceResolverName="GRANT_SERVICE_TICKET_RESOURCE_RESOLVER")
ic String grantServiceTicket(..)

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.