use of com.sun.identity.federation.meta.IDFFMetaException in project OpenAM by OpenRock.
the class CreateMetaDataModelImpl method createIDFFProvider.
/**
* Creates a IDFF provider.
*
* @param realm Realm Name.
* @param entityId Entity Id.
* @param values Map of property name to values.
*/
public void createIDFFProvider(String realm, String entityId, Map values) throws AMConsoleException {
try {
IDFFMetaManager metaManager = new IDFFMetaManager(null);
String metadata = CreateIDFFMetaDataTemplate.createStandardMetaTemplate(entityId, values, requestURL);
String extendedData = CreateIDFFMetaDataTemplate.createExtendedMetaTemplate(entityId, values);
EntityDescriptorElement descriptor = (EntityDescriptorElement) IDFFMetaUtils.convertStringToJAXB(metadata);
EntityConfigElement configElt = (EntityConfigElement) IDFFMetaUtils.convertStringToJAXB(extendedData);
metaManager.createEntityDescriptor(realm, descriptor);
metaManager.createEntityConfig(realm, configElt);
} catch (JAXBException ex) {
throw new AMConsoleException(ex.getMessage());
} catch (IDFFMetaException ex) {
throw new AMConsoleException(ex.getMessage());
}
}
use of com.sun.identity.federation.meta.IDFFMetaException in project OpenAM by OpenRock.
the class EntityModelImpl method isAffiliate.
/**
* Returns true if entity descriptor is an affiliate.
*
* @param protocol the Protocol to which entity belongs.
* @param realm the realm in which the entity resides.
* @param name Name of entity descriptor.
* @return true if entity descriptor is an affiliate.
*/
public boolean isAffiliate(String protocol, String realm, String name) throws AMConsoleException {
boolean isAffiliate = false;
com.sun.identity.liberty.ws.meta.jaxb.AffiliationDescriptorType idff_ad = null;
com.sun.identity.saml2.jaxb.metadata.AffiliationDescriptorType samlv2_sd = null;
try {
if (protocol.equals(IDFF)) {
IDFFMetaManager idffManager = new IDFFMetaManager(null);
idff_ad = (com.sun.identity.liberty.ws.meta.jaxb.AffiliationDescriptorType) idffManager.getAffiliationDescriptor(realm, name);
} else if (protocol.equals(SAMLV2)) {
SAML2MetaManager samlManager = new SAML2MetaManager();
samlv2_sd = (com.sun.identity.saml2.jaxb.metadata.AffiliationDescriptorType) samlManager.getAffiliationDescriptor(realm, name);
}
if (idff_ad != null || samlv2_sd != null) {
isAffiliate = true;
}
} catch (IDFFMetaException e) {
if (debug.warningEnabled()) {
debug.warning("EntityModelImpl.isAffiliate", e);
}
throw new AMConsoleException(getErrorString(e));
} catch (SAML2MetaException s) {
if (debug.warningEnabled()) {
debug.warning("EntityModel.isAffiliate() - " + "Couldn't get SAMLMetaManager");
}
throw new AMConsoleException(getErrorString(s));
}
return isAffiliate;
}
use of com.sun.identity.federation.meta.IDFFMetaException in project OpenAM by OpenRock.
the class EntityModelImpl method deleteIDFFEntity.
private void deleteIDFFEntity(String entityID, String realm) throws AMConsoleException {
try {
IDFFMetaManager metaManager = new IDFFMetaManager(null);
metaManager.deleteEntityDescriptor(realm, entityID);
} catch (IDFFMetaException e) {
throw new AMConsoleException(e.getMessage());
}
}
use of com.sun.identity.federation.meta.IDFFMetaException in project OpenAM by OpenRock.
the class EntityModelImpl method getIDFFEntities.
/**
* Returns a map of all the idff entities including data about
* what realm, the roles, and location of each entity.
*
* @throws AMConsoleException if unable to retrieve the IDFF entities.
*/
public Map getIDFFEntities() throws AMConsoleException {
Map idffMap = new HashMap();
try {
IDFFMetaManager idffManager = new IDFFMetaManager(null);
for (Iterator j = realms.iterator(); j.hasNext(); ) {
String realm = (String) j.next();
Set entities = idffManager.getAllEntities(realm);
List hostedEntities = idffManager.getAllHostedEntities(realm);
for (Iterator i = entities.iterator(); i.hasNext(); ) {
String name = (String) i.next();
Map data = new HashMap(8);
data.put(REALM, realm);
data.put(PROTOCOL, IDFF);
data.put(ROLE, listToString(getIDFFRoles(name, realm)));
if (isAffiliate(IDFF, realm, name)) {
data.put(LOCATION, "");
} else if ((hostedEntities != null) && hostedEntities.contains(name)) {
data.put(LOCATION, HOSTED);
} else {
data.put(LOCATION, REMOTE);
}
String entityNamewithRealm = name + "," + realm;
idffMap.put(entityNamewithRealm, (HashMap) data);
}
}
} catch (IDFFMetaException e) {
debug.warning("EntityModel.getIDFFEntities", e);
throw new AMConsoleException(e.getMessage());
}
return (idffMap != null) ? idffMap : Collections.EMPTY_MAP;
}
use of com.sun.identity.federation.meta.IDFFMetaException in project OpenAM by OpenRock.
the class BulkFederation method getEntityRoleAndIdIDFF.
private void getEntityRoleAndIdIDFF() throws CLIException {
try {
IDFFMetaManager idffMgr = new IDFFMetaManager(ssoToken);
String role = idffMgr.getProviderRoleByMetaAlias(metaAlias);
if (role == null) {
Object[] param = { metaAlias };
throw new CLIException(MessageFormat.format(getResourceString("bulk-federation-unknown-metaalias"), param), ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
}
isIDP = role.equals(IFSConstants.IDP);
localEntityId = idffMgr.getEntityIDByMetaAlias(metaAlias);
} catch (IDFFMetaException e) {
debugError("BulkFederation.getEntityRoleAndIdIDFF", e);
Object[] param = { metaAlias };
throw new CLIException(MessageFormat.format(getResourceString("bulk-federation-unknown-metaalias"), param), ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
}
}
Aggregations