Search in sources :

Example 1 with IDFFAuthContexts

use of com.sun.identity.console.federation.IDFFAuthContexts 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 2 with IDFFAuthContexts

use of com.sun.identity.console.federation.IDFFAuthContexts in project OpenAM by OpenRock.

the class IDFFModelImpl method getIDPAuthenticationContexts.

/**
     * Returns the object of Auththentication Contexts in IDP.
     *
     * @param realm Realm of Entity
     * @param entityName Name of Entity Descriptor.       
     * @return attributes values of provider.
     */
public IDFFAuthContexts getIDPAuthenticationContexts(String realm, String entityName) throws AMConsoleException {
    String str = null;
    IDFFAuthContexts cxt = new IDFFAuthContexts();
    try {
        List tmpList = new ArrayList();
        IDFFMetaManager manager = getIDFFMetaManager();
        Map map = new HashMap();
        BaseConfigType idpConfig = manager.getIDPDescriptorConfig(realm, entityName);
        if (idpConfig != null) {
            map = IDFFMetaUtils.getAttributes(idpConfig);
        } else {
            throw new AMConsoleException("invalid.entity.name");
        }
        List list = (List) map.get(ATTR_IDP_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));
            tmp = tmp.substring(0, index);
            index = tmp.lastIndexOf("|");
            String value = removeKey(tmp.substring(index + 1));
            tmp = tmp.substring(0, index);
            index = tmp.indexOf("|");
            String key = removeKey(tmp.substring(index + 1));
            String name = removeKey(tmp.substring(0, index));
            cxt.put(name, "true", key, value, 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)

Aggregations

AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)2 IDFFAuthContexts (com.sun.identity.console.federation.IDFFAuthContexts)2 BaseConfigType (com.sun.identity.federation.jaxb.entityconfig.BaseConfigType)2 IDFFMetaException (com.sun.identity.federation.meta.IDFFMetaException)2 IDFFMetaManager (com.sun.identity.federation.meta.IDFFMetaManager)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2