use of com.sun.identity.authentication.config.AMAuthenticationManager in project OpenAM by OpenRock.
the class AddAuthConfigurationEntry method getInstanceNames.
private Set getInstanceNames(String realm, SSOToken adminSSOToken) throws AMConfigurationException {
Set names = new HashSet();
AMAuthenticationManager mgr = new AMAuthenticationManager(adminSSOToken, realm);
Set instances = mgr.getAuthenticationInstances();
for (Iterator i = instances.iterator(); i.hasNext(); ) {
AMAuthenticationInstance instance = (AMAuthenticationInstance) i.next();
names.add(instance.getName());
}
return names;
}
use of com.sun.identity.authentication.config.AMAuthenticationManager in project OpenAM by OpenRock.
the class GetSupportedAuthModules method handleRequest.
/**
* Services a Commandline Request.
*
* @param rc Request Context.
* @throws CLIException if the request cannot serviced.
*/
public void handleRequest(RequestContext rc) throws CLIException {
super.handleRequest(rc);
ldapLogin();
SSOToken adminSSOToken = getAdminSSOToken();
IOutput outputWriter = getOutputWriter();
String[] params = {};
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_GET_SUPPORTED_AUTH_MODULES", params);
try {
AMAuthenticationManager mgr = new AMAuthenticationManager(adminSSOToken, "/");
Set types = mgr.getAuthenticationTypes();
if ((types != null) && !types.isEmpty()) {
Set sorted = new TreeSet();
sorted.addAll(types);
for (Iterator iter = sorted.iterator(); iter.hasNext(); ) {
String type = (String) iter.next();
outputWriter.printlnMessage(type);
}
} else {
outputWriter.printlnMessage(getResourceString("get-supported-no-supported-authtype"));
}
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEED_GET_SUPPORTED_AUTH_MODULES", params);
} catch (AMConfigurationException e) {
String[] args = { e.getMessage() };
debugError("GetSupportedAuthModules.handleRequest", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_GET_SUPPORTED_AUTH_MODULES", args);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
}
}
use of com.sun.identity.authentication.config.AMAuthenticationManager in project OpenAM by OpenRock.
the class AMAuthUtils method addModInstanceNames.
private static void addModInstanceNames(String realmName, String moduleType, List modInstances) {
try {
SSOToken adminToken = (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance());
AMAuthenticationManager amAM = new AMAuthenticationManager(adminToken, realmName);
Set instanceNames = amAM.getModuleInstanceNames(moduleType);
modInstances.addAll(instanceNames);
} catch (AMConfigurationException exp) {
utilDebug.error("AMAuthUtils.addModInstanceNames: Error while" + " trying to get auth module instance names " + "for auth type" + moduleType);
}
}
use of com.sun.identity.authentication.config.AMAuthenticationManager in project OpenAM by OpenRock.
the class ServicesModelImpl method getAssignedServiceNames.
/**
* Returns a map of assigned service name to its localized name under a
* realm.
*
* @param realmName Name of Realm.
* @return a map of assigned service name to its localized name under a
* realm.
* @throws AMConsoleException if service names cannot be obtained.
*/
public Map getAssignedServiceNames(String realmName) throws AMConsoleException {
String[] param = { realmName };
logEvent("ATTEMPT_GET_ASSIGNED_SERVICE_OF_REALM", param);
try {
OrganizationConfigManager orgCfgMgr = new OrganizationConfigManager(getUserSSOToken(), realmName);
Set names = orgCfgMgr.getAssignedServices();
if ((names == null) || names.isEmpty()) {
names = new HashSet();
}
getIdentityServices(realmName, names);
/*
* Need to use adminSSOToken because policy admin does not
* have the correct privileges.
*/
AMAuthenticationManager mgr = new AMAuthenticationManager(adminSSOToken, realmName);
AMAdminUtils.removeAllCaseIgnore(names, mgr.getAuthenticationServiceNames());
removeNonDisplayableServices(names, SUPPORTED_SCHEMA_TYPE);
// remove auth configuration service too
names.remove(AMAdminConstants.AUTH_CONFIG_SERVICE);
names.remove(AMAdminConstants.CORE_AUTH_SERVICE);
/*
Creation and edit of instances of the Rest/Soap STS services handled by the STS tab.
*/
names.remove(AMAdminConstants.REST_STS_SERVICE);
names.remove(AMAdminConstants.SOAP_STS_SERVICE);
logEvent("SUCCEED_GET_ASSIGNED_SERVICE_OF_REALM", param);
return mapNameToDisplayName(names);
} catch (AMConfigurationException e) {
String strError = getErrorString(e);
String[] paramsEx = { realmName, strError };
logEvent("CONFIGURATION_EXCEPTION_GET_ASSIGNED_SERVICE_OF_REALM", paramsEx);
throw new AMConsoleException(strError);
} catch (SMSException e) {
String strError = getErrorString(e);
String[] paramsEx = { realmName, strError };
logEvent("SMS_EXCEPTION_GET_ASSIGNED_SERVICE_OF_REALM", paramsEx);
throw new AMConsoleException(strError);
}
}
use of com.sun.identity.authentication.config.AMAuthenticationManager in project OpenAM by OpenRock.
the class ServicesModelImpl method getAssignableServiceNames.
/**
* Returns a map of service name to its display name that can be assigned
* to a realm.
*
* @param realmName Name of Realm.
* @return a map of service name to its display name that can be assigned
* to a realm.
* @throws AMConsoleException if service names cannot be obtained.
*/
public Map getAssignableServiceNames(String realmName) throws AMConsoleException {
String[] param = { realmName };
logEvent("ATTEMPT_GET_ASSIGNABLE_SERVICE_OF_REALM", param);
try {
OrganizationConfigManager orgCfgMgr = new OrganizationConfigManager(getUserSSOToken(), realmName);
Set names = orgCfgMgr.getAssignableServices();
addIdentityUnassignedServices(realmName, names);
names.removeAll(orgCfgMgr.getAssignedServices());
AMAuthenticationManager mgr = new AMAuthenticationManager(getUserSSOToken(), realmName);
AMAdminUtils.removeAllCaseIgnore(names, mgr.getAuthenticationServiceNames());
removeNonDisplayableServices(names, SUPPORTED_SCHEMA_TYPE);
names.remove(AMAdminConstants.CORE_AUTH_SERVICE);
/*
Creation and edit of instances of the Rest/Soap STS services handled by the STS tab.
*/
names.remove(AMAdminConstants.REST_STS_SERVICE);
names.remove(AMAdminConstants.SOAP_STS_SERVICE);
logEvent("SUCCEED_GET_ASSIGNABLE_SERVICE_OF_REALM", param);
return mapNameToDisplayName(names);
} catch (AMConfigurationException e) {
String strError = getErrorString(e);
String[] paramsEx = { realmName, strError };
logEvent("CONFIGURATION_EXCEPTION_GET_ASSIGNABLE_SERVICE_OF_REALM", paramsEx);
if (debug.warningEnabled()) {
debug.warning("ServicesModel.getAssignableServiceNames " + strError);
}
throw new AMConsoleException("no.properties");
} catch (SMSException e) {
String strError = getErrorString(e);
String[] paramsEx = { realmName, strError };
logEvent("SMS_EXCEPTION_GET_ASSIGNABLE_SERVICE_OF_REALM", paramsEx);
throw new AMConsoleException(strError);
}
}
Aggregations