loopingz / smtp-relay

SMTP Toolbox
GNU Lesser General Public License v3.0
32 stars 3 forks source link

Filter http-auth not imported #70

Closed maximevalette closed 1 year ago

maximevalette commented 1 year ago

Describe the bug The filter http-auth appears to not be imported into the project and therefore cannot be used.

# docker-compose up
Starting please_smtp-relay_1 ... done
Attaching to please_smtp-relay_1
smtp-relay_1  | file:///smtp-relay/lib/filter.js:23
smtp-relay_1  |             throw new Error(`${config.type} is an unknown filter type`);
smtp-relay_1  |                   ^
smtp-relay_1  | 
smtp-relay_1  | Error: http-auth is an unknown filter type
smtp-relay_1  |     at SmtpFilter.get (file:///smtp-relay/lib/filter.js:23:19)
smtp-relay_1  |     at file:///smtp-relay/lib/flow.js:19:64
smtp-relay_1  |     at Array.map (<anonymous>)
smtp-relay_1  |     at new SmtpFlow (file:///smtp-relay/lib/flow.js:19:39)
smtp-relay_1  |     at new SmtpServer (file:///smtp-relay/lib/server.js:62:29)
smtp-relay_1  |     at file:///smtp-relay/lib/index.js:53:16
smtp-relay_1  |     at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
smtp-relay_1  | 
smtp-relay_1  | Node.js v18.17.1
please_smtp-relay_1 exited with code 1

To Reproduce Steps to reproduce the behavior:

  1. Add the http-auth filter into the config file

Expected behavior The http-auth filter should be working

loopingz commented 1 year ago

Hi, so the doc is a bit ahead as in fact the http-auth was never implemented: https://github.com/loopingz/smtp-relay/blob/main/src/filters/http-auth.ts

It is pretty easy to implement, will try to do so today.

I'm curious how do you see you endpoint implementation:

Then to parse the answer either rely solely on HTTP error code on a path within json with condition

maximevalette commented 1 year ago

Hi, thanks a lot, really appreciate it! I wanted to open a PR but thought that it was probably not that helpful.

For my use case I'd like to have the authenticated username (the password would be a security issue for me) and the sender / recipient. JSON body would work for me.

loopingz commented 1 year ago

Okay so likely closer to what I could call an http-filter, getting a JSON of all gathered data and filtering based on this.

loopingz commented 1 year ago

The release 1.4.0 includes the changes, let me know if you have questions configuring/implementing. Do not hesitate to open PR to clarify part of the documentation, and if you like the project, please star it, it helps with visibility.

maximevalette commented 1 year ago

Awesome, I tried it and it works perfectly. Thanks again for this quick update!