use of com.sun.identity.federation.jaxb.entityconfig.EntityConfigElement in project OpenAM by OpenRock.
the class IDFFModelImpl method updateIDPEntityConfig.
/**
* Modifies a identity provider's extended metadata.
*
* @param entityName name of Entity Descriptor.
* @param realm where entity exists.
* @param attrValues Map of attribute name to set of values.
* @throws AMConsoleException if provider cannot be modified.
* @throws JAXBException if provider cannot be retrieved.
*/
public void updateIDPEntityConfig(String realm, String entityName, Map attrValues) throws AMConsoleException {
String[] params = { realm, entityName, "IDFF", "IDP-Extended Metadata" };
logEvent("ATTEMPT_MODIFY_ENTITY_DESCRIPTOR", params);
try {
IDFFMetaManager idffMetaMgr = getIDFFMetaManager();
EntityConfigElement entityConfig = idffMetaMgr.getEntityConfig(realm, entityName);
if (entityConfig == null) {
throw new AMConsoleException("invalid.entity.name");
}
IDPDescriptorConfigElement idpDecConfigElement = idffMetaMgr.getIDPDescriptorConfig(realm, entityName);
if (idpDecConfigElement == null) {
throw new AMConsoleException("invalid.config.element");
} else {
updateAttrInConfig(idpDecConfigElement, attrValues, EntityModel.IDENTITY_PROVIDER);
}
//saves the attributes by passing the new entityConfig object
idffMetaMgr.setEntityConfig(realm, entityConfig);
logEvent("SUCCEED_MODIFY_ENTITY_DESCRIPTOR", params);
} catch (IDFFMetaException e) {
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "IDFF", "IDP-Extended Metadata", strError };
logEvent("FEDERATION_EXCEPTION_MODIFY_ENTITY_DESCRIPTOR", paramsEx);
throw new AMConsoleException(strError);
} catch (JAXBException e) {
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "IDFF", "IDP-Extended Metadata", strError };
logEvent("FEDERATION_EXCEPTION_MODIFY_ENTITY_DESCRIPTOR", paramsEx);
throw new AMConsoleException(strError);
}
}
use of com.sun.identity.federation.jaxb.entityconfig.EntityConfigElement in project OpenAM by OpenRock.
the class IDFFModelImpl method updateSPEntityConfig.
/**
* Modifies a service provider's extended metadata.
*
* @param realm where entity exists.
* @param entityName name of Entity Descriptor.
* @param attrValues Map of attribute name to set of values.
* @throws AMConsoleException if provider cannot be modified.
* @throws JAXBException if provider cannot be retrieved.
*/
public void updateSPEntityConfig(String realm, String entityName, Map attrValues) throws AMConsoleException {
String[] params = { realm, entityName, "IDFF", "SP-Extended Metadata" };
logEvent("ATTEMPT_MODIFY_ENTITY_DESCRIPTOR", params);
try {
IDFFMetaManager idffMetaMgr = getIDFFMetaManager();
EntityConfigElement entityConfig = idffMetaMgr.getEntityConfig(realm, entityName);
if (entityConfig == null) {
throw new AMConsoleException("invalid.entity.name");
}
SPDescriptorConfigElement spDecConfigElement = idffMetaMgr.getSPDescriptorConfig(realm, entityName);
if (spDecConfigElement == null) {
throw new AMConsoleException("invalid.config.element");
} else {
// update sp entity config
updateAttrInConfig(spDecConfigElement, attrValues, EntityModel.SERVICE_PROVIDER);
//handle supported sso profile
List supportedSSOProfileList = new ArrayList();
supportedSSOProfileList.add((String) AMAdminUtils.getValue((Set) attrValues.get(ATTR_SUPPORTED_SSO_PROFILE)));
int size = supportedSSOProfileList.size();
for (int i = 0; i < size; i++) {
if (!supportedSSOProfileList.get(i).equals((String) AMAdminUtils.getValue((Set) attrValues.get(ATTR_SUPPORTED_SSO_PROFILE)))) {
supportedSSOProfileList.add(supportedSSOProfileList.get(i));
}
}
updateAttrInConfig(spDecConfigElement, ATTR_SUPPORTED_SSO_PROFILE, supportedSSOProfileList);
}
//saves the attributes by passing the new entityConfig object
idffMetaMgr.setEntityConfig(realm, entityConfig);
logEvent("SUCCEED_MODIFY_ENTITY_DESCRIPTOR", params);
} catch (IDFFMetaException e) {
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "IDFF", "SP-Extended Metadata", strError };
logEvent("FEDERATION_EXCEPTION_MODIFY_ENTITY_DESCRIPTOR", paramsEx);
throw new AMConsoleException(strError);
} catch (JAXBException e) {
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "IDFF", "IDP-Extended Metadata", strError };
logEvent("FEDERATION_EXCEPTION_MODIFY_ENTITY_DESCRIPTOR", paramsEx);
throw new AMConsoleException(strError);
}
}
use of com.sun.identity.federation.jaxb.entityconfig.EntityConfigElement in project OpenAM by OpenRock.
the class IDFFModelImpl method updateSPAuthenticationContexts.
/**
* update SP Authentication Contexts
*
* @param realm Realm of Entity
* @param entityName Name of Entity Descriptor.
* @param cxt IDFFAuthContexts object contains SP
* Authentication Contexts values
*/
public void updateSPAuthenticationContexts(String realm, String entityName, IDFFAuthContexts cxt) throws AMConsoleException {
List list = cxt.toSPAuthContextInfo();
String[] params = { realm, entityName, "IDFF", "SP-updateSPAuthenticationContexts" };
logEvent("ATTEMPT_MODIFY_ENTITY_DESCRIPTOR", params);
try {
IDFFMetaManager idffMetaMgr = getIDFFMetaManager();
EntityConfigElement entityConfig = idffMetaMgr.getEntityConfig(realm, entityName);
if (entityConfig == null) {
throw new AMConsoleException("invalid.entity.name");
}
SPDescriptorConfigElement spDecConfigElement = idffMetaMgr.getSPDescriptorConfig(realm, entityName);
if (spDecConfigElement == null) {
throw new AMConsoleException("invalid.config.element");
} else {
// update sp entity config
updateAttrInConfig(spDecConfigElement, ATTR_SP_AUTHN_CONTEXT_MAPPING, list);
}
//saves the attributes by passing the new entityConfig object
idffMetaMgr.setEntityConfig(realm, entityConfig);
logEvent("SUCCEED_MODIFY_ENTITY_DESCRIPTOR", params);
} catch (IDFFMetaException e) {
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "IDFF", "SP-updateSPAuthenticationContexts", strError };
logEvent("FEDERATION_EXCEPTION_MODIFY_ENTITY_DESCRIPTOR", paramsEx);
throw new AMConsoleException(strError);
}
return;
}
use of com.sun.identity.federation.jaxb.entityconfig.EntityConfigElement in project OpenAM by OpenRock.
the class IDFFModelImpl method updateIDPAuthenticationContexts.
/**
* update IDP Authentication Contexts
*
* @param realm Realm of Entity
* @param entityName Name of Entity Descriptor.
* @param cxt IDFFAuthContexts object contains IDP
* Authentication Contexts values
*/
public void updateIDPAuthenticationContexts(String realm, String entityName, IDFFAuthContexts cxt) throws AMConsoleException {
List list = cxt.toIDPAuthContextInfo();
String[] params = { realm, entityName, "IDFF", "IDP-updateIDPAuthenticationContexts" };
logEvent("ATTEMPT_MODIFY_ENTITY_DESCRIPTOR", params);
try {
IDFFMetaManager idffMetaMgr = getIDFFMetaManager();
EntityConfigElement entityConfig = idffMetaMgr.getEntityConfig(realm, entityName);
if (entityConfig == null) {
throw new AMConsoleException("invalid.entity.name");
}
IDPDescriptorConfigElement idpDecConfigElement = idffMetaMgr.getIDPDescriptorConfig(realm, entityName);
if (idpDecConfigElement == null) {
throw new AMConsoleException("invalid.config.element");
} else {
updateAttrInConfig(idpDecConfigElement, ATTR_IDP_AUTHN_CONTEXT_MAPPING, list);
}
//saves the attributes by passing the new entityConfig object
idffMetaMgr.setEntityConfig(realm, entityConfig);
logEvent("SUCCEED_MODIFY_ENTITY_DESCRIPTOR", params);
} catch (IDFFMetaException e) {
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "IDFF", "IDP-updateIDPAuthenticationContexts", strError };
logEvent("FEDERATION_EXCEPTION_MODIFY_ENTITY_DESCRIPTOR", paramsEx);
throw new AMConsoleException(strError);
}
return;
}
use of com.sun.identity.federation.jaxb.entityconfig.EntityConfigElement 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());
}
}
Aggregations