001/** 002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 003 * 004 * Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved 005 * 006 * The contents of this file are subject to the terms 007 * of the Common Development and Distribution License 008 * (the License). You may not use this file except in 009 * compliance with the License. 010 * 011 * You can obtain a copy of the License at 012 * https://opensso.dev.java.net/public/CDDLv1.0.html or 013 * opensso/legal/CDDLv1.0.txt 014 * See the License for the specific language governing 015 * permission and limitations under the License. 016 * 017 * When distributing Covered Code, include this CDDL 018 * Header Notice in each file and include the License file 019 * at opensso/legal/CDDLv1.0.txt. 020 * If applicable, add the following below the CDDL Header, 021 * with the fields enclosed by brackets [] replaced by 022 * your own identifying information: 023 * "Portions Copyrighted [year] [name of copyright owner]" 024 * 025 * $Id: ServiceConfigManager.java,v 1.11 2009/07/25 05:11:55 qcheng Exp $ 026 * 027 */ 028 029/* 030 * Portions Copyrighted [2011] [ForgeRock AS] 031 */ 032package com.sun.identity.sm; 033 034import com.iplanet.services.util.AMEncryption; 035import com.iplanet.sso.SSOException; 036import com.iplanet.sso.SSOToken; 037import com.iplanet.sso.SSOTokenManager; 038import com.iplanet.ums.IUMSConstants; 039import com.sun.identity.authentication.util.ISAuthConstants; 040import com.sun.identity.idm.IdConstants; 041import com.sun.identity.shared.xml.XMLUtils; 042import java.io.InputStream; 043import java.util.Collections; 044import java.util.HashSet; 045import java.util.Iterator; 046import java.util.Map; 047import java.util.Set; 048import org.w3c.dom.Document; 049import org.w3c.dom.Node; 050import org.w3c.dom.NodeList; 051 052/** 053 * The class <code>ServiceConfigurationManager</code> provides interfaces to 054 * manage the service's configuration data. It provides access to 055 * <code>ServiceConfig</code> which represents a single "configuration" in the 056 * service. It manages configuration data only for GLOBAL and ORGANIZATION 057 * types. 058 * 059 * @supported.api 060 */ 061public class ServiceConfigManager { 062 // Instance variables 063 private SSOToken token; 064 065 066 private String serviceName; 067 068 private String version; 069 070 // Pointer to ServiceSchemaManangerImpl 071 private ServiceSchemaManagerImpl ssm; 072 073 private ServiceConfigManagerImpl scm; 074 075 /** 076 * Constrctor to obtain an instance <code>ServiceConfigManager 077 * </code> for 078 * a service by providing an authenticated identity of the user. 079 * This constructor assumes the server version to be <code>1.0</code>. 080 * 081 * @param serviceName 082 * name of the service 083 * @param token 084 * single sign on token of authenticated user identity 085 * @throws SMSException 086 * if an error has occurred while performing the operation 087 * @throws SSOException 088 * if the user's single sign on token is invalid or expired 089 */ 090 public ServiceConfigManager(String serviceName, SSOToken token) 091 throws SMSException, SSOException { 092 // Use of the service versions 093 this(token, serviceName, ServiceManager.isCoexistenceMode() ? 094 ServiceManager.serviceDefaultVersion(token, serviceName) : 095 ServiceManager.getVersion(serviceName)); 096 } 097 098 /** 099 * Creates an instance of 100 * <code>ServiceConfigManager</code> for the given service and version. It 101 * requires an user identity, that will used to perform operations with. It 102 * is assumed that the application calling this constructor should 103 * authenticate the user. 104 * 105 * @param token 106 * single sign on token of the user identity on whose behalf the 107 * operations are performed. 108 * @param serviceName 109 * the name of the service 110 * @param version 111 * the version of the service 112 * @throws SMSException 113 * if an error has occurred while performing the operation 114 * @throws SSOException 115 * if the user's single sign on token is invalid or expired 116 * 117 * @supported.api 118 */ 119 public ServiceConfigManager(SSOToken token, String serviceName, 120 String version) throws SMSException, SSOException { 121 if (token == null || serviceName == null || version == null) { 122 throw new IllegalArgumentException(SMSEntry.bundle 123 .getString(IUMSConstants.SMS_INVALID_PARAMETERS)); 124 } 125 SSOTokenManager.getInstance().validateToken(token); 126 127 // Copy instance variables 128 this.token = token; 129 this.serviceName = serviceName; 130 this.version = version; 131 132 // Get the ServiceSchemaManagerImpl 133 validateSCM(); 134 } 135 136 /** 137 * Returns the name of the service. 138 * 139 * @return the name of the service 140 * 141 * @supported.api 142 */ 143 public String getName() { 144 return (serviceName); 145 } 146 147 /** 148 * Returns the service version. 149 * 150 * @return the version of the service 151 * 152 * @supported.api 153 */ 154 public String getVersion() { 155 return (version); 156 } 157 158 /** 159 * Returns the service instance names 160 * 161 * @return the service instance names 162 * @throws SMSException 163 * if an error has occurred while performing the operation 164 * 165 * @supported.api 166 */ 167 public Set getInstanceNames() throws SMSException { 168 try { 169 validateSCM(); 170 return (scm.getInstanceNames(token)); 171 } catch (SSOException s) { 172 SMSEntry.debug.error("ServiceConfigManager: Unable to " 173 + "get Instance Names", s); 174 } 175 return (Collections.EMPTY_SET); 176 } 177 178 /** 179 * Returns the configuration group names 180 * 181 * @return the service configuration group names 182 * @throws SMSException 183 * if an error has occurred while performing the operation 184 * 185 * @supported.api 186 */ 187 public Set getGroupNames() throws SMSException { 188 try { 189 validateSCM(); 190 return (scm.getGroupNames(token)); 191 } catch (SSOException s) { 192 SMSEntry.debug.error("ServiceConfigManager: Unable to " 193 + "get Group Names", s); 194 } 195 return (Collections.EMPTY_SET); 196 } 197 198 /** 199 * Returns the service instance given the instance 200 * name 201 * 202 * @param instanceName 203 * the name of the service instance 204 * @return service instance for the given instance name 205 * @throws SMSException 206 * if an error has occurred while performing the operation 207 * @throws SSOException 208 * 209 * @supported.api 210 * if the user's single sign on token is invalid or expired 211 */ 212 public ServiceInstance getInstance(String instanceName) 213 throws SMSException, SSOException { 214 validateSCM(); 215 return (new ServiceInstance(this, 216 scm.getInstance(token, instanceName))); 217 } 218 219 /** 220 * Removes the instance form the service 221 * 222 * @param instanceName 223 * the service instance name 224 * @throws SMSException 225 * if an error has occurred while performing the operation 226 * @throws SSOException 227 * if the user's single sign on token is invalid or expired 228 * 229 * @supported.api 230 */ 231 public void removeInstance(String instanceName) throws SMSException, 232 SSOException { 233 getInstance(instanceName).delete(); 234 } 235 236 /** 237 * Returns the global configuration for the given 238 * service instance. 239 * 240 * @param instanceName 241 * the service instance name 242 * @return the global configuration for the given service instance 243 * @throws SMSException 244 * if an error has occurred while performing the operation 245 * @throws SSOException 246 * if the user's single sign on token is invalid or expired 247 * 248 * @supported.api 249 */ 250 public ServiceConfig getGlobalConfig(String instanceName) 251 throws SMSException, SSOException { 252 validateSCM(); 253 ServiceConfigImpl sci = scm.getGlobalConfig(token, instanceName); 254 return ((sci == null) ? null : new ServiceConfig(this, sci)); 255 } 256 257 /** 258 * Returns the organization configuration for the 259 * given organization and instance name. 260 * 261 * @param orgName 262 * the name of the organization 263 * @param instanceName 264 * the service configuration instance name 265 * @return the organization configuration for the given organization 266 * @throws SMSException 267 * if an error has occurred while performing the operation 268 * @throws SSOException 269 * if the user's single sign on token is invalid or expired 270 * 271 * @supported.api 272 */ 273 public ServiceConfig getOrganizationConfig(String orgName, 274 String instanceName) throws SMSException, SSOException { 275 // Get ServiceConfigImpl 276 validateSCM(); 277 ServiceConfigImpl sci = scm.getOrganizationConfig(token, orgName, 278 instanceName); 279 return ((sci == null) ? null : new ServiceConfig(this, sci)); 280 } 281 282 /** 283 * Creates global configuration for the default 284 * instance of the service given the configuration attributes. 285 * 286 * @param attrs 287 * map of attribute values. 288 * @throws SMSException 289 * if an error has occurred while performing the operation 290 * @throws SSOException 291 * if the user's single sign on token is invalid or expired 292 * 293 * @supported.api 294 */ 295 public ServiceConfig createGlobalConfig(Map attrs) throws SMSException, 296 SSOException { 297 validateSSM(); 298 ServiceSchemaImpl ss = ssm.getSchema(SchemaType.GLOBAL); 299 if (ss == null) { 300 String[] args = { serviceName }; 301 throw (new SMSException(IUMSConstants.UMS_BUNDLE_NAME, 302 "sms-service-does-not-have-global-schema", args)); 303 } 304 // Check base nodes for global attributes 305 String orgDN = scm.constructServiceConfigDN(SMSUtils.DEFAULT, 306 CreateServiceConfig.GLOBAL_CONFIG_NODE, null); 307 308 // Create the sub config entry 309 try { 310 CreateServiceConfig.createSubConfigEntry(token, orgDN, ss, null, 311 null, attrs, SMSEntry.baseDN); 312 } catch (ServiceAlreadyExistsException slee) { 313 // Ignore the exception 314 } 315 return (getGlobalConfig(null)); 316 } 317 318 /** 319 * Creates organization configuration for the default 320 * instance of the service given configuration attributes. 321 * 322 * @param orgName 323 * name of organization. 324 * @param attrs 325 * map of attribute values. 326 * @throws SMSException 327 * if an error has occurred while performing the operation 328 * @throws SSOException 329 * if the user's single sign on token is invalid or expired 330 * 331 * @supported.api 332 */ 333 public ServiceConfig createOrganizationConfig(String orgName, Map attrs) 334 throws SMSException, SSOException { 335 validateSSM(); 336 ServiceSchemaImpl ss = ssm.getSchema(SchemaType.ORGANIZATION); 337 if (ss == null) { 338 String[] args = { serviceName }; 339 throw (new SMSException(IUMSConstants.UMS_BUNDLE_NAME, 340 "sms-service-does-not-have-org-schema", args)); 341 } 342 // Check base nodes for org 343 String orgdn = DNMapper.orgNameToDN(orgName); 344 CreateServiceConfig.checkBaseNodesForOrg(token, orgdn, serviceName, 345 version); 346 String orgDN = scm.constructServiceConfigDN(SMSUtils.DEFAULT, 347 CreateServiceConfig.ORG_CONFIG_NODE, orgdn); 348 349 // Create the sub config entry 350 try { 351 CachedSMSEntry cEntry = CachedSMSEntry.getInstance(token, orgDN); 352 if (cEntry.isDirty()) { 353 cEntry.refresh(); 354 } 355 if (cEntry.isNewEntry()) { 356 CreateServiceConfig.createSubConfigEntry(token, orgDN, ss, 357 null, null, attrs, orgName); 358 // if in co-existence mode, need to register the service 359 // for AMOrganization 360 if (ServiceManager.isCoexistenceMode()) { 361 String smsDN = DNMapper.orgNameToDN(orgName); 362 OrgConfigViaAMSDK amsdk = new OrgConfigViaAMSDK(token, 363 DNMapper.realmNameToAMSDKName(smsDN), smsDN); 364 amsdk.assignService(serviceName); 365 } 366 } else if (attrs != null && !attrs.isEmpty()) { 367 // Set the attributes for the service config 368 ServiceConfig sc = getOrganizationConfig(orgName, null); 369 sc.setAttributes(attrs); 370 } 371 } catch (ServiceAlreadyExistsException slee) { 372 // Ignore the exception 373 } 374 375 return (getOrganizationConfig(orgName, null)); 376 } 377 378 /** 379 * Adds instances, global and organization 380 * configurations 381 * 382 * @param in 383 * input stream of configuration data. 384 * @throws SMSException 385 * if an error has occurred while performing the operation 386 * @throws SSOException 387 * if the user's single sign on token is invalid or expired 388 * 389 * @supported.api 390 */ 391 public void addConfiguration(InputStream in) throws SMSException, 392 SSOException { 393 ServiceManager sm = new ServiceManager(token); 394 // Get the document and search for service name and version 395 Document doc = SMSSchema.getXMLDocument(in); 396 NodeList nodes = doc.getElementsByTagName(SMSUtils.SERVICE); 397 for (int i = 0; (nodes != null) && (i < nodes.getLength()); i++) { 398 Node serviceNode = nodes.item(i); 399 String sName = XMLUtils.getNodeAttributeValue(serviceNode, 400 SMSUtils.NAME); 401 String sVersion = XMLUtils.getNodeAttributeValue(serviceNode, 402 SMSUtils.VERSION); 403 Node configNode; 404 if (sName.equals(serviceName) 405 && (sVersion.equals(version)) 406 && ((configNode = XMLUtils.getChildNode(serviceNode, 407 SMSUtils.CONFIGURATION)) != null)) { 408 CreateServiceConfig.createService(sm, sName, sVersion, 409 configNode, null); 410 } 411 } 412 } 413 414 /** 415 * Deletes the global configuration data for the given 416 * group name. If group name is <code>null</code>, it used the default 417 * group name. 418 * 419 * @param groupName 420 * name of group. 421 * @throws SMSException 422 * if an error has occurred while performing the operation 423 * @throws SSOException 424 * if the user's single sign on token is invalid or expired 425 * 426 * @supported.api 427 */ 428 public void removeGlobalConfiguration(String groupName) 429 throws SMSException, SSOException { 430 431 if (serviceName.equalsIgnoreCase(IdConstants.REPO_SERVICE) || 432 serviceName.equalsIgnoreCase(ISAuthConstants.AUTH_SERVICE_NAME)) { 433 String[] args = { serviceName }; 434 throw (new SMSException(IUMSConstants.UMS_BUNDLE_NAME, 435 "sms-SERVICE_CORE_CANNOT_DELETE", args)); 436 } 437 if ((groupName == null) || groupName.length() == 0) { 438 groupName = SMSUtils.DEFAULT; 439 } 440 // Construct the sub-config dn 441 validateSCM(); 442 String gdn = scm.constructServiceConfigDN(groupName, 443 CreateServiceConfig.GLOBAL_CONFIG_NODE, null); 444 // Delete the entry 445 CachedSMSEntry cEntry = CachedSMSEntry.getInstance(token, gdn); 446 if (cEntry.isDirty()) { 447 cEntry.refresh(); 448 } 449 SMSEntry entry = cEntry.getClonedSMSEntry(); 450 entry.delete(token); 451 cEntry.refresh(entry); 452 } 453 454 /** 455 * Deletes the organization configuration data for the 456 * given organization. It removes all the groups within the organization. 457 * 458 * @param orgName 459 * name of organization. 460 * @throws SMSException 461 * if an error has occurred while performing the operation 462 * @throws SSOException 463 * if the user's single sign on token is invalid or expired 464 * 465 * @supported.api 466 */ 467 public void deleteOrganizationConfig(String orgName) throws SMSException, 468 SSOException { 469 removeOrganizationConfiguration(orgName, SMSUtils.DEFAULT); 470 } 471 472 /** 473 * Deletes the organization's group configuration 474 * data. 475 * 476 * @param orgName 477 * name of organization. 478 * @param groupName 479 * name of group. 480 * @throws SMSException 481 * if an error has occurred while performing the operation 482 * @throws SSOException 483 * if the user's single sign on token is invalid or expired 484 * 485 * @supported.api 486 */ 487 public void removeOrganizationConfiguration(String orgName, 488 String groupName) throws SMSException, SSOException { 489 removeOrganizationConfiguration(orgName, groupName, true); 490 } 491 492 /** 493 * Deletes the organization's group configuration data. 494 * 495 * @param orgName 496 * name of organization. 497 * @param groupName 498 * name of group. 499 * @param checkLegacyMode 500 * boolean to check if legacy or realm passed by amsdk as false. 501 * @throws SMSException 502 * if an error has occurred while performing the operation 503 * @throws SSOException 504 * if the user's single sign on token is invalid or expired 505 */ 506 public void removeOrganizationConfiguration(String orgName, 507 String groupName, boolean checkLegacyMode) throws SMSException, 508 SSOException { 509 if ((groupName == null) || groupName.length() == 0) { 510 groupName = SMSUtils.DEFAULT; 511 } 512 // Construct the sub-config dn 513 String orgdn = DNMapper.orgNameToDN(orgName); 514 validateSCM(); 515 String odn = scm.constructServiceConfigDN(groupName, 516 CreateServiceConfig.ORG_CONFIG_NODE, orgdn); 517 // Delete the entry from the REALM DIT 518 CachedSMSEntry cEntry = CachedSMSEntry.getInstance(token, odn); 519 if (cEntry.isNewEntry()) { 520 return; 521 } 522 // if in legacy/co-existence mode, need to unregister the service 523 // from AMOrganization 524 if (checkLegacyMode && ServiceManager.isCoexistenceMode() 525 && groupName.equalsIgnoreCase(SMSUtils.DEFAULT)) { 526 OrgConfigViaAMSDK amsdk = new OrgConfigViaAMSDK(token, DNMapper 527 .realmNameToAMSDKName(orgdn), orgdn); 528 amsdk.unassignService(serviceName); 529 } 530 // Now delete the entry. 531 if (!cEntry.isNewEntry()) { 532 SMSEntry entry = cEntry.getClonedSMSEntry(); 533 entry.delete(token); 534 cEntry.refresh(entry); 535 } 536 } 537 538 /** 539 * Returns a set of plugins configured for the given plugin interface and 540 * plugin schema in a organization 541 */ 542 public Set getPluginConfigNames(String pluginSchemaName, 543 String interfaceName, String orgName) throws SMSException, 544 SSOException { 545 StringBuilder sb = new StringBuilder(100); 546 sb.append("ou=").append(pluginSchemaName).append(",ou=").append( 547 interfaceName).append(",").append( 548 CreateServiceConfig.PLUGIN_CONFIG_NODE).append("ou=").append( 549 version).append(",").append("ou=").append(serviceName).append( 550 ",").append(SMSEntry.SERVICES_RDN).append(",").append( 551 DNMapper.orgNameToDN(orgName)); 552 // Need to check if the user permission to read plugin names 553 CachedSMSEntry.getInstance(token, sb.toString()); 554 // Get the CachedSubEntries and return sub-entries 555 CachedSubEntries cse = CachedSubEntries.getInstance(token, sb 556 .toString()); 557 return (cse.getSubEntries(token)); 558 } 559 560 /** 561 * Returns the plugin configuration parameters for the service 562 */ 563 public PluginConfig getPluginConfig(String name, String pluginSchemaName, 564 String interfaceName, String orgName) throws SMSException, 565 SSOException { 566 validateSCM(); 567 PluginConfigImpl pci = scm.getPluginConfig(token, name, 568 pluginSchemaName, interfaceName, orgName); 569 return (new PluginConfig(name, this, pci)); 570 } 571 572 /** 573 * Removes the plugin configuration for the service 574 */ 575 public void removePluginConfig(String name, String pluginSchemaName, 576 String interfaceName, String orgName) throws SMSException, 577 SSOException { 578 PluginConfig pci = getPluginConfig(name, pluginSchemaName, 579 interfaceName, orgName); 580 if (pci != null) { 581 pci.delete(); 582 } 583 } 584 585 /** 586 * Registers for changes to service's configuration. 587 * The object will be called when configuration for this service and version 588 * is changed. 589 * 590 * @param listener 591 * callback object that will be invoked when schema changes. 592 * @return an ID of the registered listener. 593 * 594 * @supported.api 595 */ 596 public String addListener(ServiceListener listener) { 597 try { 598 validateSCM(); 599 return (scm.addListener(token, listener)); 600 } catch (Exception e) { 601 SMSEntry.debug.error("ServiceConfigManager:addListener exception" 602 + " Service Name: " + serviceName, e); 603 } 604 return (null); 605 } 606 607 /** 608 * Removes the listener from the service for the given 609 * listener ID. The ID was issued when the listener was registered. 610 * 611 * @param listenerID 612 * the listener ID issued when the listener was registered 613 * 614 * @supported.api 615 */ 616 public void removeListener(String listenerID) { 617 if (scm != null) { 618 scm.removeListener(listenerID); 619 } 620 } 621 622 private void validateSCM() throws SSOException, SMSException { 623 if ((scm == null) || !scm.isValid()) { 624 scm = ServiceConfigManagerImpl.getInstance( 625 token, serviceName, version); 626 } 627 } 628 629 private void validateSSM() throws SSOException, SMSException { 630 if ((ssm == null) || !ssm.isValid()) { 631 validateSCM(); 632 ssm = scm.getServiceSchemaManagerImpl(token); 633 } 634 } 635 636 // @Override 637 public int hashCode() { 638 int hash = 3; 639 hash = 29 * hash + (this.serviceName != null ? 640 this.serviceName.hashCode() : 0); 641 hash = 29 * hash + (this.version != null ? 642 this.version.hashCode() : 0); 643 return hash; 644 } 645 646 /** 647 * Compares this object with the given object. 648 * 649 * @param o 650 * object for comparison. 651 * @return true if objects are equals. 652 * 653 * @supported.api 654 */ 655 public boolean equals(Object o) { 656 if (o instanceof ServiceConfigManager) { 657 ServiceConfigManager oscm = (ServiceConfigManager) o; 658 if (serviceName.equals(oscm.serviceName) 659 && version.equals(oscm.version)) { 660 return (true); 661 } 662 } 663 return (false); 664 } 665 666 /** 667 * Returns String representation of the service's 668 * configuration data, along with instances and groups. 669 * 670 * @return String representation of the service's configuration data, along 671 * with instances and groups. 672 * 673 * @supported.api 674 */ 675 public String toString() { 676 StringBuilder sb = new StringBuilder(); 677 sb.append("\nService Config Manager: ").append(serviceName).append( 678 "\n\tVersion: ").append(version); 679 680 // Print Instances with global and base DN's org attributes 681 try { 682 Iterator instances = getInstanceNames().iterator(); 683 while (instances.hasNext()) { 684 String instanceName = (String) instances.next(); 685 sb.append(getInstance(instanceName)); 686 ServiceConfig config = null; 687 try { 688 config = getGlobalConfig(instanceName); 689 if (config != null) { 690 sb.append("\nGlobal Configuation:\n").append(config); 691 } 692 } catch (SMSException e) { 693 // Ignore the exception 694 } 695 try { 696 config = getOrganizationConfig(null, instanceName); 697 if (config != null) { 698 sb.append("Org Configuation:\n").append(config); 699 } 700 } catch (SMSException e) { 701 // Ignore the exception 702 } 703 } 704 sb.append("\n"); 705 } catch (SMSException smse) { 706 sb.append(smse.getMessage()); 707 } catch (SSOException ssoe) { 708 sb.append(ssoe.getMessage()); 709 } 710 return (sb.toString()); 711 } 712 713 public String toXML(AMEncryption encryptObj) 714 throws SMSException, SSOException { 715 StringBuilder buff = new StringBuilder(); 716 buff.append("<" + SMSUtils.CONFIGURATION + ">"); 717 718 Set instances = getInstanceNames(); 719 720 for (Iterator i = instances.iterator(); i.hasNext(); ) { 721 String instanceName = (String)i.next(); 722 ServiceInstance instance = getInstance(instanceName); 723 buff.append(instance.toXML()); 724 } 725 726 /* 727 * Before calling the Global configuration we need to add "default" to 728 * the set of instances as getInstances method does not return this. 729 */ 730 instances.add(SMSUtils.DEFAULT); 731 732 for (Iterator i = instances.iterator(); i.hasNext(); ) { 733 String instanceName = (String)i.next(); 734 try { 735 ServiceConfig sc = getGlobalConfig(instanceName); 736 if (sc != null) { 737 buff.append(sc.toXML(SMSUtils.GLOBAL_CONFIG, encryptObj)); 738 } 739 } catch (SMSException e) { 740 //ignored 741 } 742 } 743 744 OrganizationConfigManager orgMgr = new OrganizationConfigManager( 745 token, "/"); 746 Set orgNames = new HashSet(); 747 Set oNames = orgMgr.getSubOrganizationNames("*", true); 748 749 for (Iterator i = oNames.iterator(); i.hasNext(); ) { 750 String name = (String)i.next(); 751 if (!name.startsWith("/")) { 752 name = "/" + name; 753 } 754 orgNames.add(name); 755 } 756 757 orgNames.add("/"); 758 759 /* 760 * we hide the hidden realm that is used for storing the configuration 761 * data. Add it accordingly. 762 */ 763 orgNames.add(com.sun.identity.policy.PolicyManager.DELEGATION_REALM); 764 765 for (Iterator i = orgNames.iterator(); i.hasNext(); ) { 766 String orgName = (String)i.next(); 767 for (Iterator j = instances.iterator(); j.hasNext(); ) { 768 String instanceName = (String)j.next(); 769 try { 770 ServiceConfig sc = getOrganizationConfig( 771 orgName, instanceName); 772 if (sc != null) { 773 buff.append(sc.toXML( 774 SMSUtils.ORG_CONFIG, encryptObj, orgName)); 775 } 776 } catch (SMSException e) { 777 //ignored 778 } 779 } 780 } 781 782 buff.append("</" + SMSUtils.CONFIGURATION + ">"); 783 return buff.toString(); 784 } 785 786 // --------------------------------------------------------- 787 // Protected method 788 // --------------------------------------------------------- 789 SSOToken getSSOToken() { 790 return (token); 791 } 792 793 boolean containsGroup(String groupName) throws SMSException, SSOException { 794 return (scm.containsGroup(token, groupName)); 795 } 796}