@Override
    public String getPrincipalIdFrom(final JoinPoint auditTarget, final Authentication authentication,
                                     final Object returnValue, final Exception exception) {
        return Optional.ofNullable(authentication)
            .map(authn -> authn.getPrincipal().getId())
            .orElse(null);
    }
This is {@link DefaultAuditPrincipalIdProvider}.

@author Misagh Moayyed
@since 5.3.0
core/cas-server-core-audit-api/src/main/java/org/apereo/cas/audit/spi/principal/DefaultAuditPrincipalIdProvider.java