use of com.sun.identity.authentication.config.AuthConfigurationEntry in project OpenAM by OpenRock.
the class AuthConfigurationModelImpl method getModuleFlag.
/**
* Gets the module flag for the given module index in the current
* authentication configuration attributes
*
* @param idx the index of the module to retrieve Flag from.
* @return the module flag
*/
public String getModuleFlag(int idx) {
String flag = null;
AuthConfigurationEntry entry = (AuthConfigurationEntry) entryList.get(idx);
if (entry != null) {
flag = entry.getControlFlag();
}
return flag;
}
use of com.sun.identity.authentication.config.AuthConfigurationEntry in project OpenAM by OpenRock.
the class UpdateAuthConfigurationEntries method getAuthConfigurationEntry.
private AuthConfigurationEntry getAuthConfigurationEntry(CommandManager mgr, String str) throws CLIException, AMConfigurationException {
System.out.println(str);
StringTokenizer st = new StringTokenizer(str, "|");
if (st.countTokens() < 2) {
throw AttributeValues.createIncorrectFormatException(mgr, str);
}
String name = st.nextToken();
String flag = st.nextToken();
String options = (st.countTokens() > 0) ? st.nextToken() : null;
return new AuthConfigurationEntry(name, flag, options);
}
use of com.sun.identity.authentication.config.AuthConfigurationEntry in project OpenAM by OpenRock.
the class AuthConfigViewBean method getTableData.
private List getTableData() throws ModelControlException {
List entryList = new ArrayList();
CCActionTable table = (CCActionTable) getChild(AUTH_ENTRY_TABLE);
table.restoreStateData();
int size = entryTableModel.getNumRows();
for (int i = 0; i < size; i++) {
entryTableModel.setRowIndex(i);
String module = (String) entryTableModel.getValue(MODULE_NAME);
String flag = (String) entryTableModel.getValue(CRITERIA);
String option = (String) entryTableModel.getValue(OPTION_FIELD);
try {
AuthConfigurationEntry ae = new AuthConfigurationEntry(module, flag, option);
entryList.add(ae);
} catch (AMConfigurationException e) {
debug.warning("AuthConfigViewBean.getTableData() " + "Couldn't create the auth configuration entry", e);
}
}
return entryList;
}
use of com.sun.identity.authentication.config.AuthConfigurationEntry in project OpenAM by OpenRock.
the class AuthConfigViewBean method handleAddEntryButtonRequest.
/**
* Handles add auth instances request.
*
* @param event Request invocation event
*/
public void handleAddEntryButtonRequest(RequestInvocationEvent event) throws ModelControlException {
// get the current values from the table so we don't
// overwrite any changes already made by the user.
List currentEntries = getTableData();
// create a new entry, add it to the list, and generat the xml
// use the first entry from the available instances list as default
Iterator i = getInstanceNames().iterator();
String moduleName = (String) i.next();
try {
AuthConfigurationEntry ace = new AuthConfigurationEntry(moduleName, REQUIRED_FLAG, "");
currentEntries.add(ace);
acModel.setEntries(currentEntries);
setPageSessionAttribute(ENTRY_LIST, acModel.getXMLValue(getRealmName(), getConfigName()));
} catch (AMConfigurationException a) {
debug.warning("AuthConfigViewBean.handleAddEntryButtonRequest() " + "Adding new config entry failed", a);
}
cacheValues();
populateEntryTable();
forwardTo();
}
use of com.sun.identity.authentication.config.AuthConfigurationEntry in project OpenAM by OpenRock.
the class GetAuthConfigurationEntries method handleRequest.
/**
* Handles request.
*
* @param rc Request Context.
* @throws CLIException if request cannot be processed.
*/
public void handleRequest(RequestContext rc) throws CLIException {
super.handleRequest(rc);
ldapLogin();
SSOToken adminSSOToken = getAdminSSOToken();
String realm = getStringOptionValue(IArgument.REALM_NAME);
String configName = getStringOptionValue(AuthOptions.AUTH_CONFIG_NAME);
String[] params = { realm, configName };
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_GET_AUTH_CONFIG_ENTRIES", params);
try {
Map configData = AMAuthConfigUtils.getNamedConfig(configName, realm, adminSSOToken);
IOutput outputWriter = getOutputWriter();
boolean hasData = false;
if ((configData != null) && !configData.isEmpty()) {
Set tmp = (Set) configData.get(AuthOptions.AUTH_CONFIG_ATTR);
if ((tmp != null) && !tmp.isEmpty()) {
hasData = true;
String xml = (String) tmp.iterator().next();
List entryList = new ArrayList(AMAuthConfigUtils.xmlToAuthConfigurationEntry(xml));
outputWriter.printlnMessage(getResourceString("authentication-get-auth-config-entries-succeeded"));
for (Iterator i = entryList.iterator(); i.hasNext(); ) {
AuthConfigurationEntry e = (AuthConfigurationEntry) i.next();
String options = e.getOptions();
if (options == null) {
options = "";
}
Object[] args = { e.getLoginModuleName(), e.getControlFlag(), options };
outputWriter.printlnMessage(MessageFormat.format(getResourceString("authentication-get-auth-config-entries-entry"), args));
}
}
} else {
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_GET_AUTH_CONFIG_ENTRIES", params);
throw new CLIException(getResourceString("authentication-get-auth-config-entries-not-found"), ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
}
if (!hasData) {
outputWriter.printlnMessage(getResourceString("authentication-get-auth-config-entries-no-values"));
}
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEEDED_GET_AUTH_CONFIG_ENTRIES", params);
} catch (AMConfigurationException e) {
debugError("GetAuthConfigurationEntries.handleRequest", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_GET_AUTH_CONFIG_ENTRIES", params);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
} catch (SMSException e) {
debugError("GetAuthConfigurationEntries.handleRequest", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_GET_AUTH_CONFIG_ENTRIES", params);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
} catch (SSOException e) {
debugError("GetAuthConfigurationEntries.handleRequest", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_GET_AUTH_CONFIG_ENTRIES", params);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
}
}
Aggregations