use of com.sun.identity.sm.ServiceConfig in project OpenAM by OpenRock.
the class AuthPropertiesModelImpl method setValues.
public void setValues(Map modifiedValues) throws AMConsoleException {
String[] params = { currentRealm, CORE_AUTH_SERVICE };
logEvent("ATTEMPT_MODIFY_AUTH_INSTANCE", params);
try {
ServiceConfig sc = getCoreAuthServiceConfig();
sc.setAttributes(modifiedValues);
logEvent("SUCCEED_MODIFY_AUTH_INSTANCE", params);
} catch (SMSException e) {
String strError = getErrorString(e);
String[] paramsEx = { currentRealm, CORE_AUTH_SERVICE, strError };
logEvent("SMS_EXCEPTION_MODIFY_AUTH_INSTANCE", paramsEx);
throw new AMConsoleException(strError);
} catch (SSOException e) {
String strError = getErrorString(e);
String[] paramsEx = { currentRealm, CORE_AUTH_SERVICE, strError };
logEvent("SSO_EXCEPTION_MODIFY_AUTH_INSTANCE", paramsEx);
throw new AMConsoleException(strError);
}
}
use of com.sun.identity.sm.ServiceConfig in project OpenAM by OpenRock.
the class CoreAttributesModelImpl method getAttributeValues.
/**
* Returns attributes values.
*
* @return attributes values.
*/
public Map getAttributeValues() {
Map attrs = null;
String[] param = { currentRealm };
logEvent("ATTEMPT_GET_AUTH_PROFILE_IN_REALM", param);
try {
OrganizationConfigManager scm = new OrganizationConfigManager(getUserSSOToken(), currentRealm);
ServiceConfig config = scm.getServiceConfig(AUTH_SERVICE_NAME);
attrs = config.getAttributes();
if ((attrs == null) || attrs.isEmpty()) {
debug.warning("no attributes were returned for Core Auth ...");
}
logEvent("SUCCEED_GET_AUTH_PROFILE_IN_REALM", param);
} catch (SMSException e) {
String strError = getErrorString(e);
String[] paramsEx = { currentRealm, strError };
logEvent("SMS_CONFIGURATION_EXCEPTION_GET_AUTH_PROFILE_IN_REALM", paramsEx);
debug.error("CoreAttributesModelImpl.getAttributeValues", e);
}
return (attrs == null) ? Collections.EMPTY_MAP : attrs;
}
use of com.sun.identity.sm.ServiceConfig in project OpenAM by OpenRock.
the class EntitiesModelImpl method repoExists.
public boolean repoExists(String realmName) {
try {
ServiceConfigManager svcCfgMgr = new ServiceConfigManager(IdConstants.REPO_SERVICE, getUserSSOToken());
ServiceConfig cfg = svcCfgMgr.getOrganizationConfig(realmName, null);
if (cfg == null) {
return false;
}
Set names = cfg.getSubConfigNames();
if (names == null || names.isEmpty()) {
return false;
}
return true;
} catch (SMSException e) {
String strError = getErrorString(e);
String[] paramsEx = { realmName, strError };
logEvent("SMS_EXCEPTION_GET_ID_REPO_NAMES", paramsEx);
return false;
} catch (SSOException e) {
String strError = getErrorString(e);
String[] paramsEx = { realmName, strError };
logEvent("SSO_EXCEPTION_GET_ID_REPO_NAMES", paramsEx);
return false;
}
}
use of com.sun.identity.sm.ServiceConfig in project OpenAM by OpenRock.
the class AMServiceUtils method getOrgConfig.
/**
* Get organization config for the service
*
* @param token
* SSOToken
* @param orgDN
* DN of the org or org unit
* @param serviceName
* Service Name
* @return ServiceConfig of the organization for the service
*/
public static ServiceConfig getOrgConfig(SSOToken token, String orgDN, String serviceName) throws SSOException, AMException {
try {
ServiceConfigManager scm = new ServiceConfigManager(serviceName, token);
ServiceConfig sc = scm.getOrganizationConfig(orgDN, null);
DN theOrgDN = DN.valueOf(orgDN);
if (theOrgDN.equals(DN.valueOf(SMSEntry.getAMSdkBaseDN())) && sc != null) {
Map avPair = sc.getAttributes();
Set subConfigs = sc.getSubConfigNames();
if (avPair.isEmpty() && (subConfigs == null || subConfigs.isEmpty())) {
return null;
}
}
return sc;
} catch (ServiceNotFoundException ex) {
Object[] args = { serviceName };
String locale = AMCommonUtils.getUserLocale(token);
throw new AMException(AMSDKBundle.getString("481", args, locale), "481", args);
} catch (ServiceAlreadyExistsException ex) {
Object[] args = { serviceName };
String locale = AMCommonUtils.getUserLocale(token);
throw new AMException(AMSDKBundle.getString("479", args, locale), "479", args);
} catch (SMSException ex) {
Object[] args = { serviceName };
String locale = AMCommonUtils.getUserLocale(token);
throw new AMException(AMSDKBundle.getString("482", args, locale), "482", args);
}
}
use of com.sun.identity.sm.ServiceConfig in project OpenAM by OpenRock.
the class CoreTokenConfigService method initServiceConfig.
private synchronized void initServiceConfig() {
try {
SSOToken dsameUserToken = (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance());
ServiceConfigManager mgr = new ServiceConfigManager(CoreTokenConstants.CORE_TOKEN_CONFIG_SERVICE_NAME, dsameUserToken);
ServiceConfig globalConf = mgr.getGlobalConfig(null);
if (globalConf != null) {
Map<String, Set<String>> map = globalConf.getAttributes();
if (map != null) {
Set<String> set = map.get(IMPL_CLASS_ATTR);
if ((set != null) && !set.isEmpty()) {
implClassName = set.iterator().next();
}
set = map.get(SEARCHABLE_ATTR);
Set<String> tmpSet = new HashSet<String>();
if ((set != null) && !set.isEmpty()) {
Iterator<String> it = set.iterator();
while (it.hasNext()) {
tmpSet.add(it.next().toLowerCase());
}
}
searchableAttrs = tmpSet;
set = map.get(CLEANUP_INTERVAL);
if ((set != null) && !set.isEmpty()) {
String tmp = set.iterator().next();
try {
cleanupInt = Integer.parseInt(tmp) * 1000;
} catch (NumberFormatException ne) {
CoreTokenUtils.debug.error("CoreTokenConfigService" + ".init. invalid interval : " + tmp, ne);
cleanupInt = DEFAULT_CLEANUP_INTERVAL;
}
}
set = map.get(TYPES_WITHOUT_ETAG_ENFORCE);
tmpSet = new HashSet<String>();
if ((set != null) && !set.isEmpty()) {
Iterator<String> it = set.iterator();
while (it.hasNext()) {
tmpSet.add(it.next().toLowerCase());
}
}
noETagEnfTypes = tmpSet;
}
}
if (CoreTokenUtils.debug.messageEnabled()) {
CoreTokenUtils.debug.message("CoreTokenConfigServcie.init: " + "searchable Attrs=" + searchableAttrs + "; token store impl class=" + implClassName + "; cleanup interval=" + cleanupInt + "; token types without ETag enforcement=" + noETagEnfTypes);
}
} catch (SMSException ex) {
CoreTokenUtils.debug.error("CoreTokenConfigService.init", ex);
} catch (SSOException ex) {
CoreTokenUtils.debug.error("CoreTokenConfigService.init", ex);
}
}
Aggregations