Search in sources :

Example 56 with ConfigurationException

use of com.sun.identity.plugin.configuration.ConfigurationException in project OpenAM by OpenRock.

the class WSFederationMetaManager method setEntityConfig.

/**
     * Sets the extended entity configuration under the realm.
     * 
     * @param realm The realm under which the entity resides.
     * @param config The extended entity configuration object to be set.
     * @throws WSFederationMetaException if unable to set the entity 
     * configuration.
     */
public void setEntityConfig(String realm, FederationConfigElement config) throws WSFederationMetaException {
    String federationId = config.getFederationID();
    if (federationId == null) {
        debug.error("WSFederationMetaManager.setEntityConfig: " + "entity ID is null");
        String[] data = { realm };
        LogUtil.error(Level.INFO, LogUtil.NO_ENTITY_ID_SET_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);
        oldAttrs.put(ATTR_ENTITY_CONFIG, attrs.get(ATTR_ENTITY_CONFIG));
        configInst.setConfiguration(realm, federationId, oldAttrs);
        LogUtil.access(Level.INFO, LogUtil.SET_ENTITY_CONFIG, objs, null);
    } catch (ConfigurationException e) {
        debug.error("WSFederationMetaManager.setEntityConfig:", e);
        String[] data = { e.getMessage(), federationId, realm };
        LogUtil.error(Level.INFO, LogUtil.CONFIG_ERROR_SET_ENTITY_CONFIG, data, null);
        throw new WSFederationMetaException(e);
    } catch (JAXBException jaxbe) {
        debug.error("WSFederationMetaManager.setEntityConfig:", jaxbe);
        LogUtil.error(Level.INFO, LogUtil.SET_INVALID_ENTITY_CONFIG, objs, null);
        throw new WSFederationMetaException("invalid_config", objs);
    }
}
Also used : ConfigurationException(com.sun.identity.plugin.configuration.ConfigurationException) JAXBException(javax.xml.bind.JAXBException) Map(java.util.Map)

Example 57 with ConfigurationException

use of com.sun.identity.plugin.configuration.ConfigurationException in project OpenAM by OpenRock.

the class WSFederationMetaManager method getEntityByTokenIssuerName.

/**
     * Returns entity ID associated with the token issuer name.
     * 
     * @param issuer Token issuer name.
     * @return entity ID associated with the metaAlias or null if not found.
     * @throws WSFederationMetaException if unable to retrieve the entity ids.
     */
public String getEntityByTokenIssuerName(String realm, String issuer) throws WSFederationMetaException {
    try {
        Set entityIds = configInst.getAllConfigurationNames(realm);
        if (entityIds == null || entityIds.isEmpty()) {
            return null;
        }
        for (Iterator iter = entityIds.iterator(); iter.hasNext(); ) {
            String federationId = (String) iter.next();
            FederationElement fed = getEntityDescriptor(realm, federationId);
            if (issuer.equals(getTokenIssuerName(fed))) {
                return federationId;
            }
        }
    } catch (ConfigurationException e) {
        debug.error("WSFederationMetaManager.getEntityByMetaAlias:", e);
        throw new WSFederationMetaException(e);
    }
    return null;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) ConfigurationException(com.sun.identity.plugin.configuration.ConfigurationException) Iterator(java.util.Iterator) FederationElement(com.sun.identity.wsfederation.jaxb.wsfederation.FederationElement)

Example 58 with ConfigurationException

use of com.sun.identity.plugin.configuration.ConfigurationException in project OpenAM by OpenRock.

the class WSFederationMetaManager method deleteFederation.

/**
     * Deletes the standard metadata entity descriptor under the realm.
     * 
     * @param realm The realm under which the entity resides.
     * @param federationId The ID of the entity for whom the standard entity 
     *                 descriptor will be deleted.
     * @throws WSFederationMetaException if unable to delete the entity 
     * descriptor.
     */
