use of org.wso2.carbon.identity.mgt.listener.UserSessionTerminationListener in project carbon-identity-framework by wso2.
the class IdentityMgtServiceComponent method activate.
@Activate
protected void activate(ComponentContext context) {
Dictionary<String, String> props = new Hashtable<String, String>();
props.put(CarbonConstants.AXIS2_CONFIG_SERVICE, AxisObserver.class.getName());
context.getBundleContext().registerService(AxisObserver.class.getName(), new IdentityMgtDeploymentInterceptor(), props);
init();
if (log.isDebugEnabled()) {
log.debug("Identity Management Listener is enabled");
}
ServiceRegistration serviceRegistration = context.getBundleContext().registerService(UserOperationEventListener.class.getName(), new IdentityMgtEventListener(), null);
if (serviceRegistration != null) {
if (log.isDebugEnabled()) {
log.debug("Identity Management - UserOperationEventListener registered.");
}
} else {
log.error("Identity Management - UserOperationEventListener could not be registered.");
}
UserOperationsNotificationListener notificationListener = new UserOperationsNotificationListener();
ServiceRegistration userOperationNotificationSR = context.getBundleContext().registerService(UserOperationEventListener.class.getName(), notificationListener, null);
context.getBundleContext().registerService(TenantMgtListener.class.getName(), new TenantManagementListener(), null);
context.getBundleContext().registerService(UserOperationEventListener.class.getName(), new UserSessionTerminationListener(), null);
if (userOperationNotificationSR != null) {
if (log.isDebugEnabled()) {
log.debug("Identity Management - UserOperationNotificationListener registered.");
}
} else {
log.error("Identity Management - UserOperationNotificationListener could not be registered.");
}
ServiceRegistration identityUserIdResolverListener = context.getBundleContext().registerService(UserOperationEventListener.class.getName(), new IdentityUserIdResolverListener(), null);
if (identityUserIdResolverListener != null) {
if (log.isDebugEnabled()) {
log.debug("Identity Management - IdentityUserIdResolverListener registered.");
}
} else {
log.error("Identity Management - IdentityUserIdResolverListener could not be registered.");
}
ServiceRegistration identityUserNameResolverListener = context.getBundleContext().registerService(UserOperationEventListener.class.getName(), new IdentityUserNameResolverListener(), null);
if (identityUserNameResolverListener != null) {
if (log.isDebugEnabled()) {
log.debug("Identity Management - IdentityUserNameResolverListener registered.");
}
} else {
log.error("Identity Management - IdentityUserNameResolverListener could not be registered.");
}
if (log.isDebugEnabled()) {
log.debug("Identity Management bundle is activated");
}
RegistryCleanUpService registryCleanUpService = new RegistryCleanUpService(IdentityMgtConfig.getInstance().getRegistryCleanUpPeriod(), IdentityMgtConfig.getInstance().getRegistryCleanUpPeriod());
registryCleanUpService.activateCleanUp();
// Set user session mapping enabled.
IdentityMgtServiceDataHolder.getInstance().setUserSessionMappingEnabled(FrameworkUtils.isUserSessionMappingEnabled());
}
Aggregations