Search in sources :

Example 31 with IDFFMetaException

use of com.sun.identity.federation.meta.IDFFMetaException in project OpenAM by OpenRock.

the class CreateMetaDataModelImpl method createIDFFProvider.

/**
     * Creates a IDFF provider.
     *
     * @param realm Realm Name.
     * @param entityId Entity Id.
     * @param values   Map of property name to values.
     */
public void createIDFFProvider(String realm, String entityId, Map values) throws AMConsoleException {
    try {
        IDFFMetaManager metaManager = new IDFFMetaManager(null);
        String metadata = CreateIDFFMetaDataTemplate.createStandardMetaTemplate(entityId, values, requestURL);
        String extendedData = CreateIDFFMetaDataTemplate.createExtendedMetaTemplate(entityId, values);
        EntityDescriptorElement descriptor = (EntityDescriptorElement) IDFFMetaUtils.convertStringToJAXB(metadata);
        EntityConfigElement configElt = (EntityConfigElement) IDFFMetaUtils.convertStringToJAXB(extendedData);
        metaManager.createEntityDescriptor(realm, descriptor);
        metaManager.createEntityConfig(realm, configElt);
    } catch (JAXBException ex) {
        throw new AMConsoleException(ex.getMessage());
    } catch (IDFFMetaException ex) {
        throw new AMConsoleException(ex.getMessage());
    }
}
Also used : IDFFMetaManager(com.sun.identity.federation.meta.IDFFMetaManager) IDFFMetaException(com.sun.identity.federation.meta.IDFFMetaException) JAXBException(javax.xml.bind.JAXBException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) EntityDescriptorElement(com.sun.identity.liberty.ws.meta.jaxb.EntityDescriptorElement) EntityConfigElement(com.sun.identity.federation.jaxb.entityconfig.EntityConfigElement)

Example 32 with IDFFMetaException

use of com.sun.identity.federation.meta.IDFFMetaException in project OpenAM by OpenRock.

the class EntityModelImpl method isAffiliate.

/**
     * Returns true if entity descriptor is an affiliate.
     *
     * @param protocol the Protocol to which entity belongs.
     * @param realm the realm in which the entity resides.
     * @param name Name of entity descriptor.
     * @return true if entity descriptor is an affiliate.
     */
public boolean isAffiliate(String protocol, String realm, String name) throws AMConsoleException {
    boolean isAffiliate = false;
    com.sun.identity.liberty.ws.meta.jaxb.AffiliationDescriptorType idff_ad = null;
    com.sun.identity.saml2.jaxb.metadata.AffiliationDescriptorType samlv2_sd = null;
    try {
        if (protocol.equals(IDFF)) {
            IDFFMetaManager idffManager = new IDFFMetaManager(null);
            idff_ad = (com.sun.identity.liberty.ws.meta.jaxb.AffiliationDescriptorType) idffManager.getAffiliationDescriptor(realm, name);
        } else if (protocol.equals(SAMLV2)) {
            SAML2MetaManager samlManager = new SAML2MetaManager();
            samlv2_sd = (com.sun.identity.saml2.jaxb.metadata.AffiliationDescriptorType) samlManager.getAffiliationDescriptor(realm, name);
        }
        if (idff_ad != null || samlv2_sd != null) {
            isAffiliate = true;
        }
    } catch (IDFFMetaException e) {
        if (debug.warningEnabled()) {
            debug.warning("EntityModelImpl.isAffiliate", e);
        }
        throw new AMConsoleException(getErrorString(e));
    } catch (SAML2MetaException s) {
        if (debug.warningEnabled()) {
            debug.warning("EntityModel.isAffiliate() - " + "Couldn't get SAMLMetaManager");
        }
        throw new AMConsoleException(getErrorString(s));
    }
    return isAffiliate;
}
Also used : IDFFMetaException(com.sun.identity.federation.meta.IDFFMetaException) SAML2MetaManager(com.sun.identity.saml2.meta.SAML2MetaManager) AffiliationDescriptorType(com.sun.identity.liberty.ws.meta.jaxb.AffiliationDescriptorType) IDFFMetaManager(com.sun.identity.federation.meta.IDFFMetaManager) AffiliationDescriptorType(com.sun.identity.liberty.ws.meta.jaxb.AffiliationDescriptorType) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) SAML2MetaException(com.sun.identity.saml2.meta.SAML2MetaException)

Example 33 with IDFFMetaException

use of com.sun.identity.federation.meta.IDFFMetaException in project OpenAM by OpenRock.

the class EntityModelImpl method deleteIDFFEntity.

