@Around(value = "@annotation(audit)", argNames = "audit")
    public Object handleAuditTrail(final ProceedingJoinPoint joinPoint, final Audit audit) throws Throwable {
        if (!this.enabled) {
            return joinPoint.proceed();
        }

        val auditActionResolver = auditActionResolvers.get(audit.actionResolverName());
        Objects.requireNonNull(auditActionResolver, () -> "AuditActionResolver is undefined for %s".formatted(audit.actionResolverName()));
        val auditResourceResolver = auditResourceResolvers.get(audit.resourceResolverName());
        Objects.requireNonNull(auditResourceResolver, () -> "AuditActionResolver is undefined for %s".formatted(audit.actionResolverName()));
        auditResourceResolver.setAuditFormat(this.auditFormat);

        String currentPrincipal = null;
        var auditResource = new String[]{null};
        String action = null;
        Object retVal = null;
        try {
            retVal = joinPoint.proceed();

            currentPrincipal = getCurrentPrincipal(joinPoint, audit, retVal);

            auditResource = auditResourceResolver.resolveFrom(joinPoint, retVal);
            action = auditActionResolver.resolveFrom(joinPoint, retVal, audit);

            return retVal;
        } catch (final Throwable t) {
            val e = wrapIfNecessary(t);
            currentPrincipal = getCurrentPrincipal(joinPoint, audit, e);
            auditResource = auditResourceResolver.resolveFrom(joinPoint, e);
            action = auditActionResolver.resolveFrom(joinPoint, e, audit);
            throw t;
        } finally {
            executeAuditCode(currentPrincipal, auditResource, joinPoint, retVal, action);
        }
    }
Handle audit trail.

@param joinPoint the join point
@param audit     the audit
@return the object
@throws Throwable the throwable
core/cas-server-core-audit-api/src/main/java/org/apereo/inspektr/audit/AuditTrailManagementAspect.java