use of com.sun.identity.console.federation.model.FSSAMLServiceModel 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);
}
use of com.sun.identity.console.federation.model.FSSAMLServiceModel in project OpenAM by OpenRock.
the class FSSAMLTrustedPartnersViewBeanBase method editEntry.
/**
* Edits an entry to the cache value in page session.
*
* @param values Map of attribute name to value.
* @throws AMConsoleException if there are duplicate entries.
*/
protected void editEntry(Map values) throws AMConsoleException {
List list = (List) getPageSessionAttribute("samlPropertyAttributes");
int index = Integer.parseInt((String) getPageSessionAttribute(PGATTR_INDEX));
String value = AMPipeDelimitAttrTokenizer.getInstance().deTokenizes(values);
int count = 0;
for (Iterator i = list.iterator(); i.hasNext(); ) {
String v = (String) i.next();
if ((count != index) && v.equals(value)) {
throw new AMConsoleException("saml.profile.trustedPartner.already.exists");
}
count++;
}
list.set(index, value);
Set set = new HashSet(list);
try {
FSSAMLServiceModel model = (FSSAMLServiceModel) getModel();
model.modifyTrustPartners(set);
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "saml.message.trusted.partner.updated");
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
forwardTo();
}
use of com.sun.identity.console.federation.model.FSSAMLServiceModel in project OpenAM by OpenRock.
the class FSSAMLTrustedPartnersAddViewBean method handleButton1Request.
protected void handleButton1Request(Map values) throws AMConsoleException {
String value = AMPipeDelimitAttrTokenizer.getInstance().deTokenizes(values);
// get the existing partners here
FSSAMLServiceModel model = (FSSAMLServiceModel) getModel();
Map attrValues = model.getAttributeValues();
Set partners = null;
Iterator iter = attrValues.keySet().iterator();
while (iter.hasNext()) {
String name = (String) iter.next();
if (name.equals("iplanet-am-saml-partner-urls")) {
partners = (Set) attrValues.get(name);
}
}
if ((partners == null) || partners.isEmpty()) {
partners = new HashSet();
}
// add new partner to existing partner set
partners.add(value);
Map map = new HashMap();
map.put("iplanet-am-saml-partner-urls", partners);
model.setAttributeValues(map);
forwardToFederationView();
}
use of com.sun.identity.console.federation.model.FSSAMLServiceModel in project OpenAM by OpenRock.
the class FSSAMLServiceViewBean method setValues.
void setValues() {
Map attrValues = (Map) getPageSessionAttribute(PROPERTY_ATTRIBUTE);
FSSAMLServiceModel model = (FSSAMLServiceModel) getModel();
if (attrValues == null) {
attrValues = model.getAttributeValues();
}
Map displayValues = new HashMap(attrValues.size() * 2);
// set tables
for (Iterator iter = attrValues.keySet().iterator(); iter.hasNext(); ) {
String name = (String) iter.next();
Set values = (Set) attrValues.get(name);
if (tabledAttributes.contains(name)) {
populateTable(name, values);
OrderedSet ordered = new OrderedSet();
ordered.addAll(values);
displayValues.put(name, ordered);
} else {
displayValues.put(name, values);
}
}
// set other attributes
AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
ps.setAttributeValues(attrValues, model);
setPageSessionAttribute(PROPERTY_ATTRIBUTE, (HashMap) displayValues);
}
use of com.sun.identity.console.federation.model.FSSAMLServiceModel in project OpenAM by OpenRock.
the class FSSAMLServiceViewBean method handleButton1Request.
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
FSSAMLServiceModel model = (FSSAMLServiceModel) getModel();
try {
model.setAttributeValues(getValues(true));
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "message.updated");
handleButton2Request(event);
} catch (AMConsoleException e) {
try {
setPageSessionAttribute(PROPERTY_ATTRIBUTE, (HashMap) getValues(false, false));
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
forwardTo();
} catch (AMConsoleException ex) {
/* exception will not be thrown because we are instructing
* AMPropertySheet to return values without doing password
* validation.
*/
}
}
}
Aggregations