Search in sources :

Example 1 with IdentityEventListenerConfig

use of org.wso2.carbon.identity.core.model.IdentityEventListenerConfig in project carbon-identity-framework by wso2.

the class ConsentDeletionAppMgtListener method buildConfig.

private boolean buildConfig() {
    IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil.readEventListenerProperty(ApplicationMgtListener.class.getName(), this.getClass().getName());
    if (identityEventListenerConfig == null) {
        return true;
    }
    if (identityEventListenerConfig.getProperties() != null) {
        for (Map.Entry<Object, Object> property : identityEventListenerConfig.getProperties().entrySet()) {
            String key = (String) property.getKey();
            String value = (String) property.getValue();
            if (!properties.containsKey(key)) {
                properties.setProperty(key, value);
            } else {
                log.warn("Property key " + key + " already exists. Cannot add property!!");
            }
        }
    }
    return false;
}
Also used : IdentityEventListenerConfig(org.wso2.carbon.identity.core.model.IdentityEventListenerConfig) AbstractApplicationMgtListener(org.wso2.carbon.identity.application.mgt.listener.AbstractApplicationMgtListener) ApplicationMgtListener(org.wso2.carbon.identity.application.mgt.listener.ApplicationMgtListener) Map(java.util.Map)

Example 2 with IdentityEventListenerConfig

use of org.wso2.carbon.identity.core.model.IdentityEventListenerConfig in project carbon-identity-framework by wso2.

the class UserIdentityManagementUtil method isIdentityMgtListenerEnable.

private static boolean isIdentityMgtListenerEnable() {
    String listenerClassName = IdentityMgtConfig.getInstance().getProperty(IdentityMgtConstants.PropertyConfig.IDENTITY_MGT_LISTENER_CLASS);
    if (StringUtils.isBlank(listenerClassName)) {
        listenerClassName = IdentityMgtEventListener.class.getName();
    }
    IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil.readEventListenerProperty(UserOperationEventListener.class.getName(), listenerClassName);
    if (identityEventListenerConfig == null) {
        return true;
    }
    if (StringUtils.isNotBlank(identityEventListenerConfig.getEnable())) {
        return Boolean.parseBoolean(identityEventListenerConfig.getEnable());
    } else {
        return true;
    }
}
Also used : UserOperationEventListener(org.wso2.carbon.user.core.listener.UserOperationEventListener) IdentityMgtEventListener(org.wso2.carbon.identity.mgt.IdentityMgtEventListener) IdentityEventListenerConfig(org.wso2.carbon.identity.core.model.IdentityEventListenerConfig)

Example 3 with IdentityEventListenerConfig

use of org.wso2.carbon.identity.core.model.IdentityEventListenerConfig in project carbon-identity-framework by wso2.

the class HttpIdentityRequestFactory method init.

public void init(InitConfig initConfig) {
    this.initConfig = initConfig;
    IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil.readEventListenerProperty(HttpIdentityRequestFactory.class.getName(), this.getClass().getName());
    if (identityEventListenerConfig == null) {
        return;
    }
    if (identityEventListenerConfig.getProperties() != null) {
        for (Map.Entry<Object, Object> property : identityEventListenerConfig.getProperties().entrySet()) {
            String key = (String) property.getKey();
            String value = (String) property.getValue();
            if (!properties.containsKey(key)) {
                properties.setProperty(key, value);
            } else {
                log.warn("Property key " + key + " already exists. Cannot add property!!");
            }
        }
    }
}
Also used : IdentityEventListenerConfig(org.wso2.carbon.identity.core.model.IdentityEventListenerConfig) HashMap(java.util.HashMap) Map(java.util.Map)

Example 4 with IdentityEventListenerConfig

use of org.wso2.carbon.identity.core.model.IdentityEventListenerConfig in project carbon-identity-framework by wso2.

the class HttpIdentityResponseFactory method init.

public void init(InitConfig initConfig) {
    this.initConfig = initConfig;
    IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil.readEventListenerProperty(HttpIdentityResponseFactory.class.getName(), this.getClass().getName());
    if (identityEventListenerConfig == null) {
        return;
    }
    if (identityEventListenerConfig.getProperties() != null) {
        for (Map.Entry<Object, Object> property : identityEventListenerConfig.getProperties().entrySet()) {
            String key = (String) property.getKey();
            String value = (String) property.getValue();
            if (!properties.containsKey(key)) {
                properties.setProperty(key, value);
            } else {
                log.warn("Property key " + key + " already exists. Cannot add property!!");
            }
        }
    }
}
Also used : IdentityEventListenerConfig(org.wso2.carbon.identity.core.model.IdentityEventListenerConfig) Map(java.util.Map)

Example 5 with IdentityEventListenerConfig

use of org.wso2.carbon.identity.core.model.IdentityEventListenerConfig in project carbon-identity-framework by wso2.

the class IdentityProcessor method init.

/**
 * Initialize IdentityProcessor
 *
 * @param initConfig IdentityProcessor properties
 */
public void init(InitConfig initConfig) {
    if (initConfig != null) {
        this.initConfig = initConfig;
    }
    IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil.readEventListenerProperty(IdentityProcessor.class.getName(), this.getClass().getName());
    if (identityEventListenerConfig == null) {
        return;
    }
    if (identityEventListenerConfig.getProperties() != null) {
        for (Map.Entry<Object, Object> property : identityEventListenerConfig.getProperties().entrySet()) {
            String key = (String) property.getKey();
            String value = (String) property.getValue();
            if (!properties.containsKey(key)) {
                properties.setProperty(key, value);
            } else {
                log.warn("Property key " + key + " already exists. Cannot add property!!");
            }
        }
    }
}
Also used : IdentityEventListenerConfig(org.wso2.carbon.identity.core.model.IdentityEventListenerConfig) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

IdentityEventListenerConfig (org.wso2.carbon.identity.core.model.IdentityEventListenerConfig)29 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)11 Test (org.testng.annotations.Test)11 IdentityCacheConfig (org.wso2.carbon.identity.core.model.IdentityCacheConfig)8 IdentityBaseTest (org.wso2.carbon.identity.testutil.IdentityBaseTest)8 ClaimCache (org.wso2.carbon.identity.oauth.util.ClaimCache)7 Map (java.util.Map)6 HashMap (java.util.HashMap)5 IdentityEventListenerConfigKey (org.wso2.carbon.identity.core.model.IdentityEventListenerConfigKey)5 IdentityMgtEventListener (org.wso2.carbon.identity.mgt.IdentityMgtEventListener)5 UserOperationEventListener (org.wso2.carbon.user.core.listener.UserOperationEventListener)5 OAuthServerConfiguration (org.wso2.carbon.identity.oauth.config.OAuthServerConfiguration)4 Properties (java.util.Properties)3 IdentityMgtConfig (org.wso2.carbon.identity.mgt.IdentityMgtConfig)3 RecoveryProcessor (org.wso2.carbon.identity.mgt.RecoveryProcessor)3 LinkedHashMap (java.util.LinkedHashMap)2 Matchers.anyString (org.mockito.Matchers.anyString)2 PrivilegedCarbonContext (org.wso2.carbon.context.PrivilegedCarbonContext)2 IdentityException (org.wso2.carbon.identity.base.IdentityException)2 IdentityMgtConfigException (org.wso2.carbon.identity.mgt.IdentityMgtConfigException)2