use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.
the class ApplicationCacheAfterRealmChangeTest method setup.
@BeforeClass
public void setup() throws Exception {
if (!migrated) {
return;
}
OrganizationConfigManager ocm = new OrganizationConfigManager(adminToken, "/");
String subRealm = SUB_REALM.substring(1);
ocm.createSubOrganization(subRealm, Collections.EMPTY_MAP);
setOrgAlias(true);
}
use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.
the class AMLoginModule method getOrgProfile.
/**
* Returns the organization attributes for specified organization.
*
* @param orgDN Requested organization DN.
* @return Map that contains all attribute key/value pairs defined
* in the organization.
* @throws AuthLoginException if cannot get organization profile.
* @supported.api
*/
public Map getOrgProfile(String orgDN) throws AuthLoginException {
Map orgMap = null;
if (orgDN == null || orgDN.length() == 0) {
// get login state for this authentication session
orgDN = getLoginState("getOrgProfile(String)").getOrgDN();
}
try {
OrganizationConfigManager orgConfigMgr = AuthD.getAuth().getOrgConfigManager(orgDN);
orgMap = orgConfigMgr.getAttributes(ISAuthConstants.IDREPO_SVC_NAME);
if (debug.messageEnabled()) {
debug.message("orgMap is : " + orgMap);
}
} catch (Exception ex) {
debug.message("getOrgProfile", ex);
throw new AuthLoginException(ex);
}
return orgMap;
}
use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.
the class AMLoginModule method getOrgServiceTemplate.
/**
* Returns service template attributes defined for the specified
* organization.
*
* @param orgDN Organization DN.
* @param serviceName Requested service name.
* @return Map that contains all attribute key/value pairs defined in the
* organization service template.
* @throws AuthLoginException if cannot get organization service
* template.
* @supported.api
*/
public Map getOrgServiceTemplate(String orgDN, String serviceName) throws AuthLoginException {
Map orgMap = null;
if (orgDN == null || orgDN.length() == 0) {
// get login state for this authentication session
orgDN = getLoginState("getOrgServiceTemplate(String, String)").getOrgDN();
}
try {
OrganizationConfigManager orgConfigMgr = AuthD.getAuth().getOrgConfigManager(orgDN);
orgMap = orgConfigMgr.getServiceConfig(serviceName).getAttributes();
} catch (Exception ex) {
debug.message("getOrgServiceTemplate", ex);
throw new AuthLoginException(ex);
}
return orgMap;
}
use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.
the class EntitlementService method getSubjectAttributesCollectorConfiguration.
/**
* Returns subject attributes collector configuration.
*
* @param name subject attributes collector name
* @return subject attributes collector configuration.
* @throws EntitlementException if subject attributes collector
* configuration cannot be returned.
*/
public Map<String, Set<String>> getSubjectAttributesCollectorConfiguration(String name) throws EntitlementException {
try {
SSOToken token = getSSOToken();
if (token != null) {
OrganizationConfigManager ocm = new OrganizationConfigManager(token, realm);
ServiceConfig orgConfig = ocm.getServiceConfig(SERVICE_NAME);
if (orgConfig != null) {
Set<String> subConfigNames = orgConfig.getSubConfigNames();
if ((subConfigNames == null) || (!subConfigNames.contains(CONFIG_SUBJECT_ATTRIBUTES_COLLECTORS))) {
orgConfig.addSubConfig(CONFIG_SUBJECT_ATTRIBUTES_COLLECTORS, SCHEMA_SUBJECT_ATTRIBUTES_COLLECTORS, 0, Collections.EMPTY_MAP);
}
ServiceConfig conf = orgConfig.getSubConfig(CONFIG_SUBJECT_ATTRIBUTES_COLLECTORS);
ServiceConfig subConfig = conf.getSubConfig(name);
if (subConfig == null) {
Map<String, Set<String>> attrs = Collections.EMPTY_MAP;
// copy from parent sub config
OrganizationConfigManager pocm = ocm.getParentOrgConfigManager();
if (pocm != null) {
ServiceConfig porgConfig = pocm.getServiceConfig(SERVICE_NAME);
if (porgConfig != null) {
ServiceConfig pconf = porgConfig.getSubConfig(CONFIG_SUBJECT_ATTRIBUTES_COLLECTORS);
if (pconf != null) {
ServiceConfig psubConfig = pconf.getSubConfig(name);
if (psubConfig != null) {
attrs = psubConfig.getAttributes();
}
}
}
}
conf.addSubConfig(name, SCHEMA_OPENSSO_SUBJECT_ATTRIBUTES_COLLECTOR, 0, attrs);
subConfig = conf.getSubConfig(name);
}
return subConfig.getAttributes();
}
} else {
PolicyConstants.DEBUG.error("EntitlementService.getSubjectAttributesCollectorConfiguration:" + "admin sso token is absent");
Object[] arg = { name };
throw new EntitlementException(287, arg);
}
} catch (SMSException ex) {
PolicyConstants.DEBUG.error("EntitlementService.getSubjectAttributesCollectorConfiguration", ex);
Object[] arg = { name };
throw new EntitlementException(288, arg, ex);
} catch (SSOException ex) {
PolicyConstants.DEBUG.error("EntitlementService.getSubjectAttributesCollectorConfiguration", ex);
Object[] arg = { name };
throw new EntitlementException(288, arg, ex);
}
return null;
}
use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.
the class EntitlementService method setSubjectAttributesCollectorConfiguration.
/**
* Sets subject attributes collector configuration.
*
* @param name subject attributes collector name
* @param attrMap subject attributes collector configuration map.
* @throws EntitlementException if subject attributes collector
* configuration cannot be set.
*/
public void setSubjectAttributesCollectorConfiguration(String name, Map<String, Set<String>> attrMap) throws EntitlementException {
try {
SSOToken token = getSSOToken();
if (token != null) {
OrganizationConfigManager ocm = new OrganizationConfigManager(token, realm);
ServiceConfig orgConfig = ocm.getServiceConfig(SERVICE_NAME);
if (orgConfig != null) {
Set<String> subConfigNames = orgConfig.getSubConfigNames();
if ((subConfigNames == null) || (!subConfigNames.contains(CONFIG_SUBJECT_ATTRIBUTES_COLLECTORS))) {
orgConfig.addSubConfig(CONFIG_SUBJECT_ATTRIBUTES_COLLECTORS, SCHEMA_SUBJECT_ATTRIBUTES_COLLECTORS, 0, Collections.EMPTY_MAP);
}
ServiceConfig conf = orgConfig.getSubConfig(CONFIG_SUBJECT_ATTRIBUTES_COLLECTORS);
ServiceConfig subConfig = conf.getSubConfig(name);
if (subConfig == null) {
conf.addSubConfig(name, SCHEMA_OPENSSO_SUBJECT_ATTRIBUTES_COLLECTOR, 0, attrMap);
} else {
subConfig.setAttributes(attrMap);
}
}
} else {
PolicyConstants.DEBUG.error("EntitlementService.setSubjectAttributesCollectorConfiguration:" + "admin sso token is absent");
Object[] arg = { name };
throw new EntitlementException(289, arg);
}
} catch (SMSException ex) {
PolicyConstants.DEBUG.error("EntitlementService.setSubjectAttributesCollectorConfiguration", ex);
Object[] arg = { name };
throw new EntitlementException(290, arg, ex);
} catch (SSOException ex) {
PolicyConstants.DEBUG.error("EntitlementService.setSubjectAttributesCollectorConfiguration", ex);
Object[] arg = { name };
throw new EntitlementException(290, arg, ex);
}
}
Aggregations