The LoginSubscriptionManagerService API allows components to subscribe a callback, which can be called when a user login happen. The subscribe() method is exposed so that the LoginListeners can subscribe to LoginSubscriptionManagerService.
The triggerEvent() method in the LoginSubscriptionManagerService implementation (org.wso2.carbon.core.services.callback.LoginSubscriptionManagerServiceImpl) is called during a successful user login event, which then executes the onLogin() method of subscribed LoginListeners.
Shown below is how the onSuccessAdminLogin() method calls LoginSubscriptionManagerServiceImpl during a successful user login.
The subscribe() method of the LoginSubscriptionManagerService implementation adds login listeners to its list of subscribers.
The triggerEvent() method constructs LoginEvent data with details of the logged in user to pass to onLogin() call of LoginListeners. The triggerEvent() implementation from LoginSubscriptionManagerService is shown below.