Search in sources :

Example 16 with EntityConfigElement

use of com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement in project OpenAM by OpenRock.

the class SAML2MetaManager method removeFromCircleOfTrust.

private void removeFromCircleOfTrust(String realm, String entityId) {
    try {
        EntityConfigElement eConfig = getEntityConfig(realm, entityId);
        boolean isAffiliation = false;
        if (getAffiliationDescriptor(realm, entityId) != null) {
            isAffiliation = true;
        }
        if (debug.messageEnabled()) {
            debug.message("SAML2MetaManager.removeFromCircleOfTrust is " + entityId + " in realm " + realm + " an affiliation? " + isAffiliation);
        }
        if (eConfig != null) {
            List elist = null;
            if (isAffiliation) {
                AffiliationConfigElement affiliationCfgElm = getAffiliationConfig(realm, entityId);
                elist = new ArrayList();
                elist.add(affiliationCfgElm);
            } else {
                elist = eConfig.getIDPSSOConfigOrSPSSOConfigOrAuthnAuthorityConfig();
            }
            // use first one to delete the entity from COT
            BaseConfigType config = (BaseConfigType) elist.iterator().next();
            Map attr = SAML2MetaUtils.getAttributes(config);
            List cotAttr = (List) attr.get(SAML2Constants.COT_LIST);
            List cotList = new ArrayList(cotAttr);
            if ((cotList != null) && !cotList.isEmpty()) {
                for (Iterator iter = cotList.iterator(); iter.hasNext(); ) {
                    String cotName = ((String) iter.next()).trim();
                    if ((cotName != null) && (!cotName.equals(""))) {
                        cotm.removeCircleOfTrustMember(realm, cotName, COTConstants.SAML2, entityId, false);
                    }
                }
            }
        }
    } catch (Exception e) {
        debug.error("SAML2MetaManager.removeFromCircleOfTrust:" + "Error while removing entity" + entityId + "from COT.", e);
    }
}
Also used : BaseConfigType(com.sun.identity.saml2.jaxb.entityconfig.BaseConfigType) AffiliationConfigElement(com.sun.identity.saml2.jaxb.entityconfig.AffiliationConfigElement) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) Map(java.util.Map) COTException(com.sun.identity.cot.COTException) ConfigurationException(com.sun.identity.plugin.configuration.ConfigurationException) JAXBException(javax.xml.bind.JAXBException) EntityConfigElement(com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement)

Example 17 with EntityConfigElement

use of com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement in project OpenAM by OpenRock.

the class SAML2MetaManager method getSPSSOConfig.

/**
     * Returns first service provider's SSO configuration in an entity under
     * the realm.
     * @param realm The realm under which the entity resides.
     * @param entityId ID of the entity to be retrieved.
     * @return <code>SPSSOConfigElement</code> for the entity or null if not
     *         found.
     * @throws SAML2MetaException if unable to retrieve the first service
     *                            provider's SSO configuration.
     */
public SPSSOConfigElement getSPSSOConfig(String realm, String entityId) throws SAML2MetaException {
    EntityConfigElement eConfig = getEntityConfig(realm, entityId);
    if (eConfig == null) {
        return null;
    }
    List list = eConfig.getIDPSSOConfigOrSPSSOConfigOrAuthnAuthorityConfig();
    for (Iterator iter = list.iterator(); iter.hasNext(); ) {
        Object obj = iter.next();
        if (obj instanceof SPSSOConfigElement) {
            return (SPSSOConfigElement) obj;
        }
    }
    return null;
}
Also used : Iterator(java.util.Iterator) SPSSOConfigElement(com.sun.identity.saml2.jaxb.entityconfig.SPSSOConfigElement) ArrayList(java.util.ArrayList) List(java.util.List) EntityConfigElement(com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement)

Example 18 with EntityConfigElement

use of com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement in project OpenAM by OpenRock.

the class SAML2MetaManager method getPolicyEnforcementPointConfig.

/**
     * Returns first policy enforcement point configuration in an entity under
     * the realm.
     * @param realm The realm under which the entity resides.
     * @param entityId ID of the entity to be retrieved.
     * @return policy decision point configuration or null if it is not found.
     * @throws SAML2MetaException if unable to retrieve the configuration.
     */
public XACMLAuthzDecisionQueryConfigElement getPolicyEnforcementPointConfig(String realm, String entityId) throws SAML2MetaException {
    XACMLAuthzDecisionQueryConfigElement elm = null;
    EntityConfigElement eConfig = getEntityConfig(realm, entityId);
    if (eConfig != null) {
        List list = eConfig.getIDPSSOConfigOrSPSSOConfigOrAuthnAuthorityConfig();
        for (Iterator i = list.iterator(); i.hasNext() && (elm == null); ) {
            Object obj = i.next();
            if (obj instanceof XACMLAuthzDecisionQueryConfigElement) {
                elm = (XACMLAuthzDecisionQueryConfigElement) obj;
            }
        }
    }
    return elm;
}
Also used : Iterator(java.util.Iterator) XACMLAuthzDecisionQueryConfigElement(com.sun.identity.saml2.jaxb.entityconfig.XACMLAuthzDecisionQueryConfigElement) ArrayList(java.util.ArrayList) List(java.util.List) EntityConfigElement(com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement)

