Search in sources :

Example 1 with UserStoreConfigListener

use of org.wso2.carbon.identity.user.store.configuration.listener.UserStoreConfigListener in project carbon-identity-framework by wso2.

the class IdentityUserProfileServiceComponent method activate.

@Activate
protected void activate(ComponentContext ctxt) {
    try {
        if (log.isDebugEnabled()) {
            log.debug("User Profile Mgt bundle is activated ");
        }
        ServiceRegistration userStoreConfigEventSR = ctxt.getBundleContext().registerService(UserStoreConfigListener.class.getName(), new UserStoreConfigListenerImpl(), null);
        if (userStoreConfigEventSR != null) {
            if (log.isDebugEnabled()) {
                log.debug("User profile management - UserStoreConfigListener registered.");
            }
        } else {
            log.error("User profile management - UserStoreConfigListener could not be registered.");
        }
        ServiceRegistration profileMgtEventSR = ctxt.getBundleContext().registerService(UserOperationEventListener.class.getName(), new ProfileMgtEventListener(), null);
        // Check whether the IDN tables exist at the beginning.
        ServiceHodler.setIsIDNTableExist(isIDNTablesExist());
        if (log.isDebugEnabled()) {
            log.debug("Is IDN_ASSOCIATED_ID table exist: " + ServiceHodler.isIDNTableExist());
        }
        if (profileMgtEventSR != null) {
            if (log.isDebugEnabled()) {
                log.debug("User profile management - ProfileMgtEventListener registered.");
            }
        } else {
            log.error("User profile management - ProfileMgtEventListener could not be registered.");
        }
        FederatedAssociationManager federatedAssociationManager = new FederatedAssociationManagerImpl();
        ServiceRegistration federatedAssociationManagerSR = ctxt.getBundleContext().registerService(FederatedAssociationManager.class.getName(), federatedAssociationManager, null);
        if (federatedAssociationManagerSR != null) {
            if (log.isDebugEnabled()) {
                log.debug("User profile management - FederatedAssociationManager registered.");
            }
            IdentityUserProfileServiceDataHolder.getInstance().setFederatedAssociationManager(federatedAssociationManager);
        } else {
            log.error("User profile management - FederatedAssociationManager could not be registered.");
        }
    } catch (Throwable e) {
        log.error("Failed to activate ProfileMgt bundle ", e);
    }
}
Also used : FederatedAssociationManager(org.wso2.carbon.identity.user.profile.mgt.association.federation.FederatedAssociationManager) UserOperationEventListener(org.wso2.carbon.user.core.listener.UserOperationEventListener) ProfileMgtEventListener(org.wso2.carbon.identity.user.profile.mgt.listener.ProfileMgtEventListener) FederatedAssociationManagerImpl(org.wso2.carbon.identity.user.profile.mgt.association.federation.FederatedAssociationManagerImpl) UserStoreConfigListener(org.wso2.carbon.identity.user.store.configuration.listener.UserStoreConfigListener) ServiceRegistration(org.osgi.framework.ServiceRegistration) Activate(org.osgi.service.component.annotations.Activate)

Example 2 with UserStoreConfigListener

use of org.wso2.carbon.identity.user.store.configuration.listener.UserStoreConfigListener in project carbon-identity-framework by wso2.

the class SecondaryUserStoreConfigurationUtil method triggerListenersOnUserStorePreAdd.

/**
 * Trigger the listeners before a userstore is added.
 *
 * @param userStoreDTO Userstore configuration to be added.
 * @throws UserStoreException throws when an error occurred when triggering listeners.
 */
public static void triggerListenersOnUserStorePreAdd(UserStoreDTO userStoreDTO) throws UserStoreException {
    int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    List<UserStoreConfigListener> userStoreConfigListeners = UserStoreConfigListenersHolder.getInstance().getUserStoreConfigListeners();
    for (UserStoreConfigListener userStoreConfigListener : userStoreConfigListeners) {
        if (LOG.isDebugEnabled()) {
            LOG.debug(String.format("Triggering userstore pre add listener: %s for tenant: %s", userStoreConfigListener.getClass().getName(), CarbonContext.getThreadLocalCarbonContext().getTenantDomain()));
        }
        userStoreConfigListener.onUserStorePreAdd(tenantId, userStoreDTO);
    }
}
Also used : UserStoreConfigListener(org.wso2.carbon.identity.user.store.configuration.listener.UserStoreConfigListener)

Example 3 with UserStoreConfigListener

use of org.wso2.carbon.identity.user.store.configuration.listener.UserStoreConfigListener in project carbon-identity-framework by wso2.

the class SecondaryUserStoreConfigurationUtil method triggerListenersOnUserStorePostGet.

/**
 * Trigger the listeners after a userstore is retrieved.
 *
 * @param userStoreDTO Retrieved userstore configuration.
 * @throws UserStoreException throws when an error occurred when triggering listeners.
 */
public static void triggerListenersOnUserStorePostGet(UserStoreDTO userStoreDTO) throws UserStoreException {
    int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    List<UserStoreConfigListener> userStoreConfigListeners = UserStoreConfigListenersHolder.getInstance().getUserStoreConfigListeners();
    for (UserStoreConfigListener userStoreConfigListener : userStoreConfigListeners) {
        if (LOG.isDebugEnabled()) {
            LOG.debug(String.format("Triggering userstore post get listener: %s for tenant: %s", userStoreConfigListener.getClass().getName(), CarbonContext.getThreadLocalCarbonContext().getTenantDomain()));
        }
        userStoreConfigListener.onUserStorePostGet(tenantId, userStoreDTO);
    }
}
Also used : UserStoreConfigListener(org.wso2.carbon.identity.user.store.configuration.listener.UserStoreConfigListener)