public void deleteFederation(String realm, String federationId) throws WSFederationMetaException {
    if (federationId == null) {
        return;
    }
    if (realm == null) {
        realm = "/";
    }
    String[] objs = { federationId, realm };
    try {
        // Remove the entity from cot              
        IDPSSOConfigElement idpconfig = getIDPSSOConfig(realm, federationId);
        if (idpconfig != null) {
            removeFromCircleOfTrust(idpconfig, realm, federationId);
        }
        SPSSOConfigElement spconfig = getSPSSOConfig(realm, federationId);
        if (spconfig != null) {
            removeFromCircleOfTrust(spconfig, realm, federationId);
        }
        // end of remove entity from cot
        configInst.deleteConfiguration(realm, federationId, null);
        LogUtil.access(Level.INFO, LogUtil.ENTITY_DESCRIPTOR_DELETED, objs, null);
        WSFederationMetaCache.putFederation(realm, federationId, null);
    } catch (ConfigurationException e) {
        debug.error("WSFederationMetaManager.deleteFederation:", e);
        String[] data = { e.getMessage(), federationId, realm };
        LogUtil.error(Level.INFO, LogUtil.CONFIG_ERROR_DELETE_ENTITY_DESCRIPTOR, data, null);
        throw new WSFederationMetaException(e);
    }
}
Also used : ConfigurationException(com.sun.identity.plugin.configuration.ConfigurationException) SPSSOConfigElement(com.sun.identity.wsfederation.jaxb.entityconfig.SPSSOConfigElement) IDPSSOConfigElement(com.sun.identity.wsfederation.jaxb.entityconfig.IDPSSOConfigElement)

Example 59 with ConfigurationException

use of com.sun.identity.plugin.configuration.ConfigurationException in project OpenAM by OpenRock.

the class WSFederationMetaManager method setFederation.

/**
     * Sets the standard metadata entity descriptor under the realm.
     * 
     * @param realm The realm under which the entity resides.
     * @param federation Federation object.
     * @throws WSFederationMetaException if unable to set the entity descriptor.
     */
public void setFederation(String realm, FederationElement federation) throws WSFederationMetaException {
    String federationId = federation.getFederationID();
    if (federationId == null) {
        federationId = WSFederationConstants.DEFAULT_FEDERATION_ID;
    }
    if (realm == null) {
        realm = "/";
    }
    String[] objs = { federationId, realm };
    try {
        Map attrs = WSFederationMetaUtils.convertJAXBToAttrMap(ATTR_METADATA, federation);
        Map oldAttrs = configInst.getConfiguration(realm, federationId);
        oldAttrs.put(ATTR_METADATA, attrs.get(ATTR_METADATA));
        configInst.setConfiguration(realm, federationId, oldAttrs);
        LogUtil.access(Level.INFO, LogUtil.SET_ENTITY_DESCRIPTOR, objs, null);
    } catch (ConfigurationException e) {
        debug.error("WSFederationMetaManager.setFederation:", e);
        String[] data = { e.getMessage(), federationId, realm };
        LogUtil.error(Level.INFO, LogUtil.CONFIG_ERROR_SET_ENTITY_DESCRIPTOR, data, null);
        throw new WSFederationMetaException(e);
    } catch (JAXBException jaxbe) {
        debug.error("WSFederationMetaManager.setFederation:", jaxbe);
        LogUtil.error(Level.INFO, LogUtil.SET_INVALID_ENTITY_DESCRIPTOR, objs, null);
        throw new WSFederationMetaException("invalid_descriptor", objs);
    }
}
Also used : ConfigurationException(com.sun.identity.plugin.configuration.ConfigurationException) JAXBException(javax.xml.bind.JAXBException) Map(java.util.Map)

Aggregations

ConfigurationException (com.sun.identity.plugin.configuration.ConfigurationException)59 Set (java.util.Set)38 Map (java.util.Map)35 HashSet (java.util.HashSet)31 JAXBException (javax.xml.bind.JAXBException)19 Iterator (java.util.Iterator)18 HashMap (java.util.HashMap)14 ArrayList (java.util.ArrayList)13 List (java.util.List)9 EntityConfigElement (com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement)6 SSOException (com.iplanet.sso.SSOException)5 SMSException (com.sun.identity.sm.SMSException)5 FederationConfigElement (com.sun.identity.wsfederation.jaxb.entityconfig.FederationConfigElement)5 ServiceConfig (com.sun.identity.sm.ServiceConfig)4 ServiceSchema (com.sun.identity.sm.ServiceSchema)4 EntityConfigElement (com.sun.identity.federation.jaxb.entityconfig.EntityConfigElement)3 IDPSSOConfigElement (com.sun.identity.wsfederation.jaxb.entityconfig.IDPSSOConfigElement)3 SPSSOConfigElement (com.sun.identity.wsfederation.jaxb.entityconfig.SPSSOConfigElement)3 StringTokenizer (java.util.StringTokenizer)3 SSOToken (com.iplanet.sso.SSOToken)2