|
1 | 1 | # Mailauth |
2 | 2 |
|
3 | | -Mailauth is a Mailbox Manager which enables you too select between your Mailboxes and authenticate with your Mailserver (like [mailcow](https://github.com/mailcow/mailcow-dockerized)) |
| 3 | +Mailauth is a mailbox manager that allows users to select between multiple mailboxes and authenticate with their mail server (such as [mailcow](https://github.com/mailcow/mailcow-dockerized)) through an OAuth2-compatible identity provider. |
4 | 4 |
|
5 | 5 | ## Screenshots |
6 | 6 |
|
7 | | - |
| 7 | +**Home** |
| 8 | + |
| 9 | + |
| 10 | +**Select flow** |
| 11 | + |
8 | 12 |
|
9 | 13 | ## Getting Started |
10 | 14 |
|
11 | | -Get the latest version of the `docker-compose.yaml` file: |
| 15 | +### Docker Compose |
| 16 | + |
| 17 | +Download the latest version of the `docker-compose.yaml` file: |
12 | 18 |
|
13 | 19 | ```yaml |
14 | | -{{{ #://docker-compose.yaml }}} |
| 20 | ++{{{ read "docker-compose.yaml" }}} |
15 | 21 | ``` |
16 | 22 |
|
17 | | -### Setup |
| 23 | +### Configuration |
18 | 24 |
|
19 | | -Mailauth _currently_ works by modifying the `email` claim during Token Exchange and Userinfo, |
20 | | -this means that you **will have to** use a IdP (like [authentik](https://goauthentik.io)). |
| 25 | +Mailauth currently works by modifying the `email` claim during OAuth2 **Token Exchange** and **UserInfo** requests. |
21 | 26 |
|
22 | | -Create a `.env` file inside of you `docker-compose.yaml` directory and copy the template below |
| 27 | +Because of this, Mailauth requires an external Identity Provider (IdP), such as [authentik](https://goauthentik.io). |
| 28 | + |
| 29 | +Create a `.env` file in the same directory as your `docker-compose.yaml` and copy the configuration template: |
23 | 30 |
|
24 | 31 | ```dotenv |
25 | | -{{{ #://examples/config.env }}} |
| 32 | ++{{{ read "examples/config.env" }}} |
26 | 33 | ``` |
27 | 34 |
|
28 | | -Now you need to setup a Oauth Authentication Method in your mailserver, |
29 | | -but instead of using your IdP's endpoints you use: |
| 35 | +### OAuth Setup |
30 | 36 |
|
31 | | -* `/oauth/mail/authorize` |
32 | | -* `/oauth/mail/token` |
33 | | -* `/oauth/mail/userinfo` |
| 37 | +Configure an OAuth authentication method in your mail server. |
34 | 38 |
|
35 | | -And set Redirect URI to the one from your `.env` file. |
| 39 | +Instead of using your IdP's OAuth endpoints, use the Mailauth endpoints: |
36 | 40 |
|
37 | | -Next create `init-mongo.js` in your working directory: |
| 41 | +| Endpoint | URL | |
| 42 | +| -------------- | ----------------------- | |
| 43 | +| Authorization | `/oauth/mail/authorize` | |
| 44 | +| Token Exchange | `/oauth/mail/token` | |
| 45 | +| User Info | `/oauth/mail/userinfo` | |
38 | 46 |
|
39 | | -```js |
40 | | -{{{ #://examples/init-mongo.js }}} |
41 | | -``` |
| 47 | +Set the redirect URI to the value configured in your `.env` file. |
42 | 48 |
|
43 | | -### Reverse Proxy |
| 49 | +## Reverse Proxy |
44 | 50 |
|
45 | | -When working with OAuth2 and Auth in general it is recommended to be sure to use secure connections, |
46 | | -here you will see a Reverse Proxy implementation with traefik: |
| 51 | +OAuth2 authentication should always be used over a secure connection. |
| 52 | + |
| 53 | +The following example shows a reverse proxy setup using Traefik: |
47 | 54 |
|
48 | 55 | ```yaml |
49 | | -{{{ #://examples/traefik.docker-compose.yaml }}} |
| 56 | ++{{{ read "examples/traefik.docker-compose.yaml" }}} |
50 | 57 | ``` |
51 | 58 |
|
52 | 59 | ## Usage |
53 | 60 |
|
54 | | -When authenticating via mailauth you get redirected to your actual IdP then to `/select`, |
55 | | -where you will be able to select your mailbox, mailauth changes the `email` claim and now you're logged in. |
| 61 | +When authenticating through Mailauth: |
| 62 | + |
| 63 | +1. You are redirected to your configured IdP. |
| 64 | +2. After successful authentication, Mailauth redirects you to the mailbox selection page. |
| 65 | +3. You select the mailbox you want to authenticate with. |
| 66 | +4. Mailauth updates the `email` claim and completes the OAuth2 flow. |
| 67 | + |
| 68 | +You are now authenticated with the selected mailbox. |
56 | 69 |
|
57 | 70 | ## Contributing |
58 | 71 |
|
59 | | -Found an Issue or want to see something implemented into Mailauth? |
60 | | -Open up an Issue or start a Pull Request! |
| 72 | +Found a bug or have an idea for improving Mailauth? |
| 73 | + |
| 74 | +Feel free to open an issue or submit a pull request. |
61 | 75 |
|
62 | | -But always be respectful and patient, we are all volunteers after all. |
| 76 | +Please be respectful and patient when contributing. Mailauth is maintained by volunteers. |
63 | 77 |
|
64 | 78 | ## Supporting |
65 | 79 |
|
66 | | -Found this Project useful? Let others know about Mailauth by ⭐️ this Repo! |
| 80 | +If you find Mailauth useful, consider giving the repository a ⭐ to help others discover it. |
67 | 81 |
|
68 | 82 | ## License |
69 | 83 |
|
70 | | -[MIT](https://choosealicense.com/licenses/mit/) |
| 84 | +This Project is licensed under the [MIT License](./LICENSE). |
0 commit comments