Search in sources :

Example 6 with AffiliationDescriptorType

use of com.sun.identity.liberty.ws.meta.jaxb.AffiliationDescriptorType in project OpenAM by OpenRock.

the class IDFFModelImpl method getAffiliateProfileAttributeValues.

/**
     * Returns affiliate profile attribute values.
     *
     * @param realm the realm in which the entity resides.
     * @param entityName name of Entity Descriptor.
     * @return affiliate profile attribute values.
     * @throws AMConsoleException if attribute values cannot be obtained.
     */
public Map getAffiliateProfileAttributeValues(String realm, String entityName) throws AMConsoleException {
    String[] params = { realm, entityName, "IDFF", "IDP" };
    logEvent("ATTEMPT_GET_AFFILIATE_ENTITY_DESCRIPTOR_ATTR_VALUES", params);
    Map values = new HashMap();
    try {
        IDFFMetaManager idffManager = getIDFFMetaManager();
        AffiliationDescriptorType aDesc = (AffiliationDescriptorType) idffManager.getAffiliationDescriptor(realm, entityName);
        if (aDesc != null) {
            values.put(ATTR_AFFILIATE_ID, returnEmptySetIfValueIsNull(aDesc.getAffiliationID()));
            values.put(ATTR_AFFILIATE_OWNER_ID, returnEmptySetIfValueIsNull(aDesc.getAffiliationOwnerID()));
            BaseConfigType affiliationConfig = idffManager.getAffiliationDescriptorConfig(realm, entityName);
            if (affiliationConfig != null) {
                Map map = IDFFMetaUtils.getAttributes(affiliationConfig);
                if (map.containsKey(ATTR_AFFILIATE_SIGNING_CERT_ALIAS)) {
                    values.put(ATTR_AFFILIATE_SIGNING_CERT_ALIAS, returnEmptySetIfValueIsNull(convertListToSet((List) map.get(ATTR_AFFILIATE_SIGNING_CERT_ALIAS))));
                } else {
                    values.put(ATTR_AFFILIATE_SIGNING_CERT_ALIAS, Collections.EMPTY_SET);
                }
                if (map.containsKey(ATTR_AFFILIATE_ENCRYPTION_CERT_ALIAS)) {
                    values.put(ATTR_AFFILIATE_ENCRYPTION_CERT_ALIAS, returnEmptySetIfValueIsNull(convertListToSet((List) map.get(ATTR_AFFILIATE_ENCRYPTION_CERT_ALIAS))));
                } else {
                    values.put(ATTR_AFFILIATE_ENCRYPTION_CERT_ALIAS, Collections.EMPTY_SET);
                }
            }
        } else {
            values.put(ATTR_AFFILIATE_ID, Collections.EMPTY_SET);
            values.put(ATTR_AFFILIATE_OWNER_ID, Collections.EMPTY_SET);
            values.put(ATTR_AFFILIATE_VALID_UNTIL, Collections.EMPTY_SET);
            values.put(ATTR_AFFILIATE_CACHE_DURATION, Collections.EMPTY_SET);
            values.put(ATTR_AFFILIATE_SIGNING_CERT_ALIAS, Collections.EMPTY_SET);
            values.put(ATTR_AFFILIATE_ENCRYPTION_CERT_ALIAS, Collections.EMPTY_SET);
            values.put(ATTR_AFFILIATE_ENCRYPTION_KEY_SIZE, Collections.EMPTY_SET);
            values.put(ATTR_AFFILIATE_ENCRYPTION_KEY_ALGORITHM, Collections.EMPTY_SET);
        }
        logEvent("SUCCEED_GET_AFFILIATE_ENTITY_DESCRIPTOR_ATTR_VALUES", params);
    } catch (IDFFMetaException e) {
        String strError = getErrorString(e);
        String[] paramsEx = { realm, entityName, "IDFF", "SP", strError };
        logEvent("FEDERATION_EXCEPTION_GET_AFFILIATE_ENTITY_DESCRIPTOR_ATTR_VALUES", paramsEx);
        throw new AMConsoleException(strError);
    }
    return (values != null) ? values : Collections.EMPTY_MAP;
}
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) AffiliationDescriptorType(com.sun.identity.liberty.ws.meta.jaxb.AffiliationDescriptorType) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map)

