Commit Graph

15 Commits

Author SHA1 Message Date
Simon Ser
a95896216f Migrate to go-imap v2
v1 is no longer actively maintained.

Co-authored-by: Conrad Hoffmann <ch@bitfehler.net>
2024-04-19 15:23:37 +02:00
Simon Ser
ebb5aede92 Add OAuth 2.0 backend 2024-02-21 17:07:08 +01:00
Conrad Hoffmann
a115c50037 auth/*: more consistent logging 2024-02-05 22:24:17 +01:00
Conrad Hoffmann
a87520cb0f Add htpasswd-style static file auth module
Can be used via `-auth.url=file://`. Only supports bcrypt password
hashes ($2y). Use e.g. `htpasswd -c -BC 14 <filename> <user>` to create
a file. Documentation forthcoming.
2024-02-05 17:23:11 +01:00
Conrad Hoffmann
1d871b000a Add a "null" auth backend
Not built by default, but can be added with `go build -tags nullauth`.
Enabled by running tokidoki with `-auth.url null://`. Very useful for
simpler debugging when you don't want manage test accounts with actual
passwords.
2024-02-02 22:34:15 +01:00
Conrad Hoffmann
40bae8dc31 Switch to a proper logging library
Structured logs can be enabled with `-log.json`.
2022-12-01 13:46:25 +01:00
Simon Ser
10587f425b auth: add PAM support
Handy for small local installations.

Disabled by default because it adds a dependency on the PAM
library.
2022-09-13 10:04:45 +02:00
Simon Ser
e443b02acf auth/imap: close IMAP connection earlier
No need to keep it around after Authenticate succeeds while handling
the HTTP request (via next.ServeHTTP).
2022-05-24 13:27:15 +02:00
Conrad Hoffmann
c2f35df455 Add some debug output to auth module 2022-05-03 16:59:39 +02:00
Conrad Hoffmann
78bd2a9b84 Keep context keys private
Instead, offer type safe accessors, as documented here:

https://pkg.go.dev/context#Context
2022-03-16 14:33:47 +01:00
Conrad Hoffmann
3e464747d8 Define and use an auth context structure 2022-02-23 21:09:20 +01:00
Conrad Hoffmann
071ee7c729 Implement configurable auth providers
New providers need to "register" their URL scheme of choice in
auth.NewFromURL().

Implements: https://todo.sr.ht/~sircmpwn/tokidoki/1
2022-02-22 11:44:37 +01:00
Simon Ser
13008e0d96 go fmt 2022-02-21 11:11:27 +01:00
Drew DeVault
5a641ceca1 Implement IMAP auth provider 2022-02-21 10:55:02 +01:00
Drew DeVault
c804095480 Initial commit 2022-02-21 09:52:55 +01:00