Search in sources :

Example 11 with IDFFMetaManager

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

the class IDFFModelImpl method updateSPAuthenticationContexts.

/**
     * update SP Authentication Contexts
     *
     * @param realm Realm of Entity
     * @param entityName Name of Entity Descriptor.     
     * @param cxt IDFFAuthContexts object contains SP
     *        Authentication Contexts values
     */
public void updateSPAuthenticationContexts(String realm, String entityName, IDFFAuthContexts cxt) throws AMConsoleException {
    List list = cxt.toSPAuthContextInfo();
    String[] params = { realm, entityName, "IDFF", "SP-updateSPAuthenticationContexts" };
    logEvent("ATTEMPT_MODIFY_ENTITY_DESCRIPTOR", params);
    try {
        IDFFMetaManager idffMetaMgr = getIDFFMetaManager();
        EntityConfigElement entityConfig = idffMetaMgr.getEntityConfig(realm, entityName);
        if (entityConfig == null) {
            throw new AMConsoleException("invalid.entity.name");
        }
        SPDescriptorConfigElement spDecConfigElement = idffMetaMgr.getSPDescriptorConfig(realm, entityName);
        if (spDecConfigElement == null) {
            throw new AMConsoleException("invalid.config.element");
        } else {
            // update sp entity config
            updateAttrInConfig(spDecConfigElement, ATTR_SP_AUTHN_CONTEXT_MAPPING, list);
        }
        //saves the attributes by passing the new entityConfig object
        idffMetaMgr.setEntityConfig(realm, entityConfig);
        logEvent("SUCCEED_MODIFY_ENTITY_DESCRIPTOR", params);
    } catch (IDFFMetaException e) {
        String strError = getErrorString(e);
        String[] paramsEx = { realm, entityName, "IDFF", "SP-updateSPAuthenticationContexts", strError };
        logEvent("FEDERATION_EXCEPTION_MODIFY_ENTITY_DESCRIPTOR", paramsEx);
        throw new AMConsoleException(strError);
    }
    return;
}
Also used : IDFFMetaManager(com.sun.identity.federation.meta.IDFFMetaManager) IDFFMetaException(com.sun.identity.federation.meta.IDFFMetaException) SPDescriptorConfigElement(com.sun.identity.federation.jaxb.entityconfig.SPDescriptorConfigElement) ArrayList(java.util.ArrayList) List(java.util.List) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) EntityConfigElement(com.sun.identity.federation.jaxb.entityconfig.EntityConfigElement)

Example 12 with IDFFMetaManager

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

the class IDFFModelImpl method getCommonAttributeValues.

/**
     * Returns provider-affiliate common attribute values.
     * @param realm the realm in which the entity resides.
     * @param entityName Name of Entity Descriptor.
     * @return provider-affiliate common attribute values.
     * @throws IDFFMetaException if attribute values cannot be obtained.
     */
public Map getCommonAttributeValues(String realm, String entityName) throws AMConsoleException {
    Map values = new HashMap(26);
    String[] param = { realm, entityName, "IDFF", "General" };
    logEvent("ATTEMPT_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", param);
    try {
        IDFFMetaManager manager = getIDFFMetaManager();
        EntityDescriptorElement desc = manager.getEntityDescriptor(realm, entityName);
        values.put(ATTR_VALID_UNTIL, returnEmptySetIfValueIsNull(desc.getValidUntil()));
        values.put(ATTR_CACHE_DURATION, returnEmptySetIfValueIsNull(desc.getCacheDuration()));
        logEvent("SUCCEED_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", param);
    } catch (IDFFMetaException e) {
        String[] paramsEx = { realm, entityName, "IDFF", "General", getErrorString(e) };
        logEvent("FEDERATION_EXCEPTION_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", paramsEx);
        throw new AMConsoleException(getErrorString(e));
    }
    return values;
}
Also used : HashMap(java.util.HashMap) IDFFMetaManager(com.sun.identity.federation.meta.IDFFMetaManager) IDFFMetaException(com.sun.identity.federation.meta.IDFFMetaException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map) EntityDescriptorElement(com.sun.identity.liberty.ws.meta.jaxb.EntityDescriptorElement)

Example 13 with IDFFMetaManager

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

the class IDFFModelImpl method getAllEntityDescriptorNames.

/**
     * Returns a <code>Set</code> of entity descriptor names.
     *
     * @param realm the realm in which the entity resides.
     * @return the IDFF entity descriptor
     * @throws AMConsoleException
     */
