use of com.sun.identity.liberty.ws.dst.DSTException in project OpenAM by OpenRock.
the class PPRequestHandler method processDSTRequest.
/**
* Processes query/modify request.
* @param request query or modify object.
* @param requestMsg Request Message.
* @param responseMsg Response Message.
* @return Object processed response object.
* @exception SOAPFaultException for the interaction redirects
* @exception Exception for any failure.
*/
public Object processDSTRequest(Object request, Message requestMsg, Message responseMsg) throws SOAPFaultException, DSTException {
IDPPUtils.debug.message("PPRequestHandler:processRequest:Init");
try {
IDPPServiceManager serviceManager = IDPPServiceManager.getInstance();
String providerID = serviceManager.getProviderID();
ProviderHeader ph = new ProviderHeader(providerID);
responseMsg.setProviderHeader(ph);
if (serviceManager.isServiceInstanceUpdateEnabled()) {
ServiceInstanceUpdateHeader siuHeader = getServiceInstanceUpdateHeader();
responseMsg.setServiceInstanceUpdateHeader(siuHeader);
}
if (request instanceof QueryElement) {
QueryElement query = (QueryElement) request;
Document doc = IDPPUtils.getDocumentBuilder().newDocument();
IDPPUtils.getMarshaller().setProperty("com.sun.xml.bind.namespacePrefixMapper", new NamespacePrefixMapperImpl());
IDPPUtils.getMarshaller().marshal(query, doc);
return processQueryRequest(query, providerID, requestMsg, doc);
} else if (request instanceof ModifyElement) {
ModifyElement modify = (ModifyElement) request;
Document doc = IDPPUtils.getDocumentBuilder().newDocument();
IDPPUtils.getMarshaller().setProperty("com.sun.xml.bind.namespacePrefixMapper", new NamespacePrefixMapperImpl());
IDPPUtils.getMarshaller().marshal(modify, doc);
return processModifyRequest(modify, providerID, requestMsg, doc);
} else {
IDPPUtils.debug.error("PPRequestHandler:processRequest:invalid" + " Request.");
throw new DSTException(IDPPUtils.bundle.getString("invalidRequest"));
}
} catch (IDPPException ie) {
IDPPUtils.debug.error("PPRequestHandler:processRequest fail", ie);
throw new DSTException(ie);
} catch (JAXBException je) {
IDPPUtils.debug.error("PPRequestHandler:processRequest fail", je);
throw new DSTException(IDPPUtils.bundle.getString("jaxbFailure"));
} catch (SOAPBindingException sbe) {
IDPPUtils.debug.error("PPRequestHandler:processRequest fail", sbe);
throw new DSTException(sbe);
}
}
use of com.sun.identity.liberty.ws.dst.DSTException in project OpenAM by OpenRock.
the class DSTRequestHandler method generateBinarySecurityToken.
/**
* Generates the binary security token if the security profile is X509.
* @param msg Request Message.
* @return BinarySecurityToken.
* @exception DSTException.
*/
private BinarySecurityToken generateBinarySecurityToken(Message msg) throws DSTException {
try {
SecurityTokenManager manager = new SecurityTokenManager(msg.getToken());
BinarySecurityToken binaryToken = manager.getX509CertificateToken();
binaryToken.setWSFVersion(msg.getWSFVersion());
return binaryToken;
} catch (Exception e) {
DSTUtils.debug.error("DSTRequestHandler:generateBinary" + "SecurityToken: Error in generating binary security token.", e);
throw new DSTException(e);
}
}
Aggregations