Search in sources :

Example 21 with CCActionTableModel

use of com.sun.web.ui.model.CCActionTableModel in project OpenAM by OpenRock.

the class FederationViewBean method handleDeleteCOTButtonRequest.

public void handleDeleteCOTButtonRequest(RequestInvocationEvent event) throws ModelControlException {
    CCActionTable tbl = (CCActionTable) getChild(COT_TABLE);
    tbl.restoreStateData();
    CCActionTableModel tableModel = (CCActionTableModel) propertySheetModel.getModel(COT_TABLE);
    // get selected rows
    Integer[] selected = tableModel.getSelectedRows();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    List list = (List) szCache.getSerializedObj();
    FSAuthDomainsModel model = (FSAuthDomainsModel) getModel();
    StringBuilder deletedNames = new StringBuilder();
    StringBuilder cannotDeleteds = new StringBuilder();
    // each COT is deleted separately as they can be in separate realms
    for (int i = 0; i < selected.length; i++) {
        String str = (String) list.get(selected[i].intValue());
        int pipeIndex = str.indexOf(",");
        String name = str.substring(0, pipeIndex);
        String realm = str.substring(pipeIndex + 1);
        try {
            model.deleteAuthenticationDomain(realm, name);
            if (deletedNames.length() > 0) {
                deletedNames.append(", ");
            }
            deletedNames.append(name);
        } catch (AMConsoleException e) {
            if (cannotDeleteds.length() > 0) {
                cannotDeleteds.append(", ");
            }
            cannotDeleteds.append(e.getMessage());
        }
    }
    StringBuilder message = new StringBuilder();
    if (deletedNames.length() > 0) {
        Object[] params = { deletedNames };
        message.append(MessageFormat.format(model.getLocalizedString("authDomain.message.deleted"), params));
    }
    if (cannotDeleteds.length() > 0) {
        Object[] params = { cannotDeleteds };
        message.append(MessageFormat.format(model.getLocalizedString("generic.error.message"), params));
    }
    if (message.length() > 0) {
        setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", message.toString());
    }
    forwardTo();
}
Also used : CCActionTableModel(com.sun.web.ui.model.CCActionTableModel) FSAuthDomainsModel(com.sun.identity.console.federation.model.FSAuthDomainsModel) CCActionTable(com.sun.web.ui.view.table.CCActionTable) SerializedField(com.sun.identity.console.components.view.html.SerializedField) ArrayList(java.util.ArrayList) OptionList(com.iplanet.jato.view.html.OptionList) List(java.util.List) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 22 with CCActionTableModel

use of com.sun.web.ui.model.CCActionTableModel in project OpenAM by OpenRock.

the class FederationViewBean method populateSAMLTable.

