Search in sources :

Example 41 with COTException

use of com.sun.identity.cot.COTException in project OpenAM by OpenRock.

the class FSAuthDomainsModelImpl method getCircleOfTrustDescriptors.

public Set getCircleOfTrustDescriptors() {
    Set descSet = new HashSet();
    String realm = COTConstants.ROOT_REALM;
    try {
        CircleOfTrustManager manager = getCircleOfTrustManager();
        Set realmSet = getRealmNames("/", "*");
        for (Iterator i = realmSet.iterator(); i.hasNext(); ) {
            realm = (String) i.next();
            Set cotSet = manager.getAllCirclesOfTrust(realm);
            for (Iterator j = cotSet.iterator(); j.hasNext(); ) {
                String cotName = (String) j.next();
                CircleOfTrustDescriptor descriptor = manager.getCircleOfTrust(realm, cotName);
                descSet.add(descriptor);
            }
        }
    } catch (COTException e) {
        String[] paramsEx = { realm, getErrorString(e) };
        logEvent("FEDERATION_EXCEPTION_GET_AUTH_DOMAINS", paramsEx);
        debug.warning("FSAuthDomainsModelImpl.getAuthenticationDomains", e);
    } catch (AMConsoleException e) {
        debug.warning("FSAuthDomainsModelImpl.getAuthenticationDomains", e);
    }
    return descSet;
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) CircleOfTrustManager(com.sun.identity.cot.CircleOfTrustManager) Iterator(java.util.Iterator) CircleOfTrustDescriptor(com.sun.identity.cot.CircleOfTrustDescriptor) COTException(com.sun.identity.cot.COTException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashSet(java.util.HashSet)

Example 42 with COTException

use of com.sun.identity.cot.COTException in project OpenAM by OpenRock.

the class FSAuthDomainsModelImpl method createAuthenticationDomain.

/**
     * Creates authentication domain.
     *
     * @param attrValues Map of attribute name to set of attribute values.
     * @throws AMConsoleException if authentication domain created.
     */
public void createAuthenticationDomain(Map attrValues, Set providers) throws AMConsoleException {
    String realm = (String) AMAdminUtils.getValue((Set) attrValues.get(SINGLE_CHOICE_REALM));
    String status = (String) AMAdminUtils.getValue((Set) attrValues.get(SINGLE_CHOICE_STATUS));
    String name = (String) AMAdminUtils.getValue((Set) attrValues.get(TF_NAME));
    if (name.trim().length() == 0) {
        throw new AMConsoleException("authdomain.authentication.domain.name.missing.message");
    }
    String[] param = { name };
    logEvent("ATTEMPT_CREATE_AUTH_DOMAIN", param);
    try {
        CircleOfTrustDescriptor descriptor = new CircleOfTrustDescriptor(name, realm, status);
        descriptor.setTrustedProviders(providers);
        descriptor.setCircleOfTrustDescription((String) AMAdminUtils.getValue((Set) attrValues.get(TF_DESCRIPTION)));
        descriptor.setIDFFReaderServiceURL((String) AMAdminUtils.getValue((Set) attrValues.get(TF_IDFF_READER_SERVICE_URL)));
        descriptor.setIDFFWriterServiceURL((String) AMAdminUtils.getValue((Set) attrValues.get(TF_IDFF_WRITER_SERVICE_URL)));
        descriptor.setSAML2ReaderServiceURL((String) AMAdminUtils.getValue((Set) attrValues.get(TF_SAML2_READER_SERVICE_URL)));
        descriptor.setSAML2WriterServiceURL((String) AMAdminUtils.getValue((Set) attrValues.get(TF_SAML2_WRITER_SERVICE_URL)));
        CircleOfTrustManager manager = getCircleOfTrustManager();
        manager.createCircleOfTrust(realm, descriptor);
        logEvent("SUCCEED_CREATE_AUTH_DOMAIN", param);
    } catch (COTException e) {
        String strError = getErrorString(e);
        String[] paramsEx = { name, strError };
        logEvent("FEDERATION_EXCEPTION_CREATE_AUTH_DOMAIN", paramsEx);
        throw new AMConsoleException(strError);
    }
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) CircleOfTrustManager(com.sun.identity.cot.CircleOfTrustManager) CircleOfTrustDescriptor(com.sun.identity.cot.CircleOfTrustDescriptor) COTException(com.sun.identity.cot.COTException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Aggregations

COTException (com.sun.identity.cot.COTException)42 CircleOfTrustManager (com.sun.identity.cot.CircleOfTrustManager)29 Set (java.util.Set)18 Iterator (java.util.Iterator)16 CircleOfTrustDescriptor (com.sun.identity.cot.CircleOfTrustDescriptor)15 List (java.util.List)15 Map (java.util.Map)14 ArrayList (java.util.ArrayList)13 SAML2MetaException (com.sun.identity.saml2.meta.SAML2MetaException)12 HashMap (java.util.HashMap)11 CLIException (com.sun.identity.cli.CLIException)10 HashSet (java.util.HashSet)10 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)9 SAML2MetaManager (com.sun.identity.saml2.meta.SAML2MetaManager)9 SPSSOConfigElement (com.sun.identity.saml2.jaxb.entityconfig.SPSSOConfigElement)7 EntityConfigElement (com.sun.identity.saml2.jaxb.entityconfig.EntityConfigElement)6 IDFFMetaException (com.sun.identity.federation.meta.IDFFMetaException)5 JAXBException (javax.xml.bind.JAXBException)5 IDFFMetaManager (com.sun.identity.federation.meta.IDFFMetaManager)4 EntityDescriptorElement (com.sun.identity.saml2.jaxb.metadata.EntityDescriptorElement)4