|
| 1 | +# mailserver-admin configuration |
| 2 | + |
| 3 | +## OAuth2 |
| 4 | + |
| 5 | +To use OAuth2, you need to create a new OAuth2 client in your OAuth2 provider. The redirect URI should be |
| 6 | +`https://example.com/login/check-oauth`. The client ID and client secret should be added to the `.env` file. |
| 7 | + |
| 8 | +Depending on your needs, you can configure `mailserver-admin` to give admin rights to a user by testing for a specific group in the groups |
| 9 | +field of the OAuth user information. Set the name of your administrator group to the `OAUTH_ADMIN_GROUP` variable in the `.env` file. If you |
| 10 | +leave `OAUTH_ADMIN_GROUP` empty, all authenticated users will have admin rights. You must make sure to handle the login permissions in your |
| 11 | +OAuth2 provider. |
| 12 | + |
| 13 | +### OAuth2 configuration example |
| 14 | + |
| 15 | +```bash |
| 16 | +OAUTH_ENABLED=true |
| 17 | +OAUTH_CLIENT_ID=xxxxx-xxxx-xxxx-xxxx-xxxxxxx |
| 18 | +OAUTH_CLIENT_SECRET=xxxxxxxxxxxxx |
| 19 | +OAUTH_CLIENT_SCOPES="email profile groups" |
| 20 | +OAUTH_AUTHORIZATION_URL=https://id.example.com/authorize |
| 21 | +OAUTH_ACCESS_TOKEN_URL=https://id.example.com/api/oidc/token |
| 22 | +OAUTH_INFOS_URL=https://id.example.com/api/oidc/userinfo |
| 23 | +OAUTH_BUTTON_TEXT="Login with OIDC" |
| 24 | +OAUTH_ADMIN_GROUP=admin |
| 25 | +OAUTH_PATHS_IDENTIFIER=sub |
| 26 | +``` |
| 27 | + |
| 28 | +## Environment variables |
| 29 | + |
| 30 | +The following environment variables can be set in the `.env` file or in the environment: |
| 31 | + |
| 32 | +### General |
| 33 | + |
| 34 | +- `APP_ENV`: The environment the application is running in. Default: `prod` |
| 35 | +- `APP_SECRET`: A secret key used by Symfony for various purposes (e.g., CSRF tokens). Default: `randomly generated`. |
| 36 | +- `CSRF_ENABLED`: Whether CSRF protection is enabled. Default: `true`. |
| 37 | +- `TRUSTED_PROXIES`: A list of trusted proxy IP addresses. |
| 38 | + |
| 39 | +### Database |
| 40 | + |
| 41 | +- `MYSQL_USER`: The MySQL database user. |
| 42 | +- `MYSQL_PASSWORD`: The MySQL database password. |
| 43 | +- `MYSQL_HOST`: The MySQL database host. |
| 44 | +- `MYSQL_DATABASE`: The MySQL database name. |
| 45 | +- `REDIS_HOST`: The Redis server host. |
| 46 | +- `REDIS_PORT`: The Redis server port. |
| 47 | +- `REDIS_PASSWORD`: The Redis server password. |
| 48 | + |
| 49 | +### OAuth2 |
| 50 | + |
| 51 | +- `OAUTH_ENABLED`: Whether OAuth2 is enabled. Default: `false`. |
| 52 | +- `OAUTH_CLIENT_ID`: The client ID for the OAuth2 provider. |
| 53 | +- `OAUTH_CLIENT_SECRET`: The client secret for the OAuth2 provider. |
| 54 | +- `OAUTH_CLIENT_SCOPES`: The scopes requested from the OAuth2 provider. Default: `"email profile groups"`. |
| 55 | +- `OAUTH_AUTHORIZATION_URL`: The authorization URL for the OAuth2 provider. |
| 56 | +- `OAUTH_ACCESS_TOKEN_URL`: The access token URL for the OAuth2 provider. |
| 57 | +- `OAUTH_INFOS_URL`: The user information URL for the OAuth2 provider. |
| 58 | +- `OAUTH_ADMIN_GROUP`: The name of the administrator group in the OAuth2 provider. |
| 59 | +- `OAUTH_BUTTON_TEXT`: The text displayed on the OAuth2 login button. Default: `"Login with OIDC"`. |
0 commit comments