Search in sources :

Example 1 with AuditPointRuntimeInfo

use of org.apereo.inspektr.audit.AuditPointRuntimeInfo in project cas by apereo.

the class InspektrThrottledSubmissionByIpAddressAndUsernameHandlerInterceptorAdapter method recordThrottle.

@Override
protected void recordThrottle(final HttpServletRequest request) {
    if (this.dataSource != null && this.jdbcTemplate != null) {
        super.recordThrottle(request);
        final String userToUse = constructUsername(request, getUsernameParameter());
        final ClientInfo clientInfo = ClientInfoHolder.getClientInfo();
        final AuditPointRuntimeInfo auditPointRuntimeInfo = new AuditPointRuntimeInfo() {

            private static final long serialVersionUID = 1L;

            @Override
            public String asString() {
                return String.format("%s.recordThrottle()", this.getClass().getName());
            }
        };
        final AuditActionContext context = new AuditActionContext(userToUse, userToUse, INSPEKTR_ACTION, this.applicationCode, DateTimeUtils.dateOf(ZonedDateTime.now(ZoneOffset.UTC)), clientInfo.getClientIpAddress(), clientInfo.getServerIpAddress(), auditPointRuntimeInfo);
        this.auditTrailManager.record(context);
    } else {
        LOGGER.warn("No data source is defined for [{}]. Ignoring audit record-keeping", this.getName());
    }
}
Also used : AuditActionContext(org.apereo.inspektr.audit.AuditActionContext) AuditPointRuntimeInfo(org.apereo.inspektr.audit.AuditPointRuntimeInfo) ClientInfo(org.apereo.inspektr.common.web.ClientInfo)

Aggregations

AuditActionContext (org.apereo.inspektr.audit.AuditActionContext)1 AuditPointRuntimeInfo (org.apereo.inspektr.audit.AuditPointRuntimeInfo)1 ClientInfo (org.apereo.inspektr.common.web.ClientInfo)1