use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.
the class ApplicationCacheAfterRealmChangeTest method setOrgAlias.
private void setOrgAlias(boolean flag) throws SMSException, SSOException {
ServiceSchemaManager ssm = new ServiceSchemaManager(PolicyConfig.POLICY_CONFIG_SERVICE, adminToken);
ServiceSchema global = ssm.getSchema(SchemaType.GLOBAL);
Set<String> values = new HashSet<String>();
values.add(Boolean.toString(flag));
global.setAttributeDefaults("sun-am-policy-config-org-alias-mapped-resources-enabled", values);
}
use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.
the class DelegationUtils method getRevisionNumber.
/**
* gets the Delegation Service revision number
* @return the revision number of the delegation service.
*
*/
static int getRevisionNumber() {
if (revisionNum == 0) {
try {
ServiceSchemaManager ssm = new ServiceSchemaManager(DelegationManager.DELEGATION_SERVICE, DelegationManager.getAdminToken());
revisionNum = ssm.getRevisionNumber();
if (debug.messageEnabled()) {
debug.message("DelegationUtils.getRevisionNumber(): " + "Delegation Service revision number is " + revisionNum);
}
} catch (SMSException sme) {
debug.error("DelegationUtils.getRevisionNumber(): " + "Unable to get Delegation revision number", sme);
} catch (SSOException ssoe) {
debug.error("DelegationUtils.getRevisionNumber(): " + "Unable to get Delegation revision number", ssoe);
}
}
return revisionNum;
}
use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.
the class ConfigFedMonitoring method getSAML1TPs.
private void getSAML1TPs() {
String classMethod = "ConfigFedMonitoring.getSAML1TPs: ";
try {
// get SAML service attributes
Map attributeSchemas = new HashMap();
ServiceSchemaManager svcSchMgr = new ServiceSchemaManager("iPlanetAMSAMLService", ssoToken);
Set schemaTypes = svcSchMgr.getSchemaTypes();
for (Iterator it = schemaTypes.iterator(); it.hasNext(); ) {
SchemaType type = (SchemaType) it.next();
ServiceSchema schema = svcSchMgr.getSchema(type);
if (schema != null) {
String curSchemaType = type.getType();
Set asch = schema.getAttributeSchemas();
for (Iterator iu = asch.iterator(); iu.hasNext(); ) {
AttributeSchema as = (AttributeSchema) iu.next();
String i18n = as.getI18NKey();
if ((i18n != null) && (i18n.trim().length() > 0)) {
attributeSchemas.put(as.getName(), as);
}
}
}
}
// get the trusted partners
StringBuffer cotsb = new StringBuffer(classMethod + "SAML1.x Trusted Partners:\n");
AttributeSchema as = (AttributeSchema) attributeSchemas.get("iplanet-am-saml-partner-urls");
Set orgValues = (Set) as.getDefaultValues();
int ovsize = orgValues.size();
if (debug.messageEnabled()) {
cotsb.append(" has ").append(ovsize).append(" entries:\n");
}
List s1List = new ArrayList(ovsize);
if (ovsize > 0) {
for (Iterator iu = orgValues.iterator(); iu.hasNext(); ) {
String prtn = (String) iu.next();
StringTokenizer st = new StringTokenizer(prtn, "|");
int numtoks = st.countTokens();
if (debug.messageEnabled()) {
cotsb.append(" #tokens = ").append(numtoks).append("\n");
}
String xx = null;
while (st.hasMoreTokens()) {
prtn = st.nextToken();
StringTokenizer st2 = new StringTokenizer(prtn, "=");
if (st2.countTokens() == 2) {
String st3 = st2.nextToken();
xx = st2.nextToken();
if (st3.equalsIgnoreCase("PARTNERNAME")) {
if (debug.messageEnabled()) {
cotsb.append(" **got PARTNERNAME**\n");
}
s1List.add(xx);
}
}
}
if (debug.messageEnabled()) {
cotsb.append(" ").append(xx).append("\n");
}
}
}
if (debug.messageEnabled()) {
debug.message(cotsb.toString());
}
// send SAML1.x trusted partners list, s1List, to the Agent
Agent.saml1TPConfig(s1List);
} catch (SSOException e) {
debug.error(classMethod + "sso ex getting saml1.x: " + e.getMessage());
} catch (SMSException e) {
debug.error(classMethod + "sms ex getting saml1.x: " + e.getMessage());
}
}
use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.
the class DelegationManager method loadDelegationPlugin.
/**
* Loads the default implementation of DelegationInterface
*/
static synchronized DelegationInterface loadDelegationPlugin() throws DelegationException {
if (pluginInstance == null) {
try {
// get super admin user token
SSOToken privilegedToken = getAdminToken();
ServiceSchemaManager ssm = new ServiceSchemaManager(DELEGATION_SERVICE, privilegedToken);
ServiceSchema globalSchema = ssm.getGlobalSchema();
if (globalSchema != null) {
Map attributeDefaults = globalSchema.getAttributeDefaults();
if (attributeDefaults != null) {
subjectIdTypes.addAll((Set) attributeDefaults.get(SUBJECT_ID_TYPES));
}
}
if (debug.messageEnabled()) {
debug.message("Configured Subject ID Types: " + subjectIdTypes);
}
Set pluginNames = ssm.getPluginSchemaNames(DELEGATION_PLUGIN_INTERFACE, null);
if (pluginNames == null) {
throw new DelegationException(ResBundleUtils.rbName, "no_plugin_specified", null, null);
}
if (debug.messageEnabled()) {
debug.message("pluginNames=" + pluginNames);
}
// for the time being, only support one plugin
Iterator it = pluginNames.iterator();
if (it.hasNext()) {
String pluginName = (String) it.next();
PluginSchema ps = ssm.getPluginSchema(pluginName, DELEGATION_PLUGIN_INTERFACE, null);
if (ps == null) {
throw new DelegationException(ResBundleUtils.rbName, "no_plugin_specified", null, null);
}
String className = ps.getClassName();
if (debug.messageEnabled()) {
debug.message("Plugin class name:" + className);
}
pluginInstance = (DelegationInterface) Class.forName(className).newInstance();
pluginInstance.initialize(privilegedToken, null);
if (debug.messageEnabled()) {
debug.message("Successfully created " + "a delegation plugin instance");
}
} else {
throw new DelegationException(ResBundleUtils.rbName, "no_plugin_specified", null, null);
}
} catch (Exception e) {
debug.error("Unable to get an instance of plugin " + "for delegation", e);
pluginInstance = null;
throw new DelegationException(e);
}
}
return pluginInstance;
}
use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.
the class FederationPlugin method setAuthModules.
private void setAuthModules(SSOToken adminSSOToken) {
try {
ServiceSchemaManager mgr = new ServiceSchemaManager("iPlanetAMAuthService", adminSSOToken);
ServiceSchema ss = mgr.getSchema(SchemaType.GLOBAL);
Map values = ss.getAttributeDefaults();
Set modules = (Set) values.get("iplanet-am-auth-authenticators");
modules.add("com.sun.identity.authentication.modules.federation.Federation");
modules.add("com.sun.identity.authentication.modules.sae.SAE");
ss.setAttributeDefaults(values);
} catch (SSOException e) {
e.printStackTrace();
throw new RuntimeException(e);
} catch (SMSException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
Aggregations