private void populateSAMLTable() {
    tablePopulated = true;
    FSSAMLServiceModel model = (FSSAMLServiceModel) getSAMLModel();
    Map attrValues = model.getAttributeValues();
    CCActionTableModel tblModel = (CCActionTableModel) propertySheetModel.getModel(SAML_TABLE);
    tblModel.clearAll();
    removePageSessionAttribute(SAML_TABLE_ATTRIBUTE);
    List cache = new ArrayList();
    for (Iterator iter = attrValues.keySet().iterator(); iter.hasNext(); ) {
        String name = (String) iter.next();
        Set values = (Set) attrValues.get(name);
        if (name.equals(TABLE_TRUSTED_PARTNERS)) {
            AMPipeDelimitAttrTokenizer tokenizer = AMPipeDelimitAttrTokenizer.getInstance();
            boolean firstEntry = true;
            int counter = 0;
            for (Iterator iter2 = values.iterator(); iter2.hasNext(); ) {
                if (!firstEntry) {
                    tblModel.appendRow();
                } else {
                    firstEntry = false;
                }
                String tokenizedValue = (String) iter2.next();
                Map map = AMAdminUtils.upCaseKeys(tokenizer.tokenizes(tokenizedValue));
                String partnerName = (String) map.get(SAMLConstants.PARTNERNAME);
                if (partnerName == null) {
                    partnerName = (String) map.get(SAMLConstants.SOURCEID);
                }
                tblModel.setValue(SAML_TRUSTED_PARTNER_VALUE, partnerName);
                tblModel.setValue(SAML_TRUSTED_PARTNER_HREF, Integer.toString(counter++));
                cache.add(tokenizedValue);
                // get trusted partner type
                SAMLPropertyXMLBuilder builder = SAMLPropertyXMLBuilder.getInstance();
                List profiles = (ArrayList) builder.getSAMLProperties(map);
                StringBuffer trustedPartnerSourceType = new StringBuffer();
                StringBuffer trustedPartnerDestinationType = new StringBuffer();
                int size = profiles.size();
                for (int i = 0; i < size; i++) {
                    if (((SAMLProperty) profiles.get(i)).getRole().equals("destination")) {
                        if (trustedPartnerDestinationType.length() != 0) {
                            trustedPartnerDestinationType.append(", ");
                        }
                        trustedPartnerDestinationType.append(getTrustedPartnersSelectType(((SAMLProperty) profiles.get(i)).getBindMethod()));
                    } else {
                        // source
                        if (trustedPartnerSourceType.length() != 0) {
                            trustedPartnerSourceType.append(", ");
                        }
                        trustedPartnerSourceType.append(getTrustedPartnersSelectType(((SAMLProperty) profiles.get(i)).getBindMethod()));
                    }
                }
                tblModel.setValue(SAML_TRUSTED_PARTNER_DESTINATION_TYPE, trustedPartnerDestinationType.toString());
                tblModel.setValue(SAML_TRUSTED_PARTNER_SOURCE_TYPE, trustedPartnerSourceType.toString());
            }
            break;
        }
    }
    setPageSessionAttribute(SAML_TABLE_ATTRIBUTE, (ArrayList) cache);
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) CCActionTableModel(com.sun.web.ui.model.CCActionTableModel) ArrayList(java.util.ArrayList) AMPipeDelimitAttrTokenizer(com.sun.identity.console.base.AMPipeDelimitAttrTokenizer) Iterator(java.util.Iterator) FSSAMLServiceModel(com.sun.identity.console.federation.model.FSSAMLServiceModel) ArrayList(java.util.ArrayList) OptionList(com.iplanet.jato.view.html.OptionList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map)

Example 23 with CCActionTableModel

use of com.sun.web.ui.model.CCActionTableModel in project OpenAM by OpenRock.

the class FederationViewBean method populateEntityTable.

private void populateEntityTable() {
    tablePopulated = true;
    CCActionTableModel tableModel = (CCActionTableModel) propertySheetModel.getModel(ENTITY_TABLE);
    tableModel.clearAll();
    boolean firstRow = true;
    EntityModel eModel = getEntityModel();
    Map entities = Collections.EMPTY_MAP;
    List entityList = new ArrayList();
    try {
        entities = eModel.getSAMLv2Entities();
        if (!entities.isEmpty()) {
            addRows(entities, eModel, tableModel, firstRow, entityList);
            firstRow = false;
        }
        entities.clear();
        entities = eModel.getIDFFEntities();
        if (!entities.isEmpty()) {
            addRows(entities, eModel, tableModel, firstRow, entityList);
            firstRow = false;
        }
        entities.clear();
        entities = eModel.getWSFedEntities();
        if (!entities.isEmpty()) {
            addRows(entities, eModel, tableModel, firstRow, entityList);
            firstRow = false;
        }
        // set the instances in the page session so when a request comes
        // in we can prepopulate the table model.
        setPageSessionAttribute(ENTITY_TABLE, (Serializable) entityList);
    } catch (AMConsoleException e) {
        debug.error("FederationViewBean.populateEntityTable", e);
        return;
    }
}
Also used : CCActionTableModel(com.sun.web.ui.model.CCActionTableModel) EntityModel(com.sun.identity.console.federation.model.EntityModel) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) OptionList(com.iplanet.jato.view.html.OptionList) List(java.util.List) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map)

Example 24 with CCActionTableModel

use of com.sun.web.ui.model.CCActionTableModel in project OpenAM by OpenRock.

the class FederationViewBean method populateCOTTable.

