Search in sources :

Example 6 with IDPSSOConfigElement

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

the class WSFederationMetaManager method createEntityConfig.

/**
     * Creates the extended entity configuration under the realm.
     * 
     * @param realm The realm under which the entity configuration will be
     * created.
     * @param config The extended entity configuration object to be created.
     * @throws WSFederationMetaException if unable to create the entity 
     * configuration.
     */
public void createEntityConfig(String realm, FederationConfigElement config) throws WSFederationMetaException {
    String federationId = config.getFederationID();
    if (federationId == null) {
        debug.error("WSFederationMetaManager.createEntityConfig: " + "entity ID is null");
        String[] data = { realm };
        LogUtil.error(Level.INFO, LogUtil.NO_ENTITY_ID_CREATE_ENTITY_CONFIG, data, null);
        throw new WSFederationMetaException("empty_entityid", null);
    }
    if (realm == null) {
        realm = "/";
    }
    String[] objs = { federationId, realm };
    try {
        Map attrs = WSFederationMetaUtils.convertJAXBToAttrMap(ATTR_ENTITY_CONFIG, config);
        Map oldAttrs = configInst.getConfiguration(realm, federationId);
        if (oldAttrs == null) {
            LogUtil.error(Level.INFO, LogUtil.NO_ENTITY_DESCRIPTOR_CREATE_ENTITY_CONFIG, objs, null);
            throw new WSFederationMetaException("entity_descriptor_not_exist", objs);
        }
        Set oldValues = (Set) oldAttrs.get(ATTR_ENTITY_CONFIG);
        if (oldValues != null && !oldValues.isEmpty()) {
            LogUtil.error(Level.INFO, LogUtil.ENTITY_CONFIG_EXISTS, objs, null);
            throw new WSFederationMetaException("entity_config_exists", objs);
        }
        configInst.setConfiguration(realm, federationId, attrs);
        LogUtil.access(Level.INFO, LogUtil.ENTITY_CONFIG_CREATED, objs, null);
        // Add the entity to cot              
        SPSSOConfigElement spconfig = getSPSSOConfig(realm, federationId);
        if (spconfig != null) {
            addToCircleOfTrust(spconfig, realm, federationId);
        }
        IDPSSOConfigElement idpconfig = getIDPSSOConfig(realm, federationId);
        if (idpconfig != null) {
            addToCircleOfTrust(idpconfig, realm, federationId);
        }
    } catch (ConfigurationException e) {
        debug.error("WSFederationMetaManager.createEntityConfig:", e);
        String[] data = { e.getMessage(), federationId, realm };
        LogUtil.error(Level.INFO, LogUtil.CONFIG_ERROR_CREATE_ENTITY_CONFIG, data, null);
        throw new WSFederationMetaException(e);
    } catch (JAXBException jaxbe) {
        debug.error("WSFederationMetaManager.createEntityConfig:", jaxbe);
        LogUtil.error(Level.INFO, LogUtil.CREATE_INVALID_ENTITY_CONFIG, objs, null);
        throw new WSFederationMetaException("invalid_config", objs);
    }
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) ConfigurationException(com.sun.identity.plugin.configuration.ConfigurationException) JAXBException(javax.xml.bind.JAXBException) SPSSOConfigElement(com.sun.identity.wsfederation.jaxb.entityconfig.SPSSOConfigElement) IDPSSOConfigElement(com.sun.identity.wsfederation.jaxb.entityconfig.IDPSSOConfigElement) Map(java.util.Map)

Example 7 with IDPSSOConfigElement

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

the class WSFederationMetaManager method getAllHostedIdentityProviderMetaAliases.

/**
     * Returns metaAliases of all hosted identity providers under the realm.
     * 
     * @param realm The realm under which the identity provider metaAliases
     *              reside.
     * @return a <code>List</code> of metaAliases <code>String</code>.
     * @throws WSFederationMetaException if unable to retrieve meta aliases.
     */
public List<String> getAllHostedIdentityProviderMetaAliases(String realm) throws WSFederationMetaException {
    List<String> metaAliases = new ArrayList<String>();
    IDPSSOConfigElement idpConfig = null;
    List<String> hostedEntityIds = getAllHostedIdentityProviderEntities(realm);
    for (String federationId : hostedEntityIds) {
        if ((idpConfig = getIDPSSOConfig(realm, federationId)) != null) {
            metaAliases.add(idpConfig.getMetaAlias());
        }
    }
    return metaAliases;
}
Also used : ArrayList(java.util.ArrayList) IDPSSOConfigElement(com.sun.identity.wsfederation.jaxb.entityconfig.IDPSSOConfigElement)

Example 8 with IDPSSOConfigElement

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

the class WSFederationMetaManager method isTrustedProvider.

/**
     * Determines whether two entities are in the same circle of trust
     * under the realm.
     * 
     * @param realm The realm under which the entity resides.
     * @param federationId The ID of the entity
     * @param trustedEntityId The ID of the entity
     * @throws WSFederationMetaException if unable to determine the trusted
     *         relationship.
     */
public boolean isTrustedProvider(String realm, String federationId, String trustedEntityId) throws WSFederationMetaException {
    boolean result = false;
    SPSSOConfigElement spconfig = getSPSSOConfig(realm, federationId);
    if (spconfig != null) {
        result = isSameCircleOfTrust(spconfig, realm, trustedEntityId);
    }
    if (result) {
        return true;
    }
    IDPSSOConfigElement idpconfig = getIDPSSOConfig(realm, federationId);
    if (idpconfig != null) {
        return (isSameCircleOfTrust(idpconfig, realm, trustedEntityId));
    }
    return false;
}
Also used : SPSSOConfigElement(com.sun.identity.wsfederation.jaxb.entityconfig.SPSSOConfigElement) IDPSSOConfigElement(com.sun.identity.wsfederation.jaxb.entityconfig.IDPSSOConfigElement)

Example 9 with IDPSSOConfigElement

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

the class WSFederationMetaManager method getIDPSSOConfig.

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

Example 10 with IDPSSOConfigElement

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

the class WSFedPropertiesModelImpl method getIdentityProviderAttributes.

/**
     * Returns a <code>Map</code> with identity provider attributes and values.
     *
     * @param realm to which the entity belongs.
     * @param fedId is the Federation Id otherwise known as the entity id.
     * @return attribute values of IDP based on realm and fedId passed.
     * @throws AMConsoleException if unable to retreive the Identity Provider
     *     attrubutes based on the realm and fedId passed.
     */
public Map getIdentityProviderAttributes(String realm, String fedId) throws AMConsoleException {
    Map IDPAttributes = null;
    try {
        WSFederationMetaManager metaManager = getWSFederationMetaManager();
        IDPSSOConfigElement idpconfig = metaManager.getIDPSSOConfig(realm, fedId);
        if (idpconfig != null) {
            IDPAttributes = WSFederationMetaUtils.getAttributes(idpconfig);
        }
    } catch (WSFederationMetaException e) {
        debug.warning("WSFedPropertiesModelImpl.getIdentityProviderAttributes", e);
        throw new AMConsoleException(e.getMessage());
    }
    return (IDPAttributes != null) ? IDPAttributes : Collections.EMPTY_MAP;
}
Also used : WSFederationMetaManager(com.sun.identity.wsfederation.meta.WSFederationMetaManager) IDPSSOConfigElement(com.sun.identity.wsfederation.jaxb.entityconfig.IDPSSOConfigElement) WSFederationMetaException(com.sun.identity.wsfederation.meta.WSFederationMetaException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map)

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