Search in sources :

Example 16 with IDPSSOConfigElement

use of com.sun.identity.wsfederation.jaxb.entityconfig.IDPSSOConfigElement in project OpenAM by OpenRock.

the class WSFedPropertiesModelImpl method setIDPExtAttributeValues.

/**
     * Saves the standard attribute values for the SP.
     *
     * @param realm to which the entity belongs.
     * @param fedId is the entity id.
     * @param idpExtValues has the extended attribute value pairs of IDP.
     * @param location has the information whether remote or hosted.
     * @throws AMConsoleException if saving of attribute value fails.
     */
public void setIDPExtAttributeValues(String realm, String fedId, Map idpExtValues, String location) throws AMConsoleException {
    try {
        String role = EntityModel.IDENTITY_PROVIDER;
        // fed is the extended entity configuration under the realm
        WSFederationMetaManager metaManager = getWSFederationMetaManager();
        FederationConfigElement fed = metaManager.getEntityConfig(realm, fedId);
        if (fed == null) {
            IDPEX_DATA_MAP.put(TF_DISPNAME, Collections.EMPTY_SET);
            createExtendedObject(realm, fedId, location, IDENTITY_PROVIDER, IDPEX_DATA_MAP);
            fed = metaManager.getEntityConfig(realm, fedId);
        }
        IDPSSOConfigElement idpsso = getidpsso(fed);
        if (idpsso != null) {
            BaseConfigType baseConfig = (BaseConfigType) idpsso;
            updateBaseConfig(idpsso, idpExtValues, role);
        }
        //saves the new configuration by passing new fed element created
        metaManager.setEntityConfig(realm, fed);
    } catch (JAXBException e) {
        debug.warning("WSFedPropertiesModelImpl.setIDPExtAttributeValues", e);
        throw new AMConsoleException(getErrorString(e));
    } catch (WSFederationMetaException e) {
        debug.warning("WSFedPropertiesModelImpl.setIDPExtAttributeValues", e);
        throw new AMConsoleException(getErrorString(e));
    }
}
Also used : BaseConfigType(com.sun.identity.wsfederation.jaxb.entityconfig.BaseConfigType) WSFederationMetaManager(com.sun.identity.wsfederation.meta.WSFederationMetaManager) JAXBException(javax.xml.bind.JAXBException) FederationConfigElement(com.sun.identity.wsfederation.jaxb.entityconfig.FederationConfigElement) IDPSSOConfigElement(com.sun.identity.wsfederation.jaxb.entityconfig.IDPSSOConfigElement) WSFederationMetaException(com.sun.identity.wsfederation.meta.WSFederationMetaException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 17 with IDPSSOConfigElement

use of com.sun.identity.wsfederation.jaxb.entityconfig.IDPSSOConfigElement in project OpenAM by OpenRock.

the class WSFederationSingleLogoutHandler method findIDPMetaAlias.

/**
     * Returns the WSFed IDP metaAlis which is in the same COT as the initiation
     * IDP and SP. Return null if such WSFed IDP does not exist or exception
     * occurs.
     */
private String findIDPMetaAlias(String idpEntityID, String spEntityID, String realm, String protocol) {
    try {
        WSFederationMetaManager metaManager = WSFederationUtils.getMetaManager();
        List hostedIdps = metaManager.getAllHostedIdentityProviderEntities(realm);
        if (debug.messageEnabled()) {
            debug.message("WSFedSingleLogoutHandler.findIDPMetaAlias: " + " all hosted WS-Fed IDPs = " + hostedIdps);
        }
        if ((hostedIdps == null) || hostedIdps.isEmpty()) {
            return null;
        }
        CircleOfTrustManager cotManager = new CircleOfTrustManager();
        Set cots = cotManager.getAllActiveCirclesOfTrust(realm);
        int num = hostedIdps.size();
        for (int i = 0; i < num; i++) {
            String idpId = (String) hostedIdps.get(i);
            Iterator it = cots.iterator();
            while (it.hasNext()) {
                String cotName = (String) it.next();
                if (debug.messageEnabled()) {
                    debug.message("WSFedSLOHandler.findIDPMetaAlias: " + " check COT = " + cotName);
                }
                // check if this cot contains the wsfed IDP to be checked 
                Set providers = cotManager.listCircleOfTrustMember(realm, cotName, SingleLogoutManager.WS_FED);
                if ((providers == null) || !providers.contains(idpId)) {
                    continue;
                }
                providers = cotManager.listCircleOfTrustMember(realm, cotName, protocol);
                if ((providers == null) || !providers.contains(idpEntityID)) {
                    continue;
                }
                if ((spEntityID != null) && (spEntityID.length() != 0) && !providers.contains(spEntityID)) {
                    continue;
                }
                // but just stop here right now.
                if (SingleLogoutManager.debug.messageEnabled()) {
                    SingleLogoutManager.debug.message("WSFedSingleLogoutHandler.findIDPMetaAlias : " + "found IDP " + idpId + " in COT " + cotName);
                }
                IDPSSOConfigElement config = metaManager.getIDPSSOConfig(realm, idpId);
                return config.getMetaAlias();
            }
        }
    } catch (Exception e) {
        SingleLogoutManager.debug.error("WSFederationSingleLogoutHandler." + "findIDPMetaAlias", e);
    }
    return null;
}
Also used : WSFederationMetaManager(com.sun.identity.wsfederation.meta.WSFederationMetaManager) CircleOfTrustManager(com.sun.identity.cot.CircleOfTrustManager) Set(java.util.Set) Iterator(java.util.Iterator) List(java.util.List) IDPSSOConfigElement(com.sun.identity.wsfederation.jaxb.entityconfig.IDPSSOConfigElement) SessionException(com.sun.identity.plugin.session.SessionException)

Aggregations

IDPSSOConfigElement (com.sun.identity.wsfederation.jaxb.entityconfig.IDPSSOConfigElement)17 SPSSOConfigElement (com.sun.identity.wsfederation.jaxb.entityconfig.SPSSOConfigElement)7 Set (java.util.Set)6 WSFederationMetaException (com.sun.identity.wsfederation.meta.WSFederationMetaException)5 HashSet (java.util.HashSet)5 List (java.util.List)5 Map (java.util.Map)5 WSFederationException (com.sun.identity.wsfederation.common.WSFederationException)4 WSFederationMetaManager (com.sun.identity.wsfederation.meta.WSFederationMetaManager)4 ConfigurationException (com.sun.identity.plugin.configuration.ConfigurationException)3 SessionException (com.sun.identity.plugin.session.SessionException)3 FederationConfigElement (com.sun.identity.wsfederation.jaxb.entityconfig.FederationConfigElement)3 ArrayList (java.util.ArrayList)3 Iterator (java.util.Iterator)3 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)2 NameIdentifier (com.sun.identity.saml.assertion.NameIdentifier)2 BaseConfigType (com.sun.identity.wsfederation.jaxb.entityconfig.BaseConfigType)2 HashMap (java.util.HashMap)2 JAXBException (javax.xml.bind.JAXBException)2 CircleOfTrustManager (com.sun.identity.cot.CircleOfTrustManager)1