use of com.sun.identity.sm.ServiceSchema 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.ServiceSchema 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.ServiceSchema in project OpenAM by OpenRock.
the class EnableGenericRepoStep method perform.
@Override
public void perform() throws UpgradeException {
try {
ServiceSchema genericSchema = getGenericLDAPv3Schema();
UpgradeProgress.reportStart("upgrade.genericrepo.start");
genericSchema.setI18Nkey("a2039");
UpgradeProgress.reportEnd("upgrade.success");
} catch (Exception ex) {
UpgradeProgress.reportEnd("upgrade.failed");
DEBUG.error("An error occurred while trying to enable the generic LDAPv3 repo", ex);
throw new UpgradeException(ex);
}
}
use of com.sun.identity.sm.ServiceSchema in project OpenAM by OpenRock.
the class EnableGenericRepoStep method getGenericLDAPv3Schema.
private ServiceSchema getGenericLDAPv3Schema() throws SSOException, SMSException {
ServiceSchemaManager ssm = new ServiceSchemaManager(IdConstants.REPO_SERVICE, getAdminToken());
ServiceSchema organizationSchema = ssm.getOrganizationSchema();
ServiceSchema genericSchema = organizationSchema.getSubSchema("LDAPv3");
return genericSchema;
}
use of com.sun.identity.sm.ServiceSchema in project OpenAM by OpenRock.
the class UpgradeOAuth2ProviderStep method findUpgradableProviders.
private void findUpgradableProviders() throws UpgradeException {
try {
final ServiceSchema serviceSchema = ssm.getOrganizationSchema();
for (String realm : getRealmNames()) {
final ServiceConfig serviceConfig = scm.getOrganizationConfig(realm, null);
final Map<String, Set<String>> withDefaults = serviceConfig.getAttributesForRead();
final Map<String, Set<String>> withoutDefaults = serviceConfig.getAttributesWithoutDefaultsForRead();
final Map<String, Set<String>> withoutValidators = SMSUtils.removeValidators(withDefaults, serviceSchema);
if (isProviderRelyingOnDefaults(withoutDefaults, withoutValidators)) {
attributesToUpdate.put(realm, withoutValidators);
} else if (shouldUpgradeClaims(withDefaults)) {
attributesToUpdate.put(realm, withoutValidators);
} else if (shouldUpgradeAlgorithmName(withoutDefaults)) {
attributesToUpdate.put(realm, null);
}
}
} catch (Exception e) {
DEBUG.error("An error occurred while trying to look for upgradable OAuth2 Providers.", e);
throw new UpgradeException("Unable to retrieve OAuth2 Providers.", e);
}
}
Aggregations