Example 7 with AffiliationDescriptorType

use of com.sun.identity.liberty.ws.meta.jaxb.AffiliationDescriptorType in project OpenAM by OpenRock.

the class IDFFModelImpl method updateAffiliateProfile.

/**
     * Modifies affiliate profile.
     *
     * @param realm the realm in which the entity resides.
     * @param entityName Name of entity descriptor.
     * @param values Map of attribute name/value pairs.
     * @param members Set of affiliate members
     * @throws AMConsoleException if profile cannot be modified.
     */
public void updateAffiliateProfile(String realm, String entityName, Map values, Set members) throws AMConsoleException {
    String[] params = { realm, entityName, "IDFF", "Affiliate" };
    logEvent("ATTEMPT_MODIFY_AFFILIATE_ENTITY_DESCRIPTOR", params);
    try {
        IDFFMetaManager idffManager = getIDFFMetaManager();
        EntityDescriptorElement entityDescriptor = idffManager.getEntityDescriptor(realm, entityName);
        AffiliationDescriptorType aDesc = entityDescriptor.getAffiliationDescriptor();
        aDesc.setAffiliationOwnerID((String) AMAdminUtils.getValue((Set) values.get(ATTR_AFFILIATE_OWNER_ID)));
        //TBD : common attributes which may be added here later
        /* ATTR_AFFILIATE_VALID_UNTIL,
             * ATTR_AFFILIATE_CACHE_DURATION 
             * ATTR_ENCRYPTION_KEY_SIZE 
             * ATTR_AFFILIATE_ENCRYPTION_KEY_ALGORITHM
             * ATTR_AFFILIATE_ENCRYPTION_CERT_ALIAS
             * ATTR_AFFILIATE_SIGNING_CERT_ALIAS
             */
        // add affilliate members
        aDesc.getAffiliateMember().clear();
        Iterator it = members.iterator();
        while (it.hasNext()) {
            String newMember = (String) it.next();
            aDesc.getAffiliateMember().add(newMember);
        }
        entityDescriptor.setAffiliationDescriptor(aDesc);
        idffManager.setEntityDescriptor(realm, entityDescriptor);
        logEvent("SUCCEED_MODIFY_AFFILIATE_ENTITY_DESCRIPTOR", params);
    } catch (IDFFMetaException e) {
        String strError = getErrorString(e);
        String[] paramsEx = { realm, entityName, "IDFF", "Affiliate", strError };
        logEvent("FEDERATION_EXCEPTION_MODIFY_AFFILIATE_ENTITY_DESCRIPTOR", paramsEx);
        throw new AMConsoleException(strError);
    }
}
Also used : IDFFMetaManager(com.sun.identity.federation.meta.IDFFMetaManager) IDFFMetaException(com.sun.identity.federation.meta.IDFFMetaException) Iterator(java.util.Iterator) AffiliationDescriptorType(com.sun.identity.liberty.ws.meta.jaxb.AffiliationDescriptorType) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) EntityDescriptorElement(com.sun.identity.liberty.ws.meta.jaxb.EntityDescriptorElement)

Example 8 with AffiliationDescriptorType

use of com.sun.identity.liberty.ws.meta.jaxb.AffiliationDescriptorType in project OpenAM by OpenRock.

the class IDFFMetaManager method isAffiliateMember.

/**
     * Checks if the provider is a member of the Affiliation.
     *
     * @param realm The realm under which the entity resides.
     * @param providerID the provider's identitifer.
     * @param affiliationID the Affiliation identifier.
     *
     * @return true if the provider is a member of the affiliation.
     * @throws IDFFMetaException if there is an error retreiving the affiliate
     *         information.
     */
