use of javax.xml.bind.JAXBException in project OpenAM by OpenRock.
the class SAMLv2ModelImpl method setExtauthnAuthValues.
/**
* Saves the extended attribute values for Authn Authority.
*
* @param realm to which the entity belongs.
* @param entityName is the entity id.
* @param authnAuthExtValues Map which contains the extended values.
* @param location has the information whether remote or hosted.
* @throws AMConsoleException if saving of attribute value fails.
*/
public void setExtauthnAuthValues(String realm, String entityName, Map authnAuthExtValues, String location) throws AMConsoleException {
String[] params = { realm, entityName, "SAMLv2", "AuthnAuthority-Ext" };
logEvent("ATTEMPT_MODIFY_AUTHN_AUTH_ATTR_VALUES", params);
String role = EntityModel.SAML_AUTHNAUTHORITY;
try {
SAML2MetaManager samlManager = getSAML2MetaManager();
//entityConfig is the extended entity configuration object
EntityConfigElement entityConfig = samlManager.getEntityConfig(realm, entityName);
//for remote cases
if (entityConfig == null) {
createExtendedObject(realm, entityName, location, role);
entityConfig = samlManager.getEntityConfig(realm, entityName);
}
AuthnAuthorityConfigElement authnAuthorityConfig = samlManager.getAuthnAuthorityConfig(realm, entityName);
if (authnAuthorityConfig != null) {
updateBaseConfig(authnAuthorityConfig, authnAuthExtValues, role);
}
//saves the attributes by passing the new entityConfig object
samlManager.setEntityConfig(realm, entityConfig);
logEvent("SUCCEED_MODIFY_AUTHN_AUTH_ATTR_VALUES", params);
} catch (SAML2MetaException e) {
debug.error("SAMLv2ModelImpl.setExtauthnAuthValues:", e);
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "AuthnAuthority-Ext", strError };
logEvent("FEDERATION_EXCEPTION_MODIFY_AUTHN_AUTH_ATTR_VALUES", paramsEx);
} catch (JAXBException e) {
debug.error("SAMLv2ModelImpl.setExtauthnAuthValues:", e);
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "AuthnAuthority-Extended", strError };
logEvent("FEDERATION_EXCEPTION_MODIFY_AUTHN_AUTH_ATTR_VALUES", paramsEx);
} catch (AMConsoleException e) {
debug.error("SAMLv2ModelImpl.setExtauthnAuthValues:", e);
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "AuthnAuthority-Ext", strError };
logEvent("FEDERATION_EXCEPTION_MODIFY_AUTHN_AUTH_ATTR_VALUES", paramsEx);
}
}
use of javax.xml.bind.JAXBException in project OpenAM by OpenRock.
the class SAMLv2ModelImpl method setExtAttributeAuthorityValues.
/**
* Saves the extended attribute values for Attribute Authority.
*
* @param realm to which the entity belongs.
* @param entityName is the entity id.
* @param attrAuthExtValues Map which contains the extended values.
* @param location has the information whether remote or hosted.
* @throws AMConsoleException if saving of attribute value fails.
*/
public void setExtAttributeAuthorityValues(String realm, String entityName, Map attrAuthExtValues, String location) throws AMConsoleException {
String[] params = { realm, entityName, "SAMLv2", "AttribAuthority-Ext" };
logEvent("ATTEMPT_MODIFY_ATTR_AUTH_ATTR_VALUES", params);
String role = EntityModel.SAML_ATTRAUTHORITY;
try {
SAML2MetaManager samlManager = getSAML2MetaManager();
EntityConfigElement entityConfig = samlManager.getEntityConfig(realm, entityName);
//for remote cases
if (entityConfig == null) {
createExtendedObject(realm, entityName, location, role);
entityConfig = samlManager.getEntityConfig(realm, entityName);
}
AttributeAuthorityConfigElement attributeAuthorityConfig = samlManager.getAttributeAuthorityConfig(realm, entityName);
if (attributeAuthorityConfig != null) {
updateBaseConfig(attributeAuthorityConfig, attrAuthExtValues, role);
}
//saves the attributes by passing the new entityConfig object
samlManager.setEntityConfig(realm, entityConfig);
logEvent("SUCCEED_MODIFY_ATTR_AUTH_ATTR_VALUES", params);
} catch (SAML2MetaException e) {
debug.error("SAMLv2ModelImpl.setExtAttributeAuthorityValues:", e);
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "AttribAuthority-Ext", strError };
logEvent("FEDERATION_EXCEPTION_MODIFY_ATTR_AUTH_ATTR_VALUES", paramsEx);
} catch (JAXBException e) {
debug.error("SAMLv2ModelImpl.setExtAttributeAuthorityValues:", e);
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "AttribAuthority-Extended", strError };
logEvent("FEDERATION_EXCEPTION_MODIFY_ATTR_AUTH_ATTR_VALUES", paramsEx);
} catch (AMConsoleException e) {
debug.error("SAMLv2ModelImpl.setExtAttributeAuthorityValues:", e);
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "AttribAuthority-Ext", strError };
logEvent("FEDERATION_EXCEPTION_MODIFY_ATTR_AUTH_ATTR_VALUES", paramsEx);
}
}
use of javax.xml.bind.JAXBException in project OpenAM by OpenRock.
the class WSFedPropertiesModelImpl method setSPExtAttributeValues.
/**
* Saves the extended metadata attribute values for the SP.
*
* @param realm to which the entity belongs.
* @param fedId is the entity id.
* @param spExtvalues has the extended attribute value pairs of SP.
* @param location has the information whether remote or hosted.
* @throws AMConsoleException if saving of attribute value fails.
*/
public void setSPExtAttributeValues(String realm, String fedId, Map spExtvalues, String location) throws AMConsoleException {
try {
String role = EntityModel.SERVICE_PROVIDER;
//fed is the extended entity configuration object under the realm
WSFederationMetaManager metaManager = getWSFederationMetaManager();
FederationConfigElement fed = metaManager.getEntityConfig(realm, fedId);
if (fed == null) {
SPEX_DATA_MAP.put(TF_DISPNAME, Collections.EMPTY_SET);
createExtendedObject(realm, fedId, location, SERVICE_PROVIDER, SPEX_DATA_MAP);
fed = metaManager.getEntityConfig(realm, fedId);
}
SPSSOConfigElement spsso = getspsso(fed);
if (spsso != null) {
BaseConfigType baseConfig = (BaseConfigType) spsso;
updateBaseConfig(baseConfig, spExtvalues, role);
}
//saves the attributes by passing the new fed object
metaManager.setEntityConfig(realm, fed);
} catch (JAXBException e) {
debug.warning("WSFedPropertiesModelImpl.setSPExtAttributeValues", e);
throw new AMConsoleException(e.getMessage());
} catch (WSFederationMetaException e) {
debug.warning("WSFedPropertiesModelImpl.setSPExtAttributeValues", e);
throw new AMConsoleException(e.getMessage());
}
}
use of javax.xml.bind.JAXBException in project OpenAM by OpenRock.
the class WSFedPropertiesModelImpl method createAttributeElement.
/**
* Returns BaseConfig object after updating with Attribute Elements.
* @param values contain the keys for extended metadata attributes.
* @param bconfig is the BaseConfigType object passed.
*
* @return BaseConfig object after updating with Attribute Elements.
*/
private BaseConfigType createAttributeElement(Map values, BaseConfigType bconfig) throws AMConsoleException {
try {
ObjectFactory objFactory = new ObjectFactory();
for (Iterator iter = values.keySet().iterator(); iter.hasNext(); ) {
AttributeElement avp = objFactory.createAttributeElement();
String key = (String) iter.next();
avp.setName(key);
bconfig.getAttribute().add(avp);
}
} catch (JAXBException e) {
debug.warning("WSFedPropertiesModelImpl.createAttributeElement", e);
throw new AMConsoleException(e.getMessage());
}
return bconfig;
}
use of javax.xml.bind.JAXBException in project OpenAM by OpenRock.
the class CreateMetaDataTemplate method buildWSFedDescriptorTemplate.
private void buildWSFedDescriptorTemplate() throws CLIException {
Writer pw = null;
try {
boolean writeToFile = !isWebBased && (metadata != null) && (metadata.length() > 0);
if (writeToFile) {
pw = new PrintWriter(new FileWriter(metadata));
} else {
pw = new StringWriter();
}
String xml = CreateWSFedMetaDataTemplate.createStandardMetaTemplate(entityID, getWorkflowParamMap(), protocol + "://" + host + ":" + port + deploymentURI);
pw.write(xml);
if (writeToFile) {
Object[] objs = { metadata };
getOutputWriter().printlnMessage(MessageFormat.format(getResourceString("create-meta-template-created-descriptor-template"), objs));
}
} catch (IOException e) {
Object[] objs = { metadata };
throw new CLIException(MessageFormat.format(getResourceString("cannot-write-to-file"), objs), ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
} catch (JAXBException e) {
throw new CLIException(e.getMessage(), ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
} catch (CertificateEncodingException e) {
throw new CLIException(e.getMessage(), ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
} finally {
if ((pw != null) && (pw instanceof PrintWriter)) {
((PrintWriter) pw).close();
} else {
this.getOutputWriter().printlnMessage(((StringWriter) pw).toString());
}
}
}
Aggregations