use of com.sun.identity.authentication.config.AMConfigurationException in project OpenAM by OpenRock.
the class AuthPropertiesModelImpl method createAuthInstance.
public void createAuthInstance(String name, String type) throws AMConsoleException {
String[] params = { currentRealm, name, type };
logEvent("ATTEMPT_CREATE_AUTH_INSTANCE", params);
try {
AMAuthenticationManager mgr = new AMAuthenticationManager(getUserSSOToken(), currentRealm);
AMAuthenticationSchema as = mgr.getAuthenticationSchema(type);
mgr.createAuthenticationInstance(name, type, as.getAttributeValues());
logEvent("SUCCEED_CREATE_AUTH_INSTANCE", params);
} catch (AMConfigurationException e) {
String strError = getErrorString(e);
String[] paramsEx = { currentRealm, name, type, strError };
logEvent("AUTH_CONFIG_EXCEPTION_CREATE_AUTH_INSTANCE", paramsEx);
debug.warning("AuthPropertiesModelImpl.createAuthInstance ", e);
throw new AMConsoleException(strError);
}
}
use of com.sun.identity.authentication.config.AMConfigurationException in project OpenAM by OpenRock.
the class AuthPropertiesModelImpl method removeAuthInstance.
public void removeAuthInstance(Set names) throws AMConsoleException {
StringBuilder errorList = new StringBuilder();
String message = null;
try {
String[] params = new String[2];
params[0] = currentRealm;
AMAuthenticationManager mgr = new AMAuthenticationManager(getUserSSOToken(), currentRealm);
for (Iterator i = names.iterator(); i.hasNext(); ) {
String instance = (String) i.next();
params[1] = instance;
logEvent("ATTEMPT_REMOVE_AUTH_INSTANCE", params);
try {
mgr.deleteAuthenticationInstance(instance);
logEvent("SUCCEED_REMOVE_AUTH_INSTANCE", params);
} catch (AMConfigurationException e) {
String strError = getErrorString(e);
String[] paramsEx = { currentRealm, instance, strError };
logEvent("AUTH_CONFIG_EXCEPTION_REMOVE_AUTH_INSTANCE", paramsEx);
debug.warning("failed to delete", e);
message = e.getMessage();
if (errorList.length() > 0) {
errorList.append(", ");
}
errorList.append(instance);
}
}
} catch (AMConfigurationException ace) {
String strError = getErrorString(ace);
String[] paramsEx = { currentRealm, "*", strError };
logEvent("AUTH_CONFIG_EXCEPTION_REMOVE_AUTH_INSTANCE", paramsEx);
debug.error("cant delete auth instance: ", ace);
throw new AMConsoleException(strError);
}
if (errorList.length() > 0) {
String[] tmp = { errorList.toString(), message };
throw new AMConsoleException(MessageFormat.format(getLocalizedString("authentication.instance.delete.failed"), (Object[]) tmp));
}
}
use of com.sun.identity.authentication.config.AMConfigurationException in project OpenAM by OpenRock.
the class AuthPropertiesModelImpl method getAuthTypes.
public Map getAuthTypes() {
Map authAndLocalizedTypes = Collections.EMPTY_MAP;
try {
logEvent("ATTEMPT_GET_AUTH_TYPE", getServerInstanceForLogMsg());
AMAuthenticationManager mgr = new AMAuthenticationManager(getUserSSOToken(), "/");
Set types = mgr.getAuthenticationTypes();
authAndLocalizedTypes = new HashMap(types.size());
for (Iterator iter = types.iterator(); iter.hasNext(); ) {
String authType = (String) iter.next();
AMAuthenticationSchema schema = mgr.getAuthenticationSchema(authType);
String svcName = schema.getServiceName();
String localizedName = (svcName != null && svcName.length() > 0) ? getLocalizedServiceName(svcName) : authType;
authAndLocalizedTypes.put(authType, localizedName);
}
logEvent("SUCCEED_GET_AUTH_TYPE", getServerInstanceForLogMsg());
} catch (AMConfigurationException e) {
String strError = getErrorString(e);
String[] paramEx = { strError };
logEvent("SMS_EXCEPTION_GET_AUTH_TYPE", paramEx);
debug.warning("AuthPropertiesModelImpl.getAuthTypes", e);
}
return authAndLocalizedTypes;
}
use of com.sun.identity.authentication.config.AMConfigurationException in project OpenAM by OpenRock.
the class AuthConfigurationModelImpl method createAuthConfiguration.
/**
* Creates a new named authentication configuration object. This object
* will be used by the various objects for authentication.
*
* @param name used to reference the configuration.
* @throws AMConsoleException if the configuration cannot be created.
*/
public void createAuthConfiguration(String name) throws AMConsoleException {
if ((name == null) || (name.length() == 0)) {
throw new AMConsoleException(getLocalizedString("authentication.config.missing.name"));
}
String[] params = { currentRealm, name };
logEvent("ATTEMPT_CREATE_AUTH_CONFIG", params);
String errorMsg = null;
try {
AMAuthConfigUtils.createNamedConfig(name, 0, new HashMap(), currentRealm, getUserSSOToken());
logEvent("SUCCEED_CREATE_AUTH_CONFIG", params);
} catch (SMSException e) {
errorMsg = getErrorString(e);
String[] paramsEx = { currentRealm, name, errorMsg };
logEvent("SMS_EXCEPTION_CREATE_AUTH_CONFIG", paramsEx);
debug.warning("problem creating auth instance", e);
} catch (SSOException e) {
errorMsg = getErrorString(e);
String[] paramsEx = { currentRealm, name, errorMsg };
logEvent("SSO_EXCEPTION_CREATE_AUTH_CONFIG", paramsEx);
debug.warning("problem creating auth instance", e);
} catch (AMConfigurationException e) {
errorMsg = getErrorString(e);
String[] paramsEx = { currentRealm, name, errorMsg };
logEvent("AUTH_CONFIGURATION_EXCEPTION_CREATE_AUTH_CONFIG", paramsEx);
debug.warning("problem creating auth instance", e);
}
// pass the error message back to the view bean...
if (errorMsg != null) {
throw new AMConsoleException(errorMsg);
}
}
use of com.sun.identity.authentication.config.AMConfigurationException in project OpenAM by OpenRock.
the class AuthPropertiesModelImpl method setInstanceValues.
public void setInstanceValues(String instance, Map values) throws AMConsoleException {
String[] params = { currentRealm, instance };
logEvent("ATTEMPT_MODIFY_AUTH_INSTANCE_PROFILE", params);
try {
AMAuthenticationManager mgr = new AMAuthenticationManager(getUserSSOToken(), currentRealm);
AMAuthenticationInstance ai = mgr.getAuthenticationInstance(instance);
ai.setAttributeValues(values);
logEvent("SUCCEED_MODIFY_AUTH_INSTANCE_PROFILE", params);
} catch (AMConfigurationException e) {
debug.warning("AuthPropertiesModelImpl.setInstanceValues", e);
String strError = getErrorString(e);
String[] paramsEx = { currentRealm, instance, strError };
logEvent("AUTH_CONFIGURATION_EXCEPTION_MODIFY_AUTH_INSTANCE_PROFILE", paramsEx);
throw new AMConsoleException(strError);
} catch (SMSException e) {
debug.warning("AuthPropertiesModelImpl.setInstanceValues", e);
String strError = getErrorString(e);
String[] paramsEx = { currentRealm, instance, strError };
logEvent("SMS_EXCEPTION_MODIFY_AUTH_INSTANCE_PROFILE", paramsEx);
throw new AMConsoleException(strError);
} catch (SSOException e) {
debug.warning("AuthPropertiesModelImpl.setInstanceValues", e);
String strError = getErrorString(e);
String[] paramsEx = { currentRealm, instance, strError };
logEvent("SSO_EXCEPTION_MODIFY_AUTH_INSTANCE_PROFILE", paramsEx);
throw new AMConsoleException(strError);
}
}
Aggregations