Search in sources :

Example 1 with SAMLv2Model

use of com.sun.identity.console.federation.model.SAMLv2Model in project OpenAM by OpenRock.

the class SAMLv2AuthnAuthorityViewBean method getStandardAuthnAuthorityValues.

private Map getStandardAuthnAuthorityValues() {
    Map map = new HashMap();
    try {
        SAMLv2Model model = (SAMLv2Model) getModel();
        map = model.getStandardAuthnAuthorityAttributes(realm, entityName);
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    return map;
}
Also used : HashMap(java.util.HashMap) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map) SAMLv2Model(com.sun.identity.console.federation.model.SAMLv2Model)

Example 2 with SAMLv2Model

use of com.sun.identity.console.federation.model.SAMLv2Model in project OpenAM by OpenRock.

the class SAMLv2AuthnAuthorityViewBean method handleButton1Request.

public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
    try {
        SAMLv2Model model = (SAMLv2Model) getModel();
        AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTES);
        //retrieve the standard metadata values from the property sheet
        Map authnAuthValues = ps.getAttributeValues(model.getStandardAuthnAuthorityAttributes(realm, entityName), false, model);
        //save the standard metadata values for attribute authority
        model.setStdAuthnAuthorityValues(realm, entityName, authnAuthValues);
        //retrieve the extended metadata values from the property sheet
        Map authnAuthExtValues = ps.getAttributeValues(model.getauthnAuthEXDataMap(), false, model);
        //save the extended metadata values for attribute authority
        model.setExtauthnAuthValues(realm, entityName, authnAuthExtValues, location);
        setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "samlv2.authnauth.property.updated");
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    forwardTo();
}
Also used : AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) SAMLv2Model(com.sun.identity.console.federation.model.SAMLv2Model) HashMap(java.util.HashMap) Map(java.util.Map)

Example 3 with SAMLv2Model

use of com.sun.identity.console.federation.model.SAMLv2Model in project OpenAM by OpenRock.

the class SAMLv2IDPAdvancedViewBean method getExtendedValues.

private Map getExtendedValues() {
    Map extendedValues = new HashMap();
    try {
        //gets extended metadata values
        SAMLv2Model model = (SAMLv2Model) getModel();
        Map attr = model.getExtendedIdentityProviderAttributes(realm, entityName);
        Set entries = attr.entrySet();
        Iterator iterator = entries.iterator();
        //the list of values is converted to a set
        while (iterator.hasNext()) {
            Map.Entry entry = (Map.Entry) iterator.next();
            extendedValues.put((String) entry.getKey(), convertListToSet((List) entry.getValue()));
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    return extendedValues;
}
Also used : Set(java.util.Set) HashMap(java.util.HashMap) Iterator(java.util.Iterator) List(java.util.List) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map) SAMLv2Model(com.sun.identity.console.federation.model.SAMLv2Model)

Example 4 with SAMLv2Model

use of com.sun.identity.console.federation.model.SAMLv2Model in project OpenAM by OpenRock.

the class SAMLv2IDPAdvancedViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTIES);
    ps.init();
    SAMLv2Model model = (SAMLv2Model) getModel();
    //no attributes to show from std
    //get extended attributes
    ps.setAttributeValues(getExtendedValues(), model);
}
Also used : AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) SAMLv2Model(com.sun.identity.console.federation.model.SAMLv2Model)

Example 5 with SAMLv2Model

use of com.sun.identity.console.federation.model.SAMLv2Model in project OpenAM by OpenRock.

the class SAMLv2IDPAssertionContentViewBean method handleButton1Request.

public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
    try {
        SAMLv2Model model = (SAMLv2Model) getModel();
        AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTES);
        //retrieve the standard metadata values from the property sheet
        Map idpStdValues = ps.getAttributeValues(model.getStandardIdentityProviderAttributes(realm, entityName), false, model);
        //retrieve the extended metadata values from the property sheet
        Map idpExtValues = getExtendedValues();
        Map new_idpExtValues = ps.getAttributeValues(model.getIDPEXACDataMap(), false, model);
        // password fields are set to AMPropertySheetModel.passwordRandom before they are displayed to the user.
        if (new_idpExtValues.containsKey(SAMLv2Model.IDP_SIGN_CERT_KEYPASS)) {
            Set value = (Set) new_idpExtValues.get(SAMLv2Model.IDP_SIGN_CERT_KEYPASS);
            if (value != null && !value.isEmpty()) {
                String keyPass = (String) value.iterator().next();
                if (AMPropertySheetModel.passwordRandom.equals(keyPass)) {
                    // User did not change the password => remove fake value to avoid it overriding the stored value
                    new_idpExtValues.remove(SAMLv2Model.IDP_SIGN_CERT_KEYPASS);
                } else {
                    // The value has been updated
                    Set<String> encodedValue = new HashSet<String>(1);
                    // If the value is blank, don't encode
                    if (keyPass.isEmpty()) {
                        encodedValue.add(keyPass);
                    } else {
                        //Since it is plain text we need to encrypt it before storing
                        encodedValue.add(AccessController.doPrivileged(new EncodeAction(keyPass)));
                    }
                    new_idpExtValues.put(SAMLv2Model.IDP_SIGN_CERT_KEYPASS, encodedValue);
                }
            }
        }
        idpExtValues.putAll(new_idpExtValues);
        //save the standard metadata values for the Idp
        model.setIDPStdAttributeValues(realm, entityName, idpStdValues);
        //save the extended metadata values for the Idp
        model.setIDPExtAttributeValues(realm, entityName, idpExtValues, location);
        if (isHosted()) {
            //update Authentication Contexts
            model.updateIDPAuthenticationContexts(realm, entityName, getAuthenticationContexts());
            //save the encryption and signing info
            model.updateKeyinfo(realm, entityName, idpExtValues, idpStdValues, true);
        }
        setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "samlv2.idp.property.updated");
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    forwardTo();
}
Also used : EncodeAction(com.sun.identity.security.EncodeAction) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) SAMLv2Model(com.sun.identity.console.federation.model.SAMLv2Model)

Aggregations

SAMLv2Model (com.sun.identity.console.federation.model.SAMLv2Model)53 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)41 Map (java.util.Map)33 HashMap (java.util.HashMap)29 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)28 List (java.util.List)14 Set (java.util.Set)11 Iterator (java.util.Iterator)9 ArrayList (java.util.ArrayList)7 CCAddRemoveModel (com.sun.web.ui.model.CCAddRemoveModel)3 HashSet (java.util.HashSet)3 AssertionConsumerServiceElement (com.sun.identity.saml2.jaxb.metadata.AssertionConsumerServiceElement)2 AMPropertySheetModel (com.sun.identity.console.base.model.AMPropertySheetModel)1 EncodeAction (com.sun.identity.security.EncodeAction)1 CCAddRemove (com.sun.web.ui.view.addremove.CCAddRemove)1 CCActionTable (com.sun.web.ui.view.table.CCActionTable)1