Example 19 with EntityConfigElement

use of com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement in project OpenAM by OpenRock.

the class SAML2MetaManager method getEntityByMetaAlias.

/**
     * Returns entity ID associated with the metaAlias.
     * @param metaAlias The metaAlias.
     * @return entity ID associated with the metaAlias or null if not found.
     * @throws SAML2MetaException if unable to retrieve the entity ids.
     */
public String getEntityByMetaAlias(String metaAlias) throws SAML2MetaException {
    String realm = SAML2MetaUtils.getRealmByMetaAlias(metaAlias);
    try {
        Set entityIds = configInst.getAllConfigurationNames(realm);
        if (entityIds == null || entityIds.isEmpty()) {
            return null;
        }
        for (Iterator iter = entityIds.iterator(); iter.hasNext(); ) {
            String entityId = (String) iter.next();
            EntityConfigElement config = getEntityConfig(realm, entityId);
            if ((config == null) || !config.isHosted()) {
                continue;
            }
            List list = config.getIDPSSOConfigOrSPSSOConfigOrAuthnAuthorityConfig();
            for (Iterator iter2 = list.iterator(); iter2.hasNext(); ) {
                BaseConfigType bConfig = (BaseConfigType) iter2.next();
                String cMetaAlias = bConfig.getMetaAlias();
                if (cMetaAlias != null && cMetaAlias.equals(metaAlias)) {
                    return entityId;
                }
            }
        }
    } catch (ConfigurationException e) {
        debug.error("SAML2MetaManager.getEntityByMetaAlias:", e);
        throw new SAML2MetaException(e);
    }
    return null;
}
Also used : BaseConfigType(com.sun.identity.saml2.jaxb.entityconfig.BaseConfigType) HashSet(java.util.HashSet) Set(java.util.Set) ConfigurationException(com.sun.identity.plugin.configuration.ConfigurationException) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) EntityConfigElement(com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement)

Example 20 with EntityConfigElement

use of com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement in project OpenAM by OpenRock.

the class SAML2MetaManager method getAttributeQueryConfig.

/**
     * Returns first attribute query configuration in an entity under
     * the realm.
     * @param realm The realm under which the entity resides.
     * @param entityId ID of the entity to be retrieved.
     * @return <code>AttributeQueryConfigElement</code> for the entity or
     *     null if not found.
     * @throws SAML2MetaException if unable to retrieve the first attribute
     *     query configuration.
     */
public AttributeQueryConfigElement getAttributeQueryConfig(String realm, String entityId) throws SAML2MetaException {
    EntityConfigElement eConfig = getEntityConfig(realm, entityId);
    if (eConfig == null) {
        return null;
    }
    List list = eConfig.getIDPSSOConfigOrSPSSOConfigOrAuthnAuthorityConfig();
    for (Iterator iter = list.iterator(); iter.hasNext(); ) {
        Object obj = iter.next();
        if (obj instanceof AttributeQueryConfigElement) {
            return (AttributeQueryConfigElement) obj;
        }
    }
    return null;
}
Also used : Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) AttributeQueryConfigElement(com.sun.identity.saml2.jaxb.entityconfig.AttributeQueryConfigElement) EntityConfigElement(com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement)

Aggregations

EntityConfigElement (com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement)44 List (java.util.List)26 SAML2MetaManager (com.sun.identity.saml2.meta.SAML2MetaManager)23 SAML2MetaException (com.sun.identity.saml2.meta.SAML2MetaException)22 ArrayList (java.util.ArrayList)21 Iterator (java.util.Iterator)19 JAXBException (javax.xml.bind.JAXBException)18 BaseConfigType (com.sun.identity.saml2.jaxb.entityconfig.BaseConfigType)12 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)11 EntityDescriptorElement (com.sun.identity.saml2.jaxb.metadata.EntityDescriptorElement)10 COTException (com.sun.identity.cot.COTException)8 ConfigurationException (com.sun.identity.plugin.configuration.ConfigurationException)8 Set (java.util.Set)8 Map (java.util.Map)7 SPSSOConfigElement (com.sun.identity.saml2.jaxb.entityconfig.SPSSOConfigElement)6 HashSet (java.util.HashSet)6 IDPSSOConfigElement (com.sun.identity.saml2.jaxb.entityconfig.IDPSSOConfigElement)5 AttributeType (com.sun.identity.saml2.jaxb.entityconfig.AttributeType)4 ObjectFactory (com.sun.identity.saml2.jaxb.entityconfig.ObjectFactory)4 CLIException (com.sun.identity.cli.CLIException)3