private void deleteIDFFEntity(String entityID, String realm) throws AMConsoleException {
    try {
        IDFFMetaManager metaManager = new IDFFMetaManager(null);
        metaManager.deleteEntityDescriptor(realm, entityID);
    } catch (IDFFMetaException e) {
        throw new AMConsoleException(e.getMessage());
    }
}
Also used : IDFFMetaManager(com.sun.identity.federation.meta.IDFFMetaManager) IDFFMetaException(com.sun.identity.federation.meta.IDFFMetaException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 34 with IDFFMetaException

use of com.sun.identity.federation.meta.IDFFMetaException in project OpenAM by OpenRock.

the class EntityModelImpl method getIDFFEntities.

/**
     * Returns a map of all the idff entities including data about
     * what realm, the roles, and location of each entity.
     *
     * @throws AMConsoleException if unable to retrieve the IDFF entities.
     */
public Map getIDFFEntities() throws AMConsoleException {
    Map idffMap = new HashMap();
    try {
        IDFFMetaManager idffManager = new IDFFMetaManager(null);
        for (Iterator j = realms.iterator(); j.hasNext(); ) {
            String realm = (String) j.next();
            Set entities = idffManager.getAllEntities(realm);
            List hostedEntities = idffManager.getAllHostedEntities(realm);
            for (Iterator i = entities.iterator(); i.hasNext(); ) {
                String name = (String) i.next();
                Map data = new HashMap(8);
                data.put(REALM, realm);
                data.put(PROTOCOL, IDFF);
                data.put(ROLE, listToString(getIDFFRoles(name, realm)));
                if (isAffiliate(IDFF, realm, name)) {
                    data.put(LOCATION, "");
                } else if ((hostedEntities != null) && hostedEntities.contains(name)) {
                    data.put(LOCATION, HOSTED);
                } else {
                    data.put(LOCATION, REMOTE);
                }
                String entityNamewithRealm = name + "," + realm;
                idffMap.put(entityNamewithRealm, (HashMap) data);
            }
        }
    } catch (IDFFMetaException e) {
        debug.warning("EntityModel.getIDFFEntities", e);
        throw new AMConsoleException(e.getMessage());
    }
    return (idffMap != null) ? idffMap : Collections.EMPTY_MAP;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) HashMap(java.util.HashMap) IDFFMetaManager(com.sun.identity.federation.meta.IDFFMetaManager) IDFFMetaException(com.sun.identity.federation.meta.IDFFMetaException) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map)

Example 35 with IDFFMetaException

use of com.sun.identity.federation.meta.IDFFMetaException in project OpenAM by OpenRock.

the class BulkFederation method getEntityRoleAndIdIDFF.

private void getEntityRoleAndIdIDFF() throws CLIException {
    try {
        IDFFMetaManager idffMgr = new IDFFMetaManager(ssoToken);
        String role = idffMgr.getProviderRoleByMetaAlias(metaAlias);
        if (role == null) {
            Object[] param = { metaAlias };
            throw new CLIException(MessageFormat.format(getResourceString("bulk-federation-unknown-metaalias"), param), ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
        }
        isIDP = role.equals(IFSConstants.IDP);
        localEntityId = idffMgr.getEntityIDByMetaAlias(metaAlias);
    } catch (IDFFMetaException e) {
        debugError("BulkFederation.getEntityRoleAndIdIDFF", e);
        Object[] param = { metaAlias };
        throw new CLIException(MessageFormat.format(getResourceString("bulk-federation-unknown-metaalias"), param), ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
    }
}
Also used : IDFFMetaManager(com.sun.identity.federation.meta.IDFFMetaManager) IDFFMetaException(com.sun.identity.federation.meta.IDFFMetaException) CLIException(com.sun.identity.cli.CLIException)

Aggregations

IDFFMetaException (com.sun.identity.federation.meta.IDFFMetaException)89 IDFFMetaManager (com.sun.identity.federation.meta.IDFFMetaManager)55 BaseConfigType (com.sun.identity.federation.jaxb.entityconfig.BaseConfigType)30 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)27 Iterator (java.util.Iterator)25 Map (java.util.Map)25 HashMap (java.util.HashMap)24 List (java.util.List)24 ProviderDescriptorType (com.sun.identity.liberty.ws.meta.jaxb.ProviderDescriptorType)22 Set (java.util.Set)21 SAMLException (com.sun.identity.saml.common.SAMLException)17 HashSet (java.util.HashSet)17 ArrayList (java.util.ArrayList)14 FSException (com.sun.identity.federation.common.FSException)13 FSMsgException (com.sun.identity.federation.message.common.FSMsgException)12 CLIException (com.sun.identity.cli.CLIException)10 SessionException (com.sun.identity.plugin.session.SessionException)9 IOException (java.io.IOException)9 IDPDescriptorConfigElement (com.sun.identity.federation.jaxb.entityconfig.IDPDescriptorConfigElement)8 SPDescriptorConfigElement (com.sun.identity.federation.jaxb.entityconfig.SPDescriptorConfigElement)8