public Set getAllEntityDescriptorNames(String realm) throws AMConsoleException {
    Set entitySet = null;
    try {
        IDFFMetaManager idffManager = getIDFFMetaManager();
        entitySet = idffManager.getAllEntities(realm);
    } catch (IDFFMetaException e) {
        throw new AMConsoleException(e.getMessage());
    }
    return (entitySet != null) ? entitySet : Collections.EMPTY_SET;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) IDFFMetaManager(com.sun.identity.federation.meta.IDFFMetaManager) IDFFMetaException(com.sun.identity.federation.meta.IDFFMetaException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 14 with IDFFMetaManager

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

the class IDFFModelImpl method getSPAuthenticationContexts.

/**
     * Returns  the object of Auththentication Contexts in SP.
     *
     * @param realm Realm of Entity
     * @param entityName Name of Entity Descriptor.     
     * @return attributes values of provider.
     */
public IDFFAuthContexts getSPAuthenticationContexts(String realm, String entityName) throws AMConsoleException {
    IDFFAuthContexts cxt = new IDFFAuthContexts();
    String str = null;
    try {
        List tmpList = new ArrayList();
        IDFFMetaManager manager = getIDFFMetaManager();
        Map map = new HashMap();
        BaseConfigType spConfig = manager.getSPDescriptorConfig(realm, entityName);
        if (spConfig != null) {
            map = IDFFMetaUtils.getAttributes(spConfig);
        } else {
            throw new AMConsoleException("invalid.entity.name");
        }
        List list = (List) map.get(ATTR_SP_AUTHN_CONTEXT_MAPPING);
        for (int i = 0; i < list.size(); i++) {
            String tmp = (String) list.get(i);
            int index = tmp.lastIndexOf("|");
            String level = removeKey(tmp.substring(index + 1));
            String name = removeKey(tmp.substring(0, index));
            cxt.put(name, "true", level);
        }
    } catch (IDFFMetaException e) {
        throw new AMConsoleException(getErrorString(e));
    } catch (AMConsoleException e) {
        throw new AMConsoleException(getErrorString(e));
    }
    return (cxt != null) ? cxt : new IDFFAuthContexts();
}
Also used : BaseConfigType(com.sun.identity.federation.jaxb.entityconfig.BaseConfigType) HashMap(java.util.HashMap) IDFFMetaManager(com.sun.identity.federation.meta.IDFFMetaManager) IDFFMetaException(com.sun.identity.federation.meta.IDFFMetaException) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map) IDFFAuthContexts(com.sun.identity.console.federation.IDFFAuthContexts)

Example 15 with IDFFMetaManager

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

the class IDFFModelImpl method updateIDPAuthenticationContexts.

/**
     * update IDP Authentication Contexts
     *
     * @param realm Realm of Entity
     * @param entityName Name of Entity Descriptor.     
     * @param cxt IDFFAuthContexts object contains IDP
     *        Authentication Contexts values
     */
public void updateIDPAuthenticationContexts(String realm, String entityName, IDFFAuthContexts cxt) throws AMConsoleException {
    List list = cxt.toIDPAuthContextInfo();
    String[] params = { realm, entityName, "IDFF", "IDP-updateIDPAuthenticationContexts" };
    logEvent("ATTEMPT_MODIFY_ENTITY_DESCRIPTOR", params);
    try {
        IDFFMetaManager idffMetaMgr = getIDFFMetaManager();
        EntityConfigElement entityConfig = idffMetaMgr.getEntityConfig(realm, entityName);
        if (entityConfig == null) {
            throw new AMConsoleException("invalid.entity.name");
        }
        IDPDescriptorConfigElement idpDecConfigElement = idffMetaMgr.getIDPDescriptorConfig(realm, entityName);
        if (idpDecConfigElement == null) {
            throw new AMConsoleException("invalid.config.element");
        } else {
            updateAttrInConfig(idpDecConfigElement, ATTR_IDP_AUTHN_CONTEXT_MAPPING, list);
        }
        //saves the attributes by passing the new entityConfig object
        idffMetaMgr.setEntityConfig(realm, entityConfig);
        logEvent("SUCCEED_MODIFY_ENTITY_DESCRIPTOR", params);
    } catch (IDFFMetaException e) {
        String strError = getErrorString(e);
        String[] paramsEx = { realm, entityName, "IDFF", "IDP-updateIDPAuthenticationContexts", strError };
        logEvent("FEDERATION_EXCEPTION_MODIFY_ENTITY_DESCRIPTOR", paramsEx);
        throw new AMConsoleException(strError);
    }
    return;
}
Also used : IDFFMetaManager(com.sun.identity.federation.meta.IDFFMetaManager) IDFFMetaException(com.sun.identity.federation.meta.IDFFMetaException) ArrayList(java.util.ArrayList) List(java.util.List) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) IDPDescriptorConfigElement(com.sun.identity.federation.jaxb.entityconfig.IDPDescriptorConfigElement) EntityConfigElement(com.sun.identity.federation.jaxb.entityconfig.EntityConfigElement)

Aggregations

IDFFMetaManager (com.sun.identity.federation.meta.IDFFMetaManager)69 IDFFMetaException (com.sun.identity.federation.meta.IDFFMetaException)63 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)27 Iterator (java.util.Iterator)24 List (java.util.List)21 Set (java.util.Set)20 BaseConfigType (com.sun.identity.federation.jaxb.entityconfig.BaseConfigType)18 Map (java.util.Map)18 HashMap (java.util.HashMap)16 FSException (com.sun.identity.federation.common.FSException)15 ArrayList (java.util.ArrayList)15 HashSet (java.util.HashSet)14 IDPDescriptorType (com.sun.identity.liberty.ws.meta.jaxb.IDPDescriptorType)10 SAMLException (com.sun.identity.saml.common.SAMLException)10 IOException (java.io.IOException)10 CLIException (com.sun.identity.cli.CLIException)9 ProviderDescriptorType (com.sun.identity.liberty.ws.meta.jaxb.ProviderDescriptorType)9 IDPDescriptorConfigElement (com.sun.identity.federation.jaxb.entityconfig.IDPDescriptorConfigElement)8 SPDescriptorConfigElement (com.sun.identity.federation.jaxb.entityconfig.SPDescriptorConfigElement)7 EntityDescriptorElement (com.sun.identity.liberty.ws.meta.jaxb.EntityDescriptorElement)7