Search in sources :

Example 1 with IdentityProcessor

use of org.wso2.carbon.identity.application.authentication.framework.inbound.IdentityProcessor 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)

Example 2 with IdentityProcessor

use of org.wso2.carbon.identity.application.authentication.framework.inbound.IdentityProcessor in project carbon-identity-framework by wso2.

the class FrameworkServiceComponent method addIdentityProcessor.

@Reference(name = "identity.processor", service = IdentityProcessor.class, cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC, unbind = "removeIdentityProcessor")
protected void addIdentityProcessor(IdentityProcessor requestProcessor) {
    FrameworkServiceDataHolder.getInstance().getIdentityProcessors().add(requestProcessor);
    Collections.sort(FrameworkServiceDataHolder.getInstance().getIdentityProcessors(), new HandlerComparator());
    Collections.reverse(FrameworkServiceDataHolder.getInstance().getIdentityProcessors());
    if (log.isDebugEnabled()) {
        log.debug("Added IdentityProcessor : " + requestProcessor.getName());
    }
}
Also used : HandlerComparator(org.wso2.carbon.identity.core.handler.HandlerComparator) Reference(org.osgi.service.component.annotations.Reference)

Aggregations

HashMap (java.util.HashMap)1 Map (java.util.Map)1 Reference (org.osgi.service.component.annotations.Reference)1 HandlerComparator (org.wso2.carbon.identity.core.handler.HandlerComparator)1 IdentityEventListenerConfig (org.wso2.carbon.identity.core.model.IdentityEventListenerConfig)1