use of com.iplanet.sso.SSOException in project OpenAM by OpenRock.
the class EntitlementService method getApplicationConfiguration.
/**
* Get the service config for registered applications.
* @param token The admin token for access to the Service Config.
* @param realm The realm from which to retrieve the service config.
* @return The application Service Config.
*/
private ServiceConfig getApplicationConfiguration(SSOToken token, String realm) {
try {
if (token != null) {
if (realm.startsWith(SMSEntry.SUN_INTERNAL_REALM_PREFIX) || realm.startsWith(SMSEntry.SUN_INTERNAL_REALM_PREFIX2)) {
realm = "/";
}
// TODO. Since applications for the hidden realms have to be
// the same as root realm mainly for delegation without any
// referrals, the hack is to use root realm for hidden realm.
String hackRealm = LDAPUtils.isDN(realm) ? DNMapper.orgNameToRealmName(realm) : realm;
ServiceConfigManager mgr = new ServiceConfigManager(SERVICE_NAME, token);
ServiceConfig orgConfig = mgr.getOrganizationConfig(hackRealm, null);
if (orgConfig != null) {
return orgConfig.getSubConfig(EntitlementUtils.REGISTERED_APPLICATIONS);
}
} else {
PolicyConstants.DEBUG.error("EntitlementService.getApplicationConfiguration, admin token is missing");
}
} catch (ClassCastException ex) {
PolicyConstants.DEBUG.error("EntitlementService.getApplicationConfiguration", ex);
} catch (SMSException ex) {
PolicyConstants.DEBUG.error("EntitlementService.getApplicationConfiguration", ex);
} catch (SSOException ex) {
PolicyConstants.DEBUG.error("EntitlementService.getApplicationConfiguration", ex);
}
return null;
}
use of com.iplanet.sso.SSOException in project OpenAM by OpenRock.
the class EntitlementService method addApplicationAction.
/**
* Adds a new action.
*
* @param appName application name.
* @param name Action name.
* @param defVal Default value.
* @throws EntitlementException if action cannot be added.
*/
public void addApplicationAction(String appName, String name, Boolean defVal) throws EntitlementException {
try {
SSOToken token = SubjectUtils.getSSOToken(getAdminSubject());
if (token == null) {
throw new EntitlementException(226);
}
ServiceConfig applConf = getApplicationSubConfig(token, realm, appName);
if (applConf != null) {
Map<String, Set<String>> data = applConf.getAttributes();
Map<String, Set<String>> result = addAction(data, name, defVal);
if (result != null) {
applConf.setAttributes(result);
}
}
} catch (SMSException ex) {
throw new EntitlementException(221, ex);
} catch (SSOException ex) {
throw new EntitlementException(221, ex);
}
}
use of com.iplanet.sso.SSOException in project OpenAM by OpenRock.
the class EntitlementService method setConfiguration.
private static void setConfiguration(SSOToken token, String attrName, Set<String> values) {
try {
if (token != null) {
ServiceSchemaManager smgr = new ServiceSchemaManager(SERVICE_NAME, token);
AttributeSchema as = smgr.getGlobalSchema().getAttributeSchema(attrName);
if (as != null) {
as.setDefaultValues(values);
}
} else {
PolicyConstants.DEBUG.error("EntitlementService.getAttributeValues: " + "admin token is missing");
}
} catch (SMSException ex) {
PolicyConstants.DEBUG.error("EntitlementService.setAttributeValues", ex);
} catch (SSOException ex) {
PolicyConstants.DEBUG.error("EntitlementService.setAttributeValues", ex);
}
}
use of com.iplanet.sso.SSOException in project OpenAM by OpenRock.
the class LogConfigReader method newStatusIsInactive.
private boolean newStatusIsInactive() {
SSOToken ssoToken;
try {
ssoToken = getSSOToken();
} catch (SSOException ssoe) {
debug.error("LogConfigReader:newStatusIsInactive:" + "Could not get proper SSOToken", ssoe);
return false;
}
try {
ServiceSchemaManager schemaManager = new ServiceSchemaManager("iPlanetAMLoggingService", ssoToken);
ServiceSchema smsLogSchema = schemaManager.getGlobalSchema();
Map sss = smsLogSchema.getAttributeDefaults();
String key = LogConstants.LOG_STATUS_ATTR;
String value = CollectionHelper.getMapAttr(sss, key);
if ((value == null) || (value.length() == 0)) {
value = "ACTIVE";
}
return (value.equalsIgnoreCase("INACTIVE"));
} catch (Exception e) {
debug.error("LogConfigReader:newStatusIsInactive:" + "error reading Log Status attribute: " + e.getMessage());
}
return false;
}
use of com.iplanet.sso.SSOException in project OpenAM by OpenRock.
the class OrgConfigViaAMSDK method removeAttribute.
/**
* Removes the specified attribute from AMSDK organization. The organziation
* attribute names are defined in the IdRepo service.
*/
void removeAttribute(String attrName) throws SMSException {
if (attrName == null) {
return;
}
// Get the attribute mapping and removed specified attribute
Map attrMap = getAttributeMapping();
String amsdkAttrName = (String) attrMap.get(attrName);
if (amsdkAttrName != null) {
HashSet set = new HashSet();
set.add(amsdkAttrName);
try {
parentOrg.removeAttributes(set);
parentOrg.store();
} catch (AMException ame) {
if (debug.messageEnabled()) {
debug.message("OrgConfigViaAMSDK::removeAttribute" + ": failed with AMException", ame);
}
throw (new SMSException(AMSDKBundle.BUNDLE_NAME, ame.getMessage(), ame, ame.getMessage()));
} catch (SSOException ssoe) {
throw (new SMSException(bundle.getString("sms-INVALID_SSO_TOKEN"), ssoe, "sms-INVALID_SSO_TOKEN"));
}
}
}
Aggregations