public boolean isAffiliateMember(String realm, String providerID, String affiliationID) throws IDFFMetaException {
    boolean isAffiliateMember = false;
    if ((realm == null) || (realm.length() == 0)) {
        realm = ROOT_REALM;
    }
    if (providerID != null && affiliationID != null) {
        Set entityIDSet = getAllEntities(realm);
        if (entityIDSet != null && !entityIDSet.isEmpty()) {
            Iterator entityIterator = entityIDSet.iterator();
            while (entityIterator.hasNext()) {
                String entityID = (String) entityIterator.next();
                AffiliationDescriptorType affDescriptor = getAffiliationDescriptor(realm, entityID);
                if (affDescriptor != null) {
                    String affID = affDescriptor.getAffiliationID();
                    if (affID != null && affID.equals(affiliationID)) {
                        List affMemberList = affDescriptor.getAffiliateMember();
                        if (affMemberList != null && !affMemberList.isEmpty() && affMemberList.contains(providerID)) {
                            isAffiliateMember = true;
                            break;
                        }
                    }
                }
            }
        }
    }
    String[] args = { providerID, affiliationID, realm };
    LogUtil.access(Level.INFO, LogUtil.IS_AFFILIATE_MEMBER_SUCCEEDED, args);
    return isAffiliateMember;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) AffiliationDescriptorType(com.sun.identity.liberty.ws.meta.jaxb.AffiliationDescriptorType)

Example 9 with AffiliationDescriptorType

use of com.sun.identity.liberty.ws.meta.jaxb.AffiliationDescriptorType in project OpenAM by OpenRock.

the class IDFFModelImpl method getAllAffiliateMembers.

/**
     * Returns a Set of all the affiliate members
     *
     * @param realm the realm in which the entity resides.
     * @param entityName name of the Entity Descriptor.
     * @throws AMConsoleException if values cannot be obtained.
     */
public Set getAllAffiliateMembers(String realm, String entityName) throws AMConsoleException {
    Set memberSet = null;
    try {
        IDFFMetaManager idffManager = getIDFFMetaManager();
        AffiliationDescriptorType aDesc = (AffiliationDescriptorType) idffManager.getAffiliationDescriptor(realm, entityName);
        memberSet = convertListToSet(aDesc.getAffiliateMember());
    } catch (IDFFMetaException e) {
        throw new AMConsoleException(e.getMessage());
    }
    return (memberSet != null) ? memberSet : 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) AffiliationDescriptorType(com.sun.identity.liberty.ws.meta.jaxb.AffiliationDescriptorType) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Aggregations

AffiliationDescriptorType (com.sun.identity.liberty.ws.meta.jaxb.AffiliationDescriptorType)9 IDFFMetaException (com.sun.identity.federation.meta.IDFFMetaException)5 IDFFMetaManager (com.sun.identity.federation.meta.IDFFMetaManager)5 Iterator (java.util.Iterator)5 Set (java.util.Set)5 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)4 HashSet (java.util.HashSet)3 BaseConfigType (com.sun.identity.federation.jaxb.entityconfig.BaseConfigType)2 EntityDescriptorElement (com.sun.identity.liberty.ws.meta.jaxb.EntityDescriptorElement)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 COTException (com.sun.identity.cot.COTException)1 FSAccountFedInfo (com.sun.identity.federation.accountmgmt.FSAccountFedInfo)1 FSAccountManager (com.sun.identity.federation.accountmgmt.FSAccountManager)1 FSAccountMgmtException (com.sun.identity.federation.accountmgmt.FSAccountMgmtException)1 FSAuthnRequest (com.sun.identity.federation.message.FSAuthnRequest)1 FSIDPList (com.sun.identity.federation.message.FSIDPList)1 FSScoping (com.sun.identity.federation.message.FSScoping)1 IDPEntries (com.sun.identity.federation.message.common.IDPEntries)1