use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.
the class ServerConfigBase method existsInOrganizationAlias.
/*
* Check if the server entry is listed in the organization
* alias list
*
* @param ssoToken of the admin user
* @param instanceName name of the server instance
* @return <code>true</code> if server instance exists in org alias
*/
protected boolean existsInOrganizationAlias(SSOToken ssoToken, String instanceName) throws SMSException {
OrganizationConfigManager ocm = new OrganizationConfigManager(ssoToken, "/");
Map attrMap = ocm.getAttributes(ServiceManager.REALM_SERVICE);
Set values = (Set) attrMap.get(OrganizationConfigManager.SUNORG_ALIAS);
return values.contains(instanceName);
}
use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.
the class PolicyManager method getOrgAliasMappedResourceNames.
private Set getOrgAliasMappedResourceNames() throws PolicyException {
if (debug.messageEnabled()) {
debug.message("PolicyManager.getOrgAliasMappedResourceNames(): " + " entering:orgName = " + org);
}
Set managedResourceNames = new HashSet(3);
if (ocm == null) {
try {
ocm = new OrganizationConfigManager(token, givenOrgName);
} catch (SMSException sme) {
String[] objs = { org };
throw (new PolicyException(ResBundleUtils.rbName, "unable_to_get_org_config_manager_for_org", objs, sme));
}
}
Set orgAliases = null;
try {
Map orgAttributes = ocm.getAttributes(ID_REPO_SERVICE);
orgAliases = (Set) orgAttributes.get(ORG_ALIAS);
if (debug.messageEnabled()) {
debug.message("PolicyManager.getOrgAliasMappedResourceNames(): " + " orgName = " + org + ":orgAliases=" + orgAliases);
}
} catch (SMSException sme) {
String[] objs = { org };
throw (new PolicyException(ResBundleUtils.rbName, "unable_to_get_org_alias_for_org", objs, sme));
}
if (orgAliases != null) {
Iterator iter = orgAliases.iterator();
while (iter.hasNext()) {
String orgAlias = (String) iter.next();
managedResourceNames.add(ORG_ALIAS_URL_HTTP_PREFIX + orgAlias.trim() + ORG_ALIAS_URL_SUFFIX);
managedResourceNames.add(ORG_ALIAS_URL_HTTPS_PREFIX + orgAlias.trim() + ORG_ALIAS_URL_SUFFIX);
}
}
if (debug.messageEnabled()) {
debug.message("PolicyManager.getOrgAliasMappedResourceNames(): " + " returning: orgName = " + org + ":orgAliases=" + orgAliases + ":managedResourceNames=" + managedResourceNames);
}
return managedResourceNames;
}
use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.
the class ConfigureData method setRealmAttributes.
private void setRealmAttributes() throws SMSException {
OrganizationConfigManager ocm = new OrganizationConfigManager(ssoToken, "/");
Map map = new HashMap();
Set set1 = new HashSet(2);
set1.add("Active");
map.put("sunOrganizationStatus", set1);
Set set2 = new HashSet(2);
Map defaultValues = ServicesDefaultValues.getDefaultValues();
set2.add(DNToName((String) defaultValues.get(SetupConstants.CONFIG_VAR_ROOT_SUFFIX)));
map.put("sunOrganizationAliases", set2);
ocm.setAttributes("sunIdentityRepositoryService", map);
}
use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.
the class ConfigureData method createRealm.
private void createRealm(String realmName) throws SMSException {
String parentRealm = getParentRealm(realmName);
String childRealm = getChildRealm(realmName);
OrganizationConfigManager ocm = new OrganizationConfigManager(ssoToken, parentRealm);
ocm.createSubOrganization(childRealm, null);
}
use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.
the class ConfigurationBase method updateOrganizationAlias.
protected static void updateOrganizationAlias(SSOToken ssoToken, String instanceName, boolean bAdd) throws SMSException {
String hostName = null;
try {
URL url = new URL(instanceName);
hostName = url.getHost();
} catch (MalformedURLException e) {
throw new RuntimeException(e.getMessage());
}
OrganizationConfigManager ocm = new OrganizationConfigManager(ssoToken, "/");
Map allAttrs = ocm.getAttributes(ServiceManager.REALM_SERVICE);
Set values = (Set) allAttrs.get(OrganizationConfigManager.SUNORG_ALIAS);
if (bAdd) {
if (!values.contains(hostName)) {
values.add(hostName);
ocm.setAttributes(ServiceManager.REALM_SERVICE, allAttrs);
}
} else {
if (values.contains(hostName)) {
values.remove(hostName);
ocm.setAttributes(ServiceManager.REALM_SERVICE, allAttrs);
}
}
}
Aggregations