Architecture
Internal flow when a user logs in:
LoginListenercatches Symfony'sLoginSuccessEvent- Builds a
LoginParameterDtofrom the request (IP, user agent) and the user (UserIdentity: identifier + class) - Dispatches to
LoginService(sync) orAuthLoginMessage(async via Messenger) LoginServicefetches geolocation data viaFetchUserInformationDoctrineAuthenticationLogHandlerchecks if the context is known for that identity (findExistingLog), and if not, creates and saves the log (createLog+save)- Dispatches
AuthenticationLogEvents::NEW_DEVICEwith the persisted log - Sends a
NewDeviceNotification(user reference, user information, log, confirmation links) viaNotificationInterface
Extension points
| Interface | Responsibility | Page |
|---|---|---|
AuthLogUserInterface | expose the email and display name of the user | User entity |
AuthenticationLogRepositoryInterface | decide whether a context is known, and persist logs | Repository |
AuthenticationLogCreatorInterface | build the log entity | Repository |
ConfirmableAuthenticationLogRepositoryInterface | look a log up by its confirmation token | Login confirmation |
RevocableAuthenticationLogRepositoryInterface | revoke a user's known contexts on disavowal | Disavowal reactions |
SessionInvalidatorInterface | log the user out everywhere on disavowal | Disavowal reactions |
PasswordResetRequesterInterface | trigger the password-reset flow on disavowal | Disavowal reactions |
DisavowalReactionInterface | add a custom reaction to a disavowed login | Disavowal reactions |
NotificationInterface | deliver the alert | Custom notification |
AuthenticationLogHandlerInterface | replace the whole persistence step | advanced |