/** * Produces an ack MDN message for the incoming message. * @param envelope The incoming message that will have an MDN ack message sent to the senders. * @return A collection of notification messages that will be sent to the incoming message senders. */ public Collection<NotificationMessage> produce(IncomingMessage envelope) { if (envelope == null) { throw new IllegalArgumentException(); } if (!settings.isAutoResponse() || !envelope.hasDomainRecipients() || NotificationHelper.isMDN(envelope.getMessage())) { LOGGER.info("No MDN messages to send."); return Collections.emptyList(); } LOGGER.info("Generating MDN \"processed\" messages"); Collection<InternetAddress> senders = envelope.getDomainRecipients().toInternetAddressCollection(); Collection<NotificationMessage> notifications = NotificationHelper.createNotificationMessages(envelope.getMessage(), senders, this); return notifications; }
/** * Processes an incoming message represented by a raw string. The message will be decrypted and validated that it meets trust assertions. * @param messageText The raw contents of the incoming message that will be processed. * @return An incoming messaging object that contains the unwrapped and decrypted message. */ public IncomingMessage processIncoming(String messageText) { if (messageText == null || messageText.length() == 0) { throw new IllegalArgumentException(); } return processIncoming(new IncomingMessage(messageText)); }
protected void findSenderSignatures(IncomingMessage message) { message.setSenderSignatures(null); NHINDAddress sender = message.getSender(); Collection<DefaultMessageSignatureImpl> senderSignatures = new ArrayList<DefaultMessageSignatureImpl>(); // check for signatures at an individual level Collection<SignerCertPair> individualSenders = CryptoExtensions.findSignersByName(message.getSignature(), sender.getAddress(), null); // check for signatures at an org level Collection<SignerCertPair> orgSenders = CryptoExtensions.findSignersByName(message.getSignature(), sender.getHost(), Arrays.asList(new String[] {sender.getAddress()})); for (SignerCertPair pair : individualSenders) senderSignatures.add(new DefaultMessageSignatureImpl(pair.getSigner(), false, pair.getCertificate())); for (SignerCertPair pair : orgSenders) senderSignatures.add(new DefaultMessageSignatureImpl(pair.getSigner(), true, pair.getCertificate())); message.setSenderSignatures(senderSignatures); }
protected void processMessage(IncomingMessage message) if (message.getSender() == null) message.categorizeRecipients(this.getDomains()); if (!message.hasDomainRecipients()) message.setMessage(this.unwrapMessage(message.getMessage())); final TxMessageType msgType = TxUtil.getMessageType(message.getMessage()); for (NHINDAddress recipient : message.getDomainRecipients()) if (message.hasDomainRecipients()) message.categorizeRecipients(this.minTrustRequirement); if (!message.hasDomainRecipients()) message.updateRoutingHeaders();
for (X509Certificate cert : message.getDomainRecipients().getCertificates()) decryptedEntity = this.cryptographer.decrypt(message.getMessage(), privCert); break; decryptedEntity = new MimeEntity(message.getMessage().getRawInputStream());
message.setAgent(this); message.validate(); LOGGER.debug("Completed processing incoming message. Result message:\r\n" + EntitySerializer.Default.serialize(message.getMessage()) + "\r\n");
throw new IllegalArgumentException(); if (!message.hasSignatures()) throw new AgentException(AgentError.UntrustedMessage); if (!message.hasSenderSignatures()) throw new AgentException(AgentError.MissingSenderSignature); NHINDAddressCollection recipients = message.getDomainRecipients(); for (NHINDAddress recipient : recipients)
message.setSignature(signatures); Enumeration<Header> eHeaders = message.getMessage().getAllHeaders(); while (eHeaders.hasMoreElements()) message.setMessage(msg);
message.getSender().setCertificates(new ArrayList<X509Certificate>()); for (NHINDAddress recipient : message.getDomainRecipients())
@Override /** * {@inheritDoc} */ protected void categorizeRecipients(TrustEnforcementStatus minTrustStatus) { super.categorizeRecipients(minTrustStatus); this.getDomainRecipients().removeUntrusted(minTrustStatus); } }
protected DefaultMessageSignatureImpl findTrustedSignature(IncomingMessage message, InternetAddress recipient, Collection<X509Certificate> anchors) NHINDAddress sender = message.getSender(); Collection<DefaultMessageSignatureImpl> signatures = message.getSenderSignatures(); DefaultMessageSignatureImpl lastTrustedSignature = null;
/** * Processes a pre-enveloped message. The message will be decrypted and validated that it meets trust assertions. * @param envelope A message envelope containing the incoming message. * @return An incoming messaging object that contains the unwrapped and decrypted message. */ public IncomingMessage processIncoming(MessageEnvelope envelope) { if (envelope == null) { throw new IllegalArgumentException(); } this.checkEnvelopeAddresses(envelope); return this.processIncoming(new IncomingMessage(envelope)); }
/** * Processes an incoming message represented by a raw string. The message will be decrypted and validated that it meets trust assertions. * @param messageText The raw contents of the incoming message that will be processed. * @param recipients The recipients of the message. This overrides the routing headers in the message. * @param sender The sender of the message. This overrides the to FROM routing header in the message. * @return An incoming messaging object that contains the unwrapped and decrypted message. */ public IncomingMessage processIncoming(String messageText, NHINDAddressCollection recipients, NHINDAddress sender) { this.checkEnvelopeAddresses(recipients, sender); IncomingMessage message = new IncomingMessage(messageText, recipients, sender); return this.processIncoming(message); }
/** * Processes an incoming mime message. The message will be decrypted and validated that it meets trust assertions. * @param msg The incoming mime message. * @return An incoming messaging object that contains the unwrapped and decrypted message. */ public IncomingMessage processIncoming(MimeMessage msg) { if (msg == null) { throw new IllegalArgumentException(); } IncomingMessage inMsg = null; try { inMsg = new IncomingMessage(new Message(msg)); } catch (MessagingException e) { throw new MimeException(MimeError.InvalidMimeEntity, e); } return processIncoming(inMsg); }