Search in sources :

Example 1 with AuthConfigurationModel

use of com.sun.identity.console.authentication.model.AuthConfigurationModel in project OpenAM by OpenRock.

the class AuthConfigViewBean method cacheValues.

private void cacheValues() throws ModelControlException {
    AuthConfigurationModel acModel = (AuthConfigurationModel) getModel();
    try {
        Map original = acModel.getValues();
        AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
        Map changedValues = (Map) ps.getAttributeValues(original, true, acModel);
        original.putAll(changedValues);
        setPageSessionAttribute(ReorderAuthChainsViewBean.PG_SESSION_TRACKING, (HashMap) changedValues);
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        forwardTo();
    }
}
Also used : AuthConfigurationModel(com.sun.identity.console.authentication.model.AuthConfigurationModel) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with AuthConfigurationModel

use of com.sun.identity.console.authentication.model.AuthConfigurationModel in project OpenAM by OpenRock.

the class AuthPropertiesViewBean method handleDeleteConfigButtonRequest.

/**
     * Handles the delete authentication instance request.
     *
     * @param event Request Invocation Event.
     */
public void handleDeleteConfigButtonRequest(RequestInvocationEvent event) throws ModelControlException {
    CCActionTable table = (CCActionTable) getChild(AUTH_CONFIG_TABLE);
    table.restoreStateData();
    CCActionTableModel tableModel = (CCActionTableModel) propertySheetModel.getModel(AUTH_CONFIG_TABLE);
    Integer[] selected = tableModel.getSelectedRows();
    Set configurations = new HashSet(selected.length * 2);
    for (int i = 0; i < selected.length; i++) {
        tableModel.setRowIndex(selected[i].intValue());
        configurations.add((String) tableModel.getValue(CONFIG_NAME_COLUMN_DATA));
    }
    try {
        AuthConfigurationModel m = (AuthConfigurationModel) getConfigModel();
        String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        if ((curRealm == null) || (curRealm.length() == 0)) {
            curRealm = AMModelBase.getStartDN(getRequestContext().getRequest());
        }
        m.deleteAuthConfiguration(curRealm, configurations);
        if (selected.length == 1) {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "authentication.config.deleted");
        } else {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "authentication.config.deleted.multiple");
        }
        removePageSessionAttribute(AUTH_CONFIG_TABLE);
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    forwardTo();
}
Also used : AuthConfigurationModel(com.sun.identity.console.authentication.model.AuthConfigurationModel) HashSet(java.util.HashSet) Set(java.util.Set) OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) CCActionTableModel(com.sun.web.ui.model.CCActionTableModel) CCActionTable(com.sun.web.ui.view.table.CCActionTable) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashSet(java.util.HashSet)

Example 3 with AuthConfigurationModel

use of com.sun.identity.console.authentication.model.AuthConfigurationModel in project OpenAM by OpenRock.

the class AuthConfigViewBean method showInvalidSet.

public void showInvalidSet() {
    Set invalidSet = new HashSet();
    Set validSet = new HashSet();
    List list = getInstanceNames();
    if ((list != null) && !list.isEmpty()) {
        validSet.addAll(list);
    }
    AuthConfigurationModel model = (AuthConfigurationModel) getModel();
    int size = model.getNumberEntries();
    for (int i = 0; i < size; i++) {
        String module = model.getModuleName(i);
        if (!validSet.contains(module)) {
            invalidSet.add(module);
        }
    }
    if (!invalidSet.isEmpty()) {
        StringBuilder buff = new StringBuilder();
        boolean bFirst = true;
        for (Iterator i = invalidSet.iterator(); i.hasNext(); ) {
            if (bFirst) {
                bFirst = false;
            } else {
                buff.append(", ");
            }
            buff.append((String) i.next());
        }
        Object[] params = { buff.toString() };
        String msg = (invalidSet.size() > 1) ? "authentication.instance.invalids" : "authentication.instance.invalid";
        setInlineAlertMessage(CCAlert.TYPE_WARNING, "message.warning", MessageFormat.format(model.getLocalizedString(msg), params));
    }
}
Also used : AuthConfigurationModel(com.sun.identity.console.authentication.model.AuthConfigurationModel) HashSet(java.util.HashSet) Set(java.util.Set) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) OptionList(com.iplanet.jato.view.html.OptionList) List(java.util.List) HashSet(java.util.HashSet)

Example 4 with AuthConfigurationModel

use of com.sun.identity.console.authentication.model.AuthConfigurationModel in project OpenAM by OpenRock.

the class AuthConfigViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    resetButtonState(REMOVE_ENTRY_BUTTON);
    acModel = (AuthConfigurationModel) getModel();
    // set the page title to include the auth config name
    String title = acModel.getLocalizedString("page.title.auth.config.edit");
    String[] param = { getConfigName() };
    ptModel.setPageTitleText(MessageFormat.format(title, (Object[]) param));
    AuthConfigurationModel model = (AuthConfigurationModel) getModel();
    if (model != null) {
        AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
        ps.setAttributeValues(getValues(model), model);
    }
    if (!tablePopulated) {
        populateEntryTable();
    }
    CCButton btnReorder = (CCButton) getChild(REORDER_ENTRY_BUTTON);
    btnReorder.setDisabled(model.getNumberEntries() < 2);
    if (getInstanceNames().isEmpty()) {
        CCButton btnAdd = (CCButton) getChild(ADD_ENTRY_BUTTON);
        btnAdd.setDisabled(true);
        setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "authentication.instance.list.empty");
    }
    showInvalidSet();
}
Also used : AuthConfigurationModel(com.sun.identity.console.authentication.model.AuthConfigurationModel) CCButton(com.sun.web.ui.view.html.CCButton) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet)

Aggregations

AuthConfigurationModel (com.sun.identity.console.authentication.model.AuthConfigurationModel)4 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)2 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 OptionList (com.iplanet.jato.view.html.OptionList)1 OrderedSet (com.sun.identity.shared.datastruct.OrderedSet)1 CCActionTableModel (com.sun.web.ui.model.CCActionTableModel)1 CCButton (com.sun.web.ui.view.html.CCButton)1 CCActionTable (com.sun.web.ui.view.table.CCActionTable)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Map (java.util.Map)1