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;
}
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);
}
}
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;
}
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;
}
Aggregations