private void populateCOTTable() {
    tablePopulated = true;
    FSAuthDomainsModel model = (FSAuthDomainsModel) getModel();
    Set circleOfTrustDescriptors = model.getCircleOfTrustDescriptors();
    CCActionTableModel tableModel = (CCActionTableModel) propertySheetModel.getModel(COT_TABLE);
    tableModel.clearAll();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    if ((circleOfTrustDescriptors != null) && (!circleOfTrustDescriptors.isEmpty())) {
        List cache = new ArrayList(circleOfTrustDescriptors.size());
        boolean first = true;
        for (Iterator iter = circleOfTrustDescriptors.iterator(); iter.hasNext(); ) {
            if (first) {
                first = false;
            } else {
                tableModel.appendRow();
            }
            CircleOfTrustDescriptor desc = (CircleOfTrustDescriptor) iter.next();
            String name = desc.getCircleOfTrustName();
            tableModel.setValue(COT_NAME_VALUE, name);
            tableModel.setValue(COT_NAME_HREF, stringToHex(name));
            // get entity/provider name
            Set entitySet = desc.getTrustedProviders();
            if ((entitySet != null) && (!entitySet.isEmpty())) {
                Iterator it = entitySet.iterator();
                StringBuffer sb = new StringBuffer();
                Encoder encoder = ESAPI.encoder();
                while (it.hasNext()) {
                    String entity = (String) it.next();
                    sb.append(encoder.encodeForHTML(entity)).append("<br>");
                }
                tableModel.setValue(COT_ENTITY_VALUE, sb.toString());
            } else {
                tableModel.setValue(COT_ENTITY_VALUE, "");
            }
            // get realm name
            String realm = desc.getCircleOfTrustRealm();
            tableModel.setValue(COT_REALM_VALUE, realm);
            // get cot status
            String status = desc.getCircleOfTrustStatus();
            if ((status != null) && status.equals("active")) {
                tableModel.setValue(COT_STATUS_VALUE, "label.active");
            } else {
                tableModel.setValue(COT_STATUS_VALUE, "label.inactive");
            }
            cache.add(name + "," + realm);
        }
        szCache.setValue((ArrayList) cache);
    } else {
        szCache.setValue(null);
    }
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) CCActionTableModel(com.sun.web.ui.model.CCActionTableModel) SerializedField(com.sun.identity.console.components.view.html.SerializedField) Encoder(org.owasp.esapi.Encoder) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) FSAuthDomainsModel(com.sun.identity.console.federation.model.FSAuthDomainsModel) ArrayList(java.util.ArrayList) OptionList(com.iplanet.jato.view.html.OptionList) List(java.util.List) CircleOfTrustDescriptor(com.sun.identity.cot.CircleOfTrustDescriptor)

Example 25 with CCActionTableModel

use of com.sun.web.ui.model.CCActionTableModel in project OpenAM by OpenRock.

the class IDFFSPViewBean method createAuthContextsModel.

private void createAuthContextsModel() {
    tblAuthContextsModel = new CCActionTableModel(getClass().getClassLoader().getResourceAsStream("com/sun/identity/console/tblIDFFSPAuthenticationContext.xml"));
    tblAuthContextsModel.setTitleLabel("label.items");
    tblAuthContextsModel.setActionValue(TBL_COL_SUPPORTED, "idff.sp.authenticationContext.table.name.supported.name");
    tblAuthContextsModel.setActionValue(TBL_COL_CONTEXT_REFERENCE, "idff.sp.authenticationContext.table.name.contextReference.name");
    tblAuthContextsModel.setActionValue(TBL_COL_LEVEL, "idff.sp.authenticationContext.table.name.level.name");
}
Also used : CCActionTableModel(com.sun.web.ui.model.CCActionTableModel)

Aggregations

CCActionTableModel (com.sun.web.ui.model.CCActionTableModel)103 CCActionTable (com.sun.web.ui.view.table.CCActionTable)22 OrderedSet (com.sun.identity.shared.datastruct.OrderedSet)18 Iterator (java.util.Iterator)18 List (java.util.List)14 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)13 ArrayList (java.util.ArrayList)12 HashSet (java.util.HashSet)9 Set (java.util.Set)9 SerializedField (com.sun.identity.console.components.view.html.SerializedField)8 OptionList (com.iplanet.jato.view.html.OptionList)6 SMSubConfig (com.sun.identity.console.base.model.SMSubConfig)6 HashMap (java.util.HashMap)5 Map (java.util.Map)5 SCConfigModel (com.sun.identity.console.service.model.SCConfigModel)4 AuthPropertiesModel (com.sun.identity.console.authentication.model.AuthPropertiesModel)3 EntityModel (com.sun.identity.console.federation.model.EntityModel)2 FSAuthDomainsModel (com.sun.identity.console.federation.model.FSAuthDomainsModel)2 FSSAMLServiceModel (com.sun.identity.console.federation.model.FSSAMLServiceModel)2 SMDiscoEntryData (com.sun.identity.console.service.model.SMDiscoEntryData)2