8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The contents of this file are subject to the terms
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * of the Common Development and Distribution License
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * (the License). You may not use this file except in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * compliance with the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * You can obtain a copy of the License at
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * https://opensso.dev.java.net/public/CDDLv1.0.html or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * See the License for the specific language governing
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * permission and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * When distributing Covered Code, include this CDDL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Header Notice in each file and include the License file
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * If applicable, add the following below the CDDL Header,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * with the fields enclosed by brackets [] replaced by
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * your own identifying information:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * "Portions Copyrighted [year] [name of copyright owner]"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * $Id: CreateServiceConfig.java,v 1.14 2009/01/28 05:35:03 ww203982 Exp $
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington * Portions Copyrighted 2011-2015 ForgeRock AS.
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunningtonimport com.iplanet.services.util.AMEncryption;
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunningtonimport com.sun.identity.security.DecodeAction;
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunningtonimport com.sun.identity.shared.xml.XMLUtils;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster static final String GLOBAL_CONFIG_NODE = "ou=GlobalConfig,";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster static final String ORG_CONFIG_NODE = "ou=OrganizationConfig,";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster static final String PLUGIN_CONFIG_NODE = "ou=PluginConfig,";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster static final String INSTANCES_NODE = "ou=Instances,";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // ----------------------------------------------------------
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Protected methods
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // ----------------------------------------------------------
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster createService(sm, sName, version, configNode, false, decryptObj);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Make sure schema exists for the given service & version
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ServiceSchemaManagerImpl ssm = ServiceSchemaManagerImpl.getInstance(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Construct the base DN
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String baseDN = ServiceManager.getServiceNameDN(sName, version);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Check for instance nodes
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Iterator insNodes = XMLUtils.getChildNodes(configNode,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String insName = XMLUtils.getNodeAttributeValue(insNode,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String insGroup = XMLUtils.getNodeAttributeValue(insNode,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String insUri = XMLUtils.getNodeAttributeValue(insNode,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Get Attribute Value Pairs, if any
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Map insAttrs = getAttributeValuePairs(insNode);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster sb.append("ou=").append(insName).append(",").append(INSTANCES_NODE)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster CachedSMSEntry cEntry = CachedSMSEntry.getInstance(token, sb
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // create the entry
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster insEntry.addAttribute(SMSEntry.ATTR_OBJECTCLASS,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster insEntry.addAttribute(SMSEntry.ATTR_OBJECTCLASS,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster insEntry.addAttribute(SMSEntry.ATTR_SERVICE_ID, insGroup);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster insEntry.addAttribute(SMSEntry.ATTR_LABELED_URI, insUri);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SMSUtils.setAttributeValuePairs(insEntry, insAttrs,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // throw instance already exists exception
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster throw (new SMSException(IUMSConstants.UMS_BUNDLE_NAME,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster IUMSConstants.SMS_service_already_exists, args));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Process global configuration
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Iterator globalNodes = XMLUtils.getChildNodes(configNode,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ServiceSchemaImpl ss = ssm.getSchema(SchemaType.GLOBAL);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String globalGroup = XMLUtils.getNodeAttributeValue(globalNode,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster sb.append("ou=").append(globalGroup).append(",").append(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster createSubConfig(token, sb.toString(), globalNode, ss, baseDN,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Process organization configuration
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Iterator orgNodes = XMLUtils.getChildNodes(configNode,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ServiceSchemaImpl ss = ssm.getSchema(SchemaType.ORGANIZATION);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String orgGroup = XMLUtils.getNodeAttributeValue(orgNode,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Construct the org name
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String orgName = XMLUtils.getNodeAttributeValue(orgNode,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Check if config nodes exists
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster checkBaseNodesForOrg(token, orgDN, sName, version, createRealms);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // create sub-config node
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster sb.append("ou=").append(orgGroup).append(",").append(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ORG_CONFIG_NODE).append("ou=").append(version).append(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ",ou=").append(sName).append(",ou=services,").append(orgDN);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster createSubConfig(token, sb.toString(), orgNode, ss, orgDN,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Process OrganizationAttributeValuePairs
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Node orgAttrValuePairNode = XMLUtils.getChildNode(orgNode,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Get the attributes
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Map attrs = getAttributeValuePairs(orgAttrValuePairNode);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Process Plugin configuration
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Iterator pNodes = XMLUtils.getChildNodes(configNode,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String pName = XMLUtils.getNodeAttributeValue(pNode, SMSUtils.NAME);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String schemaName = XMLUtils.getNodeAttributeValue(pNode,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String intName = XMLUtils.getNodeAttributeValue(pNode,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Get the PluginSchema
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster PluginSchemaImpl psi = PluginSchemaImpl.getInstance(token, sName,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Check if config nodes exists
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster checkBaseNodesForOrg(token, orgName, sName, version);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Check and create interfaces node
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster sb.append("ou=").append(intName).append(",").append(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster PLUGIN_CONFIG_NODE).append("ou=").append(version).append(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ",ou=").append(sName).append(",ou=services,").append(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster checkAndCreateServiceNode(token, sb.toString());
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Check and create schema node
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster sb.insert(0, ",").insert(0, schemaName).insert(0, "ou=");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster checkAndCreateServiceNode(token, sb.toString());
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Create plugin config node
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster sb.insert(0, ",").insert(0, pName).insert(0, "ou=");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster createSubConfig(token, sb.toString(), pNode, psi, orgName,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Get service id and priority
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String id = XMLUtils.getNodeAttributeValue(node, SMSUtils.SERVICE_ID);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String priority = XMLUtils.getNodeAttributeValue(node,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Get the attributes
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ((decryptObj != null) && (attrs != null) && !attrs.isEmpty()) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster for (Iterator i = attrs.keySet().iterator(); i.hasNext(); ) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster AttributeSchemaImpl as = ss.getAttributeSchema(attrName);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster AttributeSchema.Syntax syntax = as.getSyntax();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (syntax.equals(AttributeSchema.Syntax.ENCRYPTED_PASSWORD) ||
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster for (Iterator j = values.iterator(); j.hasNext();) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Create the LDAP entry
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster createSubConfigEntry(token, dn, ss, id, priority, attrs, orgdn);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Check for further sub-configuration
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Iterator subConfigs = XMLUtils.getChildNodes(node, SMSUtils.SUB_CONFIG)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String subConfigName = XMLUtils.getNodeAttributeValue(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String subConfigID = XMLUtils.getNodeAttributeValue(subConfigNode,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster createSubConfig(token, ("ou=" + subConfigName + "," + dn),
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster subConfigNode, ss.getSubSchema(subConfigID), orgdn, decryptObj);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster static void createSubConfigEntry(SSOToken token, String dn,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ServiceSchemaImpl ss, String id, String priority, Map attrs,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String orgDN) throws SMSException, SSOException {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Construct the SMSEntry for the node
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster CachedSMSEntry cEntry = CachedSMSEntry.getInstance(token, dn);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "CreateServiceConfig.createSubConfigEntry: Entry already exists: " +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster IUMSConstants.SMS_service_already_exists_no_args, null));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Add LDAP objectclasses
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster entry.addAttribute(SMSEntry.ATTR_OBJECTCLASS, SMSEntry.OC_TOP);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster entry.addAttribute(SMSEntry.ATTR_OBJECTCLASS, SMSEntry.OC_SERVICE_COMP);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Validate the attributes
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ss.validateAttributes(token, attrs, true, orgDN);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SMSUtils.setAttributeValuePairs(entry, attrs, ss
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster entry.addAttribute(SMSEntry.ATTR_SERVICE_ID, id);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster entry.addAttribute(SMSEntry.ATTR_PRIORITY, priority);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Save the entry, and add to cache
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster checkBaseNodesForOrg(token, orgDN, sName, version, false);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Check if org exists
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Organization does not exists, create if needed
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster throw (new SMSException(IUMSConstants.UMS_BUNDLE_NAME,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Check if services node exists
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Check if service node exists
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Check if verion node exists
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster checkAndCreateServiceVersionNode(token, dn, sName);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Check orgUnit node
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (orgDN.equalsIgnoreCase(SMSEntry.getRootSuffix())) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Create all based nodes for root realm
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // create only organization config
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster checkAndCreateOrgUnitNode(token, ORG_CONFIG_NODE + dn);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster static void checkBaseNodes(SSOToken t, String baseDN) throws SMSException,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Check global config node
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster checkAndCreateOrgUnitNode(t, GLOBAL_CONFIG_NODE + baseDN);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster checkAndCreateOrgUnitNode(t, ORG_CONFIG_NODE + baseDN);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster checkAndCreateServiceNode(t, PLUGIN_CONFIG_NODE + baseDN);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster checkAndCreateOrgUnitNode(t, INSTANCES_NODE + baseDN);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster static void checkAndCreateOrgUnitNode(SSOToken token, String dn)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SMSEntry.debug.message("CreateServiceConfig." +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "checkAndCreateOrgUnitNode() creating entry: " + dn);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Add needed object classes
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster e.addAttribute(SMSEntry.ATTR_OBJECTCLASS, SMSEntry.OC_TOP);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster e.addAttribute(SMSEntry.ATTR_OBJECTCLASS, SMSEntry.OC_ORG_UNIT);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster static void checkAndCreateServiceNode(SSOToken token, String dn)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (dn.indexOf(SMSEntry.SERVICES_RDN, ndx+11) >= 0) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Add needed object classes for the 'ou=services' node
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // under the subrealms created.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster e.addAttribute(SMSEntry.ATTR_OBJECTCLASS, SMSEntry.OC_TOP);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Add needed object classes
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster e.addAttribute(SMSEntry.ATTR_OBJECTCLASS, SMSEntry.OC_TOP);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster static void checkAndCreateServiceVersionNode(SSOToken t, String dn,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String serviceName) throws SMSException, SSOException {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (firstSvc.indexOf(SMSEntry.SERVICES_RDN) >= 0) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Add needed object classes for the 'ou=services' node
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // under the subrealms created.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster e.addAttribute(SMSEntry.ATTR_OBJECTCLASS, SMSEntry.OC_TOP);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Add needed object classes and service name.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster e.addAttribute(SMSEntry.ATTR_OBJECTCLASS, SMSEntry.OC_TOP);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster e.addAttribute(SMSEntry.PLACEHOLDER_RDN, serviceName);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster static void updateSubEntriesNode(SSOToken token, String sdn)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Get the name
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington String name = LDAPUtils.rdnValueFromDn(dn);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Get the parent DN
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster CachedSubEntries subEntries = CachedSubEntries.getInstanceIfCached(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Returns a map that contains attribute value pairs
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // %%% This must be moved to XMLUtils
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public static Map getAttributeValuePairs(Node n) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Node attrNode = XMLUtils.getChildNode(attrValuePair,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String attrName = XMLUtils.getNodeAttributeValue(attrNode,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Set values = XMLUtils.getAttributeValuePair(attrValuePair);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Returns a map that contains attribute value pairs
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // If 'unescape' is set to false, xml escaped chars will not
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // be unescaped.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public static Map getAttributeValuePairs(Node n, boolean unescape) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Node attrNode = XMLUtils.getChildNode(attrValuePair,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String attrName = XMLUtils.getNodeAttributeValue(attrNode,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster XMLUtils.getAttributeValuePair(attrValuePair, unescape);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * create the sub-organization.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster static void createOrganization(SSOToken token, String orgDN)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Check if the organization already exists
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Normalize DN, so it can be parsed and compared
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "createOrganization() : Detected invalid characters. "+
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster throw (new SMSException(IUMSConstants.UMS_BUNDLE_NAME,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster CachedSMSEntry cEntry = CachedSMSEntry.getInstance(token, orgDN);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SMSEntry.debug.error("Organization already exists: " + orgDN);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster IUMSConstants.SMS_organization_already_exists_no_args,
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington // Reverse RDN order
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Need to start from baseDN, to create intermediate nodes
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Obtain the baseDN
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington while (index < rdns.size() - 1 && !partdn.equalsIgnoreCase(DNMapper.serviceDN)) {
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington partdn = rdns.get(++index).toString() + "," + partdn;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Check the intermediate nodes
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington partdn = rdns.get(++index).toString() + "," + partdn;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster cEntry = CachedSMSEntry.getInstance(token, partdn);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Create the realm
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster // Add needed object classes
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington e.addAttribute(SMSEntry.ATTR_OBJECTCLASS, SMSEntry.OC_REALM_SERVICE);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster e.addAttribute(SMSEntry.ATTR_OBJECTCLASS, SMSEntry.OC_TOP);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SMSEntry.debug.error("CreateServiceConfig: Unable to "
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "sms-INVALID_SSO_TOKEN"));