use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.
the class OpenSSOIndexStore method getParentRealms.
private Set<String> getParentRealms(String realm) throws SMSException {
Set<String> results = new HashSet<String>();
SSOToken adminToken = SubjectUtils.getSSOToken(superAdminSubject);
OrganizationConfigManager ocm = new OrganizationConfigManager(adminToken, realm);
while (true) {
ocm = ocm.getParentOrgConfigManager();
String name = DNMapper.orgNameToRealmName(ocm.getOrganizationName());
results.add(name);
if (name.equals("/")) {
break;
}
}
return results;
}
use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.
the class OpenSSOIndexStore method getPeerRealms.
private Set<String> getPeerRealms(String realm) throws SMSException {
SSOToken adminToken = SubjectUtils.getSSOToken(superAdminSubject);
OrganizationConfigManager ocm = new OrganizationConfigManager(adminToken, realm);
OrganizationConfigManager parentOrg = ocm.getParentOrgConfigManager();
String base = DNMapper.orgNameToRealmName(parentOrg.getOrganizationName());
if (!base.endsWith("/")) {
base += "/";
}
Set<String> results = new HashSet<String>();
Set<String> subrealms = parentOrg.getSubOrganizationNames();
for (String s : subrealms) {
results.add(base + s);
}
results.remove(getRealm());
return results;
}
use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.
the class SubOrgReferral method getValidValues.
/**Gets the valid values for this referral
* matching a pattern
* @param token SSOToken
* @param pattern a pattern to match against the value
* @return <code>ValidValues</code> object
* @exception SSOException if <code>SSOToken></code> is not valid
* @exception PolicyException if unable to get the list of valid
* names.
*/
public ValidValues getValidValues(SSOToken token, String pattern) throws SSOException, PolicyException {
Set values = new HashSet();
int status = ValidValues.SUCCESS;
try {
Set orgSet = (Set) _configurationMap.get(PolicyManager.ORGANIZATION_NAME);
if ((orgSet == null) || (orgSet.isEmpty())) {
OrgReferral.DEBUG.error("SubOrgReferral.getValidValues(): " + " Organization name not set");
throw new PolicyException(ResBundleUtils.rbName, "org_name_not_set", null, null);
}
Iterator iter = orgSet.iterator();
String orgName = (String) iter.next();
OrganizationConfigManager orgConfigManager = new OrganizationConfigManager(token, orgName);
Set subOrgNames = orgConfigManager.getSubOrganizationNames(pattern, //get only first level children
false);
if ((subOrgNames != null) && !subOrgNames.isEmpty()) {
Iterator subOrgsIter = subOrgNames.iterator();
while (subOrgsIter.hasNext()) {
String subOrgName = (String) subOrgsIter.next();
OrganizationConfigManager subOrgManager = orgConfigManager.getSubOrgConfigManager(subOrgName);
if (subOrgManager != null) {
values.add(subOrgManager.getOrganizationName());
}
}
}
if (debug.messageEnabled()) {
debug.message("SubOrgReferral.getValidValues():subOrgNames=" + subOrgNames);
}
} catch (SMSException smse) {
OrgReferral.DEBUG.error("Can not get valid values for referral " + getReferralTypeName() + smse);
String[] objs = { getReferralTypeName() };
throw new PolicyException(ResBundleUtils.rbName, "can_not_get_values_for_referral", objs, smse);
}
return (new ValidValues(status, values));
}
use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.
the class Gateway method initGWServletUtilsMap.
private GatewayServletUtils initGWServletUtilsMap(String orgName) {
GatewayServletUtils utils = null;
OrganizationConfigManager orgConfigMgr = authD.getOrgConfigManager(orgName);
try {
Set registeredServices = orgConfigMgr.getAssignedServices();
Iterator iter = registeredServices.iterator();
while (iter.hasNext()) {
String service = (String) iter.next();
if (service.trim().indexOf("iPlanetAMAuth") == 0) {
int idx = service.lastIndexOf("Service");
String module = null;
if (idx > "iPlanetAMAuth".length()) {
module = service.substring("iPlanetAMAuth".length(), idx);
} else {
continue;
}
if (authenticators.contains(module)) {
utils = addGWServletUtilsToMap(orgName, module);
}
}
}
} catch (Exception e) {
debug.error("Error in GatewayServlet:initGWServletUtilsMap()");
debug.error("", e);
}
return utils;
}
use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.
the class PolicyModelImpl method getRealmNames.
/**
* Returns realms that have names matching with a filter.
*
* @param base Base realm name for this search. null indicates root
* suffix.
* @param filter Filter string.
* @return realms that have names matching with a filter.
* @throws AMConsoleException if search fails.
*/
public Set getRealmNames(String base, String filter) throws AMConsoleException {
if ((base == null) || (base.length() == 0)) {
base = getStartDN();
}
String[] param = { base };
logEvent("ATTEMPT_GET_REALM_NAMES", param);
try {
OrganizationConfigManager orgMgr = new OrganizationConfigManager(adminSSOToken, base);
logEvent("SUCCEED_GET_REALM_NAMES", param);
return appendBaseDN(base, orgMgr.getSubOrganizationNames(filter, true), filter, this);
} catch (SMSException e) {
String strError = getErrorString(e);
String[] paramsEx = { base, strError };
logEvent("SMS_EXCEPTION_GET_REALM_NAMES", paramsEx);
throw new AMConsoleException(strError);
}
}
Aggregations