Search in sources :

Example 1 with DynamicTargets

use of com.tremolosecurity.provisioning.targets.DynamicTargets in project OpenUnison by TremoloSecurity.

the class SendMessageThread method generateTargets.

private void generateTargets(ConfigManager cfgMgr) throws ProvisioningException {
    if (cfgMgr.getCfg().getProvisioning() == null) {
        return;
    }
    this.targetIDs = new HashMap<String, Targets>();
    Iterator<TargetType> it = cfgMgr.getCfg().getProvisioning().getTargets().getTarget().iterator();
    while (it.hasNext()) {
        TargetType targetCfg = it.next();
        addTarget(cfgMgr, targetCfg);
    }
    if (cfgMgr.getCfg().getProvisioning().getTargets().getDynamicTargets() != null && cfgMgr.getCfg().getProvisioning().getTargets().getDynamicTargets().isEnabled()) {
        DynamicPortalUrlsType dynamicTargets = cfgMgr.getCfg().getProvisioning().getTargets().getDynamicTargets();
        String className = dynamicTargets.getClassName();
        HashMap<String, Attribute> cfgAttrs = new HashMap<String, Attribute>();
        for (ParamType pt : dynamicTargets.getParams()) {
            Attribute attr = cfgAttrs.get(pt.getName());
            if (attr == null) {
                attr = new Attribute(pt.getName());
                cfgAttrs.put(pt.getName(), attr);
            }
            attr.getValues().add(pt.getValue());
        }
        try {
            DynamicTargets dynTargets = (DynamicTargets) Class.forName(className).newInstance();
            dynTargets.loadDynamicTargets(cfgMgr, this, cfgAttrs);
        } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
            throw new ProvisioningException("Could not initialize dynamic targets", e);
        }
    }
}
Also used : DynamicTargets(com.tremolosecurity.provisioning.targets.DynamicTargets) Attribute(com.tremolosecurity.saml.Attribute) LDAPAttribute(com.novell.ldap.LDAPAttribute) HashMap(java.util.HashMap) DynamicTargets(com.tremolosecurity.provisioning.targets.DynamicTargets) Targets(com.tremolosecurity.provisioning.objects.Targets) ParamType(com.tremolosecurity.config.xml.ParamType) DynamicPortalUrlsType(com.tremolosecurity.config.xml.DynamicPortalUrlsType) TargetType(com.tremolosecurity.config.xml.TargetType)

Aggregations

LDAPAttribute (com.novell.ldap.LDAPAttribute)1 DynamicPortalUrlsType (com.tremolosecurity.config.xml.DynamicPortalUrlsType)1 ParamType (com.tremolosecurity.config.xml.ParamType)1 TargetType (com.tremolosecurity.config.xml.TargetType)1 Targets (com.tremolosecurity.provisioning.objects.Targets)1 DynamicTargets (com.tremolosecurity.provisioning.targets.DynamicTargets)1 Attribute (com.tremolosecurity.saml.Attribute)1 HashMap (java.util.HashMap)1