use of com.sun.identity.federation.jaxb.entityconfig.BaseConfigType in project OpenAM by OpenRock.
the class LibertyManager method getList.
/**
* The steps for getting the <code>IDPList</code> and <code>SPList</code>
* are the same (except for a role check). So having this private method
* which takes in role and does the required function.
*/
private static Iterator getList(String realm, String entityID, String providerRole, String remoteProviderRole) {
Set trustedProviders = null;
BaseConfigType providerConfig = IDFFMetaUtils.getExtendedConfig(realm, entityID, providerRole, metaManager);
if (providerConfig != null) {
trustedProviders = metaManager.getAllTrustedProviders(providerConfig.getMetaAlias());
}
if (trustedProviders == null) {
trustedProviders = new HashSet();
}
return trustedProviders.iterator();
}
use of com.sun.identity.federation.jaxb.entityconfig.BaseConfigType in project OpenAM by OpenRock.
the class LibertyManager method getFederationDonePageURL.
/**
* Returns the <code>FederationDonePageURL</code> from the provider ID
* under a realm.
*
* @param realm The realm under which the entity resides.
* @param providerID Provider's entity ID.
* @param providerRole Provider Role.
* @param request HTTP servlet request.
* @return the <code>FederationDonePageURL</code> from the provider ID.
* @deprecated This method is deprecated.
* @see #getFederationDonePageURL(String,String,String,HttpServletRequest)
*/
public static String getFederationDonePageURL(String realm, String providerID, String providerRole, HttpServletRequest request) {
BaseConfigType providerConfig = IDFFMetaUtils.getExtendedConfig(realm, providerID, providerRole, metaManager);
String metaAlias = null;
if (providerConfig != null) {
metaAlias = providerConfig.getMetaAlias();
}
return FSServiceUtils.getFederationDonePageURL(request, providerConfig, metaAlias);
}
use of com.sun.identity.federation.jaxb.entityconfig.BaseConfigType in project OpenAM by OpenRock.
the class IDFFModelImpl method getIDPEntityConfig.
/**
* Returns attributes values in extended metadata.
*
* @param realm where the entity exists.
* @param entityName Name of Entity Descriptor.
* @param location Location of provider such as Hosted or Remote.
* @return attributes values of provider.
*/
public Map getIDPEntityConfig(String realm, String entityName, String location) throws AMConsoleException {
String[] params = { realm, entityName, "IDFF", "IDP-Extended Metadata" };
logEvent("ATTEMPT_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", params);
IDFFMetaManager manager;
Map map = new HashMap();
Map tmpMap = new HashMap();
try {
manager = getIDFFMetaManager();
String metaAlias = null;
BaseConfigType idpConfig = manager.getIDPDescriptorConfig(realm, entityName);
if (idpConfig != null) {
map = IDFFMetaUtils.getAttributes(idpConfig);
metaAlias = idpConfig.getMetaAlias();
} else {
createEntityConfig(realm, entityName, IFSConstants.IDP, location);
}
Set entries = map.entrySet();
Iterator iterator = entries.iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry) iterator.next();
tmpMap.put((String) entry.getKey(), returnEmptySetIfValueIsNull(convertListToSet((List) entry.getValue())));
}
tmpMap.put(ATTR_PROVIDER_ALIAS, returnEmptySetIfValueIsNull(metaAlias));
if (!tmpMap.containsKey(ATTR_SIGNING_CERT_ALIAS)) {
tmpMap.put(ATTR_SIGNING_CERT_ALIAS, Collections.EMPTY_SET);
}
if (!tmpMap.containsKey(ATTR_ENCRYPTION_CERT_ALIAS)) {
tmpMap.put(ATTR_ENCRYPTION_CERT_ALIAS, Collections.EMPTY_SET);
}
logEvent("SUCCEED_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", params);
} catch (IDFFMetaException e) {
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "IDFF", "IDP-Extended Metadata", strError };
logEvent("FEDERATION_EXCEPTION_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", paramsEx);
throw new AMConsoleException(getErrorString(e));
} catch (AMConsoleException e) {
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "IDFF", "IDP-Extended Metadata", strError };
logEvent("FEDERATION_EXCEPTION_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", paramsEx);
throw new AMConsoleException(getErrorString(e));
}
return tmpMap;
}
use of com.sun.identity.federation.jaxb.entityconfig.BaseConfigType in project OpenAM by OpenRock.
the class IDFFModelImpl method createEntityConfig.
public void createEntityConfig(String realm, String entityName, String role, String location) throws AMConsoleException {
try {
IDFFMetaManager idffMetaMgr = getIDFFMetaManager();
ObjectFactory objFactory = new ObjectFactory();
// Check whether the entity id existed in the DS
EntityDescriptorElement entityDesc = idffMetaMgr.getEntityDescriptor(realm, entityName);
if (entityDesc == null) {
throw new AMConsoleException("invalid.entity.name");
}
EntityConfigElement entityConfig = idffMetaMgr.getEntityConfig(realm, entityName);
if (entityConfig == null) {
entityConfig = objFactory.createEntityConfigElement();
// add to entityConfig
entityConfig.setEntityID(entityName);
if (location.equals("remote")) {
entityConfig.setHosted(false);
} else {
entityConfig.setHosted(true);
}
}
// create entity config and add the attribute
BaseConfigType baseCfgType = null;
// It could have one sp and one idp.
if ((role.equals(IFSConstants.SP)) && (IDFFMetaUtils.getSPDescriptor(entityDesc) != null)) {
baseCfgType = objFactory.createSPDescriptorConfigElement();
for (Iterator iter = extendedMetaMap.keySet().iterator(); iter.hasNext(); ) {
AttributeType atype = objFactory.createAttributeType();
String key = (String) iter.next();
atype.setName(key);
atype.getValue().addAll(Collections.EMPTY_LIST);
baseCfgType.getAttribute().add(atype);
}
for (Iterator iter = extendedMetaSpMap.keySet().iterator(); iter.hasNext(); ) {
AttributeType atype = objFactory.createAttributeType();
String key = (String) iter.next();
atype.setName(key);
atype.getValue().addAll(Collections.EMPTY_LIST);
baseCfgType.getAttribute().add(atype);
}
entityConfig.getSPDescriptorConfig().add(baseCfgType);
} else if ((role.equals(IFSConstants.IDP)) && (IDFFMetaUtils.getIDPDescriptor(entityDesc) != null)) {
baseCfgType = objFactory.createIDPDescriptorConfigElement();
for (Iterator iter = extendedMetaMap.keySet().iterator(); iter.hasNext(); ) {
AttributeType atype = objFactory.createAttributeType();
String key = (String) iter.next();
atype.setName(key);
atype.getValue().addAll(Collections.EMPTY_LIST);
baseCfgType.getAttribute().add(atype);
}
for (Iterator iter = extendedMetaIdpMap.keySet().iterator(); iter.hasNext(); ) {
AttributeType atype = objFactory.createAttributeType();
String key = (String) iter.next();
atype.setName(key);
atype.getValue().addAll(Collections.EMPTY_LIST);
baseCfgType.getAttribute().add(atype);
}
entityConfig.getIDPDescriptorConfig().add(baseCfgType);
}
idffMetaMgr.setEntityConfig(realm, entityConfig);
} catch (IDFFMetaException e) {
throw new AMConsoleException(getErrorString(e));
} catch (JAXBException e) {
throw new AMConsoleException(getErrorString(e));
}
}
Aggregations