use of com.sun.identity.sm.ServiceConfigManager in project OpenAM by OpenRock.
the class UserIdRepo method getOrgConfig.
static ServiceConfig getOrgConfig(SSOToken adminToken) throws SMSException, SSOException {
ServiceConfigManager svcCfgMgr = new ServiceConfigManager(IdConstants.REPO_SERVICE, adminToken);
ServiceConfig cfg = svcCfgMgr.getOrganizationConfig("", null);
Map values = new HashMap();
if (cfg == null) {
OrganizationConfigManager orgCfgMgr = new OrganizationConfigManager(adminToken, "/");
ServiceSchemaManager schemaMgr = new ServiceSchemaManager(IdConstants.REPO_SERVICE, adminToken);
ServiceSchema orgSchema = schemaMgr.getOrganizationSchema();
Set attrs = orgSchema.getAttributeSchemas();
for (Iterator iter = attrs.iterator(); iter.hasNext(); ) {
AttributeSchema as = (AttributeSchema) iter.next();
values.put(as.getName(), as.getDefaultValues());
}
cfg = orgCfgMgr.addServiceConfig(IdConstants.REPO_SERVICE, values);
}
return cfg;
}
use of com.sun.identity.sm.ServiceConfigManager in project OpenAM by OpenRock.
the class ServiceConfigServlet method printInfo.
private void printInfo(AuthContext lc, String servicename, String method, PrintWriter out) throws Exception {
// Obtain the SSO Token
SSOToken token = lc.getSSOToken();
out.println("<br><h3>SSOToken:</h3> " + token.getTokenID());
out.println("<p>");
// Obtain Service Manager
if (method.equalsIgnoreCase("globalSchema")) {
ServiceSchemaManager ssm = new ServiceSchemaManager(servicename, token);
out.println(ssm.getGlobalSchema().toString());
} else if (method.equalsIgnoreCase("globalConfig")) {
ServiceConfigManager scm = new ServiceConfigManager(servicename, token);
out.println(scm.getGlobalConfig(null).toString());
}
}
use of com.sun.identity.sm.ServiceConfigManager in project OpenAM by OpenRock.
the class SchemaTest method getSubConfigurationValues.
private Map getSubConfigurationValues(String name) throws SMSException, SSOException {
ServiceConfigManager scm = new ServiceConfigManager(TEST_SERVICE, getAdminSSOToken());
ServiceConfig sc = scm.getGlobalConfig(null);
sc = sc.getSubConfig("testConfig");
return sc.getAttributes();
}
use of com.sun.identity.sm.ServiceConfigManager in project OpenAM by OpenRock.
the class DelegationManager method getConfiguredPrivilegeNames.
/**
* Returns all the names of the delegation privileges that are configured
* with the realm.
*
* @return <code>Set</code> of <code>DelegationPrivilege</code> names
* configured with the realm.
*
* @throws DelegationException for any abnormal condition
*/
public Set getConfiguredPrivilegeNames() throws DelegationException {
Set privNames = null;
Set globalPrivNames = null;
Set orgPrivNames = null;
ServiceConfig privsConfig;
ServiceConfig sc;
String subConfigName = null;
int revisionNum = DelegationUtils.getRevisionNumber();
if (revisionNum == DelegationUtils.AM70_DELEGATION_REVISION) {
subConfigName = DelegationManager.PERMISSIONS;
} else {
subConfigName = DelegationManager.PRIVILEGES;
}
try {
ServiceConfigManager scm = new ServiceConfigManager(DELEGATION_SERVICE, getAdminToken());
// get the globally defined privilege names
sc = scm.getGlobalConfig(null);
if (sc != null) {
privsConfig = sc.getSubConfig(subConfigName);
if (privsConfig != null) {
globalPrivNames = privsConfig.getSubConfigNames();
}
}
try {
// get the organizationally defined privilege names
sc = scm.getOrganizationConfig(orgName, null);
if (sc != null) {
privsConfig = sc.getSubConfig(subConfigName);
if (privsConfig != null) {
orgPrivNames = privsConfig.getSubConfigNames();
}
}
} catch (SMSException ex) {
//ignore if organization configuration is not present
}
// merge the privilege names
if ((globalPrivNames != null) && (!globalPrivNames.isEmpty())) {
privNames = globalPrivNames;
if ((orgPrivNames != null) && (!orgPrivNames.isEmpty())) {
privNames.addAll(orgPrivNames);
}
} else {
privNames = orgPrivNames;
}
} catch (Exception e) {
throw new DelegationException(e);
}
return privNames;
}
use of com.sun.identity.sm.ServiceConfigManager in project OpenAM by OpenRock.
the class EntitlementService method getApplicationSubConfig.
private ServiceConfig getApplicationSubConfig(SSOToken token, String realm, String appName) throws SMSException, SSOException {
ServiceConfig applConf = null;
ServiceConfigManager mgr = new ServiceConfigManager(SERVICE_NAME, token);
ServiceConfig orgConfig = mgr.getOrganizationConfig(realm, null);
if (orgConfig != null) {
ServiceConfig conf = orgConfig.getSubConfig(EntitlementUtils.REGISTERED_APPLICATIONS);
if (conf != null) {
applConf = conf.getSubConfig(appName);
}
}
return applConf;
}
Aggregations