Example 4 with UserStoreConfigListener

use of org.wso2.carbon.identity.user.store.configuration.listener.UserStoreConfigListener in project carbon-identity-framework by wso2.

the class SecondaryUserStoreConfigurationUtil method triggerListenersOnUserStorePreStateChange.

/**
 * Trigger the listeners before a user store state is changed.
 *
 * @param domainName User store domain name.
 * @param isDisable True if disabled, else false.
 * @throws UserStoreException Thrown when an error occurred while triggering listeners.
 */
public static void triggerListenersOnUserStorePreStateChange(String domainName, boolean isDisable) throws UserStoreException {
    int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    List<UserStoreConfigListener> userStoreConfigListeners = UserStoreConfigListenersHolder.getInstance().getUserStoreConfigListeners();
    for (UserStoreConfigListener userStoreConfigListener : userStoreConfigListeners) {
        if (LOG.isDebugEnabled()) {
            LOG.debug(String.format("Triggering userstore pre state change listener: %s for tenant: %s", userStoreConfigListener.getClass().getName(), CarbonContext.getThreadLocalCarbonContext().getTenantDomain()));
        }
        userStoreConfigListener.onUserStorePreStateChange(isDisable ? UserStoreState.DISABLED : UserStoreState.ENABLED, tenantId, domainName);
    }
}
Also used : UserStoreConfigListener(org.wso2.carbon.identity.user.store.configuration.listener.UserStoreConfigListener)

Example 5 with UserStoreConfigListener

use of org.wso2.carbon.identity.user.store.configuration.listener.UserStoreConfigListener in project carbon-identity-framework by wso2.

the class IdentityClaimManagementServiceComponent method registerClaimConfigListener.

/**
 * Register ClaimConfigListener as a UserStoreConfigListener service.
 *
 * @param bundleCtx BundleContext
 */
private void registerClaimConfigListener(BundleContext bundleCtx) {
    UserStoreConfigListener claimConfigListener = new ClaimConfigListener();
    ServiceRegistration mappedClaimConfigListenerSR = bundleCtx.registerService(UserStoreConfigListener.class.getName(), claimConfigListener, null);
    if (mappedClaimConfigListenerSR != null) {
        if (log.isDebugEnabled()) {
            log.debug("ClaimConfigListener Service registered.");
        }
    } else {
        log.error("Error registering ClaimConfigListener Service.");
    }
}
Also used : UserStoreConfigListener(org.wso2.carbon.identity.user.store.configuration.listener.UserStoreConfigListener) ClaimConfigListener(org.wso2.carbon.identity.claim.metadata.mgt.listener.ClaimConfigListener) ServiceRegistration(org.osgi.framework.ServiceRegistration)

Aggregations

UserStoreConfigListener (org.wso2.carbon.identity.user.store.configuration.listener.UserStoreConfigListener)9 ServiceRegistration (org.osgi.framework.ServiceRegistration)3 Activate (org.osgi.service.component.annotations.Activate)1 ApplicationMgtListener (org.wso2.carbon.identity.application.mgt.listener.ApplicationMgtListener)1 ClaimConfigListener (org.wso2.carbon.identity.claim.metadata.mgt.listener.ClaimConfigListener)1 AbstractEventHandler (org.wso2.carbon.identity.event.handler.AbstractEventHandler)1 TokenBinderInfo (org.wso2.carbon.identity.oauth.common.token.bindings.TokenBinderInfo)1 OAuthServerConfiguration (org.wso2.carbon.identity.oauth.config.OAuthServerConfiguration)1 OAuth2ScopeService (org.wso2.carbon.identity.oauth2.OAuth2ScopeService)1 OAuth2Service (org.wso2.carbon.identity.oauth2.OAuth2Service)1 OAuth2TokenValidationService (org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService)1 BasicAuthClientAuthenticator (org.wso2.carbon.identity.oauth2.client.authentication.BasicAuthClientAuthenticator)1 OAuthClientAuthenticator (org.wso2.carbon.identity.oauth2.client.authentication.OAuthClientAuthenticator)1 OAuthClientAuthnService (org.wso2.carbon.identity.oauth2.client.authentication.OAuthClientAuthnService)1 PublicClientAuthenticator (org.wso2.carbon.identity.oauth2.client.authentication.PublicClientAuthenticator)1 DeviceAuthService (org.wso2.carbon.identity.oauth2.device.api.DeviceAuthService)1 DeviceAuthServiceImpl (org.wso2.carbon.identity.oauth2.device.api.DeviceAuthServiceImpl)1 DefaultKeyIDProviderImpl (org.wso2.carbon.identity.oauth2.keyidprovider.DefaultKeyIDProviderImpl)1 KeyIDProvider (org.wso2.carbon.identity.oauth2.keyidprovider.KeyIDProvider)1 TenantCreationEventListener (org.wso2.carbon.identity.oauth2.listener.TenantCreationEventListener)1