use of com.iplanet.sso.SSOException in project OpenAM by OpenRock.
the class SmsCollectionProvider method updateInstance.
/**
* Updates a child instance of config. The parent config referenced by the request path is found, and
* the config is updated using the resourceId.
* {@inheritDoc}
*/
@Override
public Promise<ResourceResponse, ResourceException> updateInstance(Context context, String resourceId, UpdateRequest request) {
JsonValue content = request.getContent();
String realm = realmFor(context);
try {
Map<String, Set<String>> attrs = converter.fromJson(realm, content);
ServiceConfigManager scm = getServiceConfigManager(context);
ServiceConfig config = parentSubConfigFor(context, scm);
ServiceConfig node = checkedInstanceSubConfig(context, resourceId, config);
node.setAttributes(attrs);
JsonValue result = getJsonValue(realm, node);
return newResultPromise(newResourceResponse(resourceId, String.valueOf(result.hashCode()), result));
} catch (ServiceNotFoundException e) {
debug.warning("::SmsCollectionProvider:: ServiceNotFoundException on update", e);
return new NotFoundException("Unable to update SMS config: " + e.getMessage()).asPromise();
} catch (SMSException e) {
debug.warning("::SmsCollectionProvider:: SMSException on update", e);
return new InternalServerErrorException("Unable to update SMS config: " + e.getMessage()).asPromise();
} catch (SSOException e) {
debug.warning("::SmsCollectionProvider:: SSOException on update", e);
return new InternalServerErrorException("Unable to update SMS config: " + e.getMessage()).asPromise();
} catch (ResourceException e) {
return e.asPromise();
}
}
use of com.iplanet.sso.SSOException in project OpenAM by OpenRock.
the class SitesResourceProvider method readInstance.
@Override
public Promise<ResourceResponse, ResourceException> readInstance(Context context, String id, ReadRequest request) {
try {
SSOToken token = getSsoToken(context);
ResourceResponse site = getSite(token, id);
return newResultPromise(site);
} catch (SMSException | SSOException | ConfigurationException e) {
debug.error("Could not read site {}", id, e);
return new InternalServerErrorException("Could not read site").asPromise();
} catch (NotFoundException e) {
return e.asPromise();
}
}
use of com.iplanet.sso.SSOException in project OpenAM by OpenRock.
the class ComplianceServicesImpl method isComplianceUserDeletionEnabled.
/**
* Method which checks if Compliance User Deletion is enabled
*
* @return true if Compliance User Deletion is enabled
* @exception AMException
* if an error is encountered
*/
public static boolean isComplianceUserDeletionEnabled() throws AMException {
try {
if (gsc == null) {
ServiceSchemaManager scm = new ServiceSchemaManager(ADMINISTRATION_SERVICE, internalToken);
gsc = scm.getGlobalSchema();
}
Map attrMap = gsc.getReadOnlyAttributeDefaults();
Set values = (Set) attrMap.get(COMPLIANCE_USER_DELETION_ATTR);
boolean enabled = false;
if (values == null || values.isEmpty()) {
enabled = false;
} else {
String val = (String) values.iterator().next();
enabled = (val.equalsIgnoreCase("true"));
}
if (debug.messageEnabled()) {
debug.message("Compliance.isComplianceUserDeletionEnabled = " + enabled);
}
return enabled;
} catch (SMSException ex) {
debug.error(AMSDKBundle.getString("359"), ex);
throw new AMException(AMSDKBundle.getString("359"), "359");
} catch (SSOException ex) {
debug.error(AMSDKBundle.getString("359"), ex);
throw new AMException(AMSDKBundle.getString("359"), "359");
}
}
use of com.iplanet.sso.SSOException in project OpenAM by OpenRock.
the class CommonUtils method populateManagedObjects.
protected static boolean populateManagedObjects() {
try {
ServiceConfigManager scm = new ServiceConfigManager("DAI", getInternalToken());
ServiceConfig gc = scm.getGlobalConfig(null);
Set managedObjects = gc.getSubConfigNames("*", "ManagedObjects");
if (managedObjects == null || managedObjects.isEmpty()) {
debug.message("CommonUtils.populateManagedObject " + "managedObjects=null");
return false;
// populateManagedObjectsWithDefaults();
}
Iterator mIter = managedObjects.iterator();
while (mIter.hasNext()) {
String mo = (String) mIter.next();
mo = mo.toLowerCase();
ServiceConfig sc = gc.getSubConfig(mo);
if (sc != null) {
Map attrs = sc.getAttributes();
Set ocSet = (Set) attrs.get("objectclass");
Set ctSet = (Set) attrs.get("creationtemplatename");
Set stSet = (Set) attrs.get("searchtemplatename");
Set typeSet = (Set) attrs.get("type");
Set stAttr = (Set) attrs.get("statusattribute");
String oc = getObjectClass(ocSet, mo);
String ct = getCreationTemplateName(ctSet, mo);
String st = getSearchTemplateName(stSet, mo);
String stAttrName = getStatusAttributeName(stAttr);
// Assumes a type is always defined in the config.
// TODO be careful with NPE here.
String typeS = (String) typeSet.iterator().next();
// int type = Integer.parseInt(typeS);
supportedTypes.put(mo, typeS);
supportedNames.put(typeS, mo);
if (oc != null) {
ObjectClassManager.objectClassMap.put(typeS, oc);
ObjectClassManager.objectTypeMap.put(oc, typeS);
}
if (st != null)
searchtemplateMap.put(typeS, st);
if (ct != null)
creationtemplateMap.put(typeS, ct);
if (stAttrName != null)
statusAttributeMap.put(typeS, stAttrName);
}
}
if (debug.messageEnabled()) {
debug.message("CreationTemplate MAP = " + creationtemplateMap.toString());
debug.message("SearchTemplate Map = " + searchtemplateMap.toString());
debug.message("ObjectClass-Type Map = " + ObjectClassManager.objectClassMap.toString());
debug.message("Type-ObjectClass MAP = " + ObjectClassManager.objectTypeMap.toString());
debug.message("Supported names-type = " + supportedTypes.toString());
debug.message("Status Attributes= " + statusAttributeMap.toString());
}
} catch (SMSException se) {
return false;
// populateManagedObjectsWithDefaults();
} catch (SSOException ssoe) {
return false;
// populateManagedObjectsWithDefaults();
}
return true;
}
use of com.iplanet.sso.SSOException in project OpenAM by OpenRock.
the class EventService method isAMSDKConfigured.
private static boolean isAMSDKConfigured() {
boolean isAMSDKConfigured = false;
boolean configTime = isDuringConfigurationTime();
logger.message("EventService.getListenerList(): {}: {}", Constants.SYS_PROPERTY_INSTALL_TIME, configTime);
if (!configTime) {
try {
ServiceSchemaManager scm = new ServiceSchemaManager(AccessController.doPrivileged(AdminTokenAction.getInstance()), IdConstants.REPO_SERVICE, "1.0");
ServiceSchema idRepoSubSchema = scm.getOrganizationSchema();
Set idRepoPlugins = idRepoSubSchema.getSubSchemaNames();
if (idRepoPlugins.contains("amSDK")) {
isAMSDKConfigured = true;
}
} catch (SMSException ex) {
logger.warning("EventService.getListenerList() - Unable to obtain idrepo service", ex);
} catch (SSOException ex) {
// Should not happen, ignore the exception
}
}
return isAMSDKConfigured;
}
Aggregations