private CasEvent prepareCasEvent(final AbstractCasEvent event) {
        val dto = new CasEvent();
        dto.setType(event.getClass().getCanonicalName());
        dto.putTimestamp(event.getTimestamp());
        val dt = DateTimeUtils.zonedDateTimeOf(Instant.ofEpochMilli(event.getTimestamp()));
        dto.setCreationTime(dt.toInstant());
        val clientInfo = event.getClientInfo();
        FunctionUtils.doIfNotNull(clientInfo, __ -> {
            dto.putClientIpAddress(clientInfo.getClientIpAddress());
            dto.putServerIpAddress(clientInfo.getServerIpAddress());
            dto.putAgent(clientInfo.getUserAgent());
            val location = determineGeoLocationFor(clientInfo);
            dto.putGeoLocation(location);
            dto.putDeviceFingerprint(clientInfo.getDeviceFingerprint());
            dto.putTenant(clientInfo.getTenant());
        });
        return dto;
    }
This is {@link CasAuthenticationAuthenticationEventListener} that attempts to consume CAS events
upon various authentication events. Event data is persisted into a repository
via {@link CasEventRepository}.

@author Misagh Moayyed
@since 5.0.0
core/cas-server-core-events-api/src/main/java/org/apereo/cas/support/events/listener/CasAuthenticationAuthenticationEventListener.java