public boolean handleRequest(MessageContext context) { // System.out.println("Entering LoggingHandler::handleRequest()"); /* try { SOAPMessageContext smsgct=(SOAPMessageContext) context; SOAPMessage msg=smsgct.getMessage(); SOAPEnvelope envelope=msg.getSOAPPart().getEnvelope(); SOAPHeader header=msg.getSOAPHeader(); if(header==null) { header=envelope.addHeader(); } SOAPHeaderElement accessElement=header.addHeaderElement( envelope.createName("logged","ns1", "http://example.com/jplag")); accessElement.addTextNode("You got logged!!"); } catch(SOAPException e) { e.printStackTrace(); }*/ logMessage("request", context); // System.out.println("Leaving LoggingHandler::handleRequest()"); return true; }
private void logMessage(String method, MessageContext context) { FileOutputStream fout = createFile(); if(fout==null) return; LogOutputStream out = new LogOutputStream(fout, true); try { out.println("<" + method + ">"); //Uncomment this statement to log the SOAP messages. out.println(logSOAPMessage(context)); out.println("</" + method + ">"); } catch (Exception ex) { ex.printStackTrace(System.out); throw new JAXRPCException("LoggingHandler: Unable to log the message in " + method + " - {" + ex.getClass().getName() + "}" + ex.getMessage()); } finally { out.flush(); out.close(); } }
private String logSOAPMessage(MessageContext context) { StringBuffer stringBuffer = new StringBuffer(); SOAPMessageContext smc = (SOAPMessageContext) context; SOAPMessage soapMessage = smc.getMessage(); /* try { SOAPBody soapBody = soapMessage.getSOAPBody(); NodeList list=soapBody.getElementsByTagName("inputZipFile"); } catch(Exception e) { // ignore filtering }*/ ByteArrayOutputStream bout= new ByteArrayOutputStream(); try { soapMessage.writeTo(bout); } catch(Exception e) { e.printStackTrace(System.out); } stringBuffer.append(bout.toString() + "\n"); return stringBuffer.toString(); }
/** * Adds an "Access" element to the SOAP header */ public boolean handleRequest(MessageContext msgct) { if (msgct instanceof SOAPMessageContext) { SOAPMessageContext smsgct = (SOAPMessageContext) msgct; try { SOAPMessage msg = smsgct.getMessage(); SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope(); SOAPHeader header = msg.getSOAPHeader(); if (header == null) header = envelope.addHeader(); // add an header if non exists SOAPHeaderElement accessElement = header.addHeaderElement(envelope.createName("Access", "ns0", JPLAG_TYPES_NS)); SOAPElement usernameelem = accessElement.addChildElement("username"); usernameelem.addTextNode(username); SOAPElement passwordelem = accessElement.addChildElement("password"); passwordelem.addTextNode(password); SOAPElement compatelem = accessElement.addChildElement("compatLevel"); compatelem.addTextNode(compatibilityLevel + ""); } catch (SOAPException x) { System.out.println("Unable to create access SOAP header!"); x.printStackTrace(); } } return true; }
/** * Adds an "Access" element to the SOAP header */ public boolean handleRequest(MessageContext msgct) { if(msgct instanceof SOAPMessageContext) { SOAPMessageContext smsgct=(SOAPMessageContext) msgct; try { SOAPMessage msg=smsgct.getMessage(); SOAPEnvelope envelope=msg.getSOAPPart().getEnvelope(); SOAPHeader header=msg.getSOAPHeader(); if(header==null) header=envelope.addHeader(); // add an header if non exists SOAPHeaderElement accessElement=header.addHeaderElement( envelope.createName("Access","ns0", "http://www.ipd.uni-karlsruhe.de/jplag/types")); SOAPElement usernameelem=accessElement.addChildElement( "username"); usernameelem.addTextNode(username); SOAPElement passwordelem=accessElement.addChildElement( "password"); passwordelem.addTextNode(password); SOAPElement compatelem=accessElement.addChildElement( "compatLevel"); compatelem.addTextNode(compatibilityLevel+""); } catch (SOAPException x) { System.out.println("Unable to create access SOAP header!"); x.printStackTrace(); } } return true; }
public boolean handleRequest(MessageContext mc) { mc.setProperty(ALLOW_FORM_OPTIMIZATION, Boolean.TRUE); try { return processMessage(mc, true); } catch (WSSecurityException e) { if (doDebug) { log.debug(e.getMessage(), e); } throw new JAXRPCException(e); } }
public boolean handleResponse(MessageContext mc) { mc.setProperty(ALLOW_FORM_OPTIMIZATION, Boolean.TRUE); try { return processMessage(mc, false); } catch (WSSecurityException e) { if (doDebug) { log.debug(e.getMessage(), e); } throw new JAXRPCException(e); } }
/** * Handles SOAP Faults that may occur during message processing */ public boolean handleFault(MessageContext mc) { if (doDebug) { log.debug("Entered handleFault"); } return true; }
/** * Switch for transferring control to doReceiver and doSender */ public boolean processMessage(MessageContext mc, boolean isRequestMessage) throws WSSecurityException { RequestData reqData = new RequestData(); reqData.setMsgContext(mc); doDebug = log.isDebugEnabled(); String deployment = null; String handleFlow = null; if ((deployment = (String) getOption(DEPLOYMENT)) == null) { deployment = (String) mc.getProperty(DEPLOYMENT); } if (deployment == null) { throw new JAXRPCException("WSS4JHandler.processMessage: No deployment defined"); } if ((handleFlow = (String) getOption(FLOW)) == null) { handleFlow = (String) mc.getProperty(FLOW); } if (handleFlow == null) { handleFlow = ""; } // call doSender if we are - // (handling request and client-side deployment) or (handling response and server-side deployment). // call doReceiver if we are - // (handling request and server-side deployment) or (handling response and client-side deployment). boolean needsHandling = ( isRequestMessage && !handleFlow.equals(RESPONSE_ONLY)) || (!isRequestMessage && !handleFlow.equals(REQUEST_ONLY)); try { if (deployment.equals(CLIENT_DEPLOYMENT) ^ isRequestMessage) { if (needsHandling) { return doReceiver(mc, reqData, isRequestMessage); } } else { if (needsHandling) { return doSender(mc, reqData, isRequestMessage); } } } finally { reqData.clear(); reqData = null; } return true; }
public boolean isPermitted(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { if(!operation.getNamespaceURI().equals(getServiceNamespace())){ return false; } if(operation.getLocalPart().equals("getMultipleResourceProperties")){ authorizeGetMultipleResourceProperties(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getResourceProperty")){ authorizeGetResourceProperty(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("queryResourceProperties")){ authorizeQueryResourceProperties(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getServiceSecurityMetadata")){ authorizeGetServiceSecurityMetadata(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getQuote")){ authorizeGetQuote(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getChart")){ authorizeGetChart(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("createPortfolio")){ authorizeCreatePortfolio(peerSubject, context, operation); return true; } return false; }
public boolean isPermitted(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { if(!operation.getNamespaceURI().equals(getServiceNamespace())){ return false; } if(operation.getLocalPart().equals("getMultipleResourceProperties")){ authorizeGetMultipleResourceProperties(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getResourceProperty")){ authorizeGetResourceProperty(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("queryResourceProperties")){ authorizeQueryResourceProperties(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getServiceSecurityMetadata")){ authorizeGetServiceSecurityMetadata(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("query")){ authorizeQuery(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("executeQuery")){ authorizeExecuteQuery(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("transferQuery")){ authorizeTransferQuery(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("executeTransferQuery")){ authorizeExecuteTransferQuery(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("extractCBMdata")){ authorizeExtractCBMdata(peerSubject, context, operation); return true; } return false; }
@Override public MessageContext getMessageContext() throws IllegalStateException { throw new UnsupportedOperationException(); }
public boolean handleResponse(MessageContext context) { logMessage("response", context); return true; }
public boolean handleFault(MessageContext context) { logMessage("fault", context); return true; }
public boolean handleRequest(MessageContext context) { return true; }
public boolean handleResponse(MessageContext context) { return true; }
public Object getProperty(Object msgContext, String key) { return ((MessageContext)msgContext).getProperty(key); }
public void setProperty(Object msgContext, String key, Object value) { ((MessageContext)msgContext).setProperty(key, value); }
public String getPassword(Object msgContext) { return (String) ((MessageContext)msgContext).getProperty(Call.PASSWORD_PROPERTY); }
public void setPassword(Object msgContext, String password) { ((MessageContext)msgContext).setProperty(Call.PASSWORD_PROPERTY, password); }
public boolean isPermitted(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { if(!operation.getNamespaceURI().equals(getServiceNamespace())){ return false; } if(operation.getLocalPart().equals("addTrustedAuthority")){ authorizeAddTrustedAuthority(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("findTrustedAuthorities")){ authorizeFindTrustedAuthorities(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("removeTrustedAuthority")){ authorizeRemoveTrustedAuthority(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("addPermission")){ authorizeAddPermission(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("findPermissions")){ authorizeFindPermissions(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("revokePermission")){ authorizeRevokePermission(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("updateTrustedAuthority")){ authorizeUpdateTrustedAuthority(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("addTrustLevel")){ authorizeAddTrustLevel(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("updateTrustLevel")){ authorizeUpdateTrustLevel(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getTrustLevels")){ authorizeGetTrustLevels(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("removeTrustLevel")){ authorizeRemoveTrustLevel(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("addAuthority")){ authorizeAddAuthority(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("updateAuthority")){ authorizeUpdateAuthority(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("updateAuthorityPriorities")){ authorizeUpdateAuthorityPriorities(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getAuthorities")){ authorizeGetAuthorities(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("removeAuthority")){ authorizeRemoveAuthority(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("updateCRL")){ authorizeUpdateCRL(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("validate")){ authorizeValidate(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getServiceSecurityMetadata")){ authorizeGetServiceSecurityMetadata(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getMultipleResourceProperties")){ authorizeGetMultipleResourceProperties(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getResourceProperty")){ authorizeGetResourceProperty(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("queryResourceProperties")){ authorizeQueryResourceProperties(peerSubject, context, operation); return true; } return false; }
public boolean isPermitted(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { if(!operation.getNamespaceURI().equals(getServiceNamespace())){ return false; } if(operation.getLocalPart().equals("getMultipleResourceProperties")){ authorizeGetMultipleResourceProperties(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getResourceProperty")){ authorizeGetResourceProperty(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("queryResourceProperties")){ authorizeQueryResourceProperties(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getServiceSecurityMetadata")){ authorizeGetServiceSecurityMetadata(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getAllAnnotations")){ authorizeGetAllAnnotations(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getAllConcepts")){ authorizeGetAllConcepts(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getAllOntologies")){ authorizeGetAllOntologies(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getAllResources")){ authorizeGetAllResources(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getAnnotations")){ authorizeGetAnnotations(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getConcepts")){ authorizeGetConcepts(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("isConcept")){ authorizeIsConcept(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("isConceptInAnyOntology")){ authorizeIsConceptInAnyOntology(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("isConcepts")){ authorizeIsConcepts(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("isConceptsInAnyOntology")){ authorizeIsConceptsInAnyOntology(peerSubject, context, operation); return true; } return false; }
public boolean isPermitted(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { if(!operation.getNamespaceURI().equals(getServiceNamespace())){ return false; } if(operation.getLocalPart().equals("initiateDelegation")){ authorizeInitiateDelegation(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("approveDelegation")){ authorizeApproveDelegation(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("findDelegatedCredentials")){ authorizeFindDelegatedCredentials(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("updateDelegatedCredentialStatus")){ authorizeUpdateDelegatedCredentialStatus(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("findCredentialsDelegatedToClient")){ authorizeFindCredentialsDelegatedToClient(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("searchDelegatedCredentialAuditLog")){ authorizeSearchDelegatedCredentialAuditLog(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("deleteDelegatedCredential")){ authorizeDeleteDelegatedCredential(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("addAdmin")){ authorizeAddAdmin(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("removeAdmin")){ authorizeRemoveAdmin(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getAdmins")){ authorizeGetAdmins(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getServiceSecurityMetadata")){ authorizeGetServiceSecurityMetadata(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getMultipleResourceProperties")){ authorizeGetMultipleResourceProperties(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("getResourceProperty")){ authorizeGetResourceProperty(peerSubject, context, operation); return true; } else if(operation.getLocalPart().equals("queryResourceProperties")){ authorizeQueryResourceProperties(peerSubject, context, operation); return true; } return false; }
public void authorizeTransferQuery(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { }
public void authorizeGetSubjectsWithGroupPrivilege(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { }
public void authorizeStartWorkflow(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { }
public void authorizeRemoveAdmin(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { }
public void authorizeGetMultipleResourceProperties(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { }
public void authorizeDisableMembershipRequests(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { }
public void authorizeGetServiceSecurityMetadata(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { }
public void authorizeGetKeywordsBySampleId(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { }
public void authorizeRequestHostCertificate(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { }
public void authorizeSetPublish(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { }
public void authorizeDestroy(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { }
public void authorizeGetOtherPointOfContactsBySampleId(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { }
public void authorizeGetAllCharacteristicCategories(Subject peerSubject, MessageContext context, QName operation) throws AuthorizationException { }