Implement the backend for logins
Presently, logins are mocked up and hard coded for testing purposes:
(command.go, line 51ish)
// TODO: implement login if c.userId == "test" { sess.st = authenticated return ok(c.tag, "LOGIN completed") }
This needs to be replaced with a system that calls upon the mail store to check Authentications:
We need to add:
- [x] Method in Mailstore interface to do authentication
- [x] Update login command to use this interface
- [ ] Write test in command_test.go
- [x] Update demo to use this.
It might be good to separate authentication into a separate interface. Alex suggested this in his changes to the README.
I would love to help on this one. Ideally, we would indeed use a minimalistic interface to do authentication, so anyone could implement it if their favorite backend isn't supported.
Writing tests does seem like a good thing to do, but I would not have any idea about how to test this, other than for the 'dummy' implementation? Thoughts?
One should be able to keep their "authentication" backend separate from their "mail storage" backend. In an extreme (unlikely) scenario, one would use MySQL for the authentication, PostgreSQL for the metadata, and OpenStack Swift for the actual mail storage. All we need is a way to uniquely identify users (e-mail address?) and share that across the different possibly backends.
I'm not yet that familiar with "the git way", when doing anything more than hotfixes. I know I can create another branch, and put a PR up for that. Not sure what you prefer for the discussing about the PR. (at this issue, at that PR, or at the specific commits?)
Another thing I'm not really sure on how to handle it. Multiple implementations are nice, but where do we store them? Keeping them all in the same package, would turn into a lot of (go) dependencies. But I don't see any conditional package-loading being done in Go, so I'm not really sure ... (I don't know if these dependencies are bad, since the end-result is just one simple binary)
It's a WIP, but I've made a start here: https://github.com/EtienneBruines/imapsrv/commit/c2a8da82c60e55d994a9d70c298d17d465ec1090
Hello, you're a contributor now so please take any issues you want. My preference is for Auth and Mailstorage to be interfaces and then people can provide their own implementations.
I see you have already added MySQL and BoltDB in a subpackage - I think this is a good solution. There is no need to add a lot of backends unless you really want to.