Extend AuthenticationEvent to be an extension of AuditEvent
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
For #224102 (closed) and #231486 (closed) we needed to be able to query authentication events for usage ping. This isn't currently possible from audit events because those details are embedded within the details column as text. There are some other concerns/problems with audit events that can be alleviated by storing authentication events separately. This was discussed at #224102 (comment 398939484).
As a result, we chose to add a new table authentication_events to specifically log authentications. For the first iteration this was done alongside existing audit events and only used for usage ping.
Now we need additional work so we can stop storing these events twice. This might require multiple iterations and the scope of work may include:
- Extend
AuthenticationEventmodel to respond to the same methods asAuditEvent, where appropriate. This looks a lot like it does for single-table inheritance but for multiple-table inheritance instead. It won't be one-for-one because the schema is different, but all of the required data is available. - Allow authentication events to be queried and displayed alongside other audit events, in the same way we currently show authentication events in the audit log and in user profile authentication log.
- Consider whether we need to migrate existing authentication events from
audit_eventstoauthentication_events. An alternative would be to query both locations (and deduplicate data before displaying) for some fixed amount of time, then purge all authentication-relatedaudit_eventdata.