-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature addition: Multi-Factor Authentication #401
base: develop
Are you sure you want to change the base?
Conversation
This is super cool, thanks for doing this. Is it also possible to configure the I'll also review the additional routes for the OTP. |
@perfectra1n the environment variables can be set with environment variables (ie export TOTP_ENABLED="true"), -e with docker, and in a .env file in the root directory. Honestly I forgot to update documentation. Whoops! edit: I'm working on adding some pages now. |
Docs complete here. |
@eliandoran I have fixed all the problems that I find when testing it, and both methods are working. The UI for MFA option page may not be the optimal, but we can update that later I think. The playwright test is failing as same as the latest commit on develop, so I suppose that isn't related to this PR. Please take a look and hope we can merge this soon! |
@JYC333 , great job. I've just started testing it and I can see a few relatively big problems with the UI/UX. To setup TOTP on the server, I need to modify This makes for a great chicken or the egg problem. I suppose it's because it was mostly meant for the desktop client and not the server? I don't see why we shouldn't allow the user to generate TOTP even if it's not enabled. Or even better, not sure why we need to modify the |
The setting stuff I just follow what the PR have, but I have thought to allow user to change the setting in the app. I can make a change for that. As for the login issue, I think after moving to allow user to change the setting in the app, that issue should be gone. I'll fix that.
And I think this MFA is mostly for the server not for the desktop client, since we doesn't request login when you use desktop client. And it also doesn't request authentication when you want to sync with server if I remember correctly. That could be an issue that we need to fix later. |
TOTP is moved out from config.ini, and OAuth is still there for security concern. I think now it makes more sense now. |
Features added
Documentation
Testing Instructions
TOTP
OpenID
Currently only compatible with Google. Other services like Authentik and Auth0 are planned on being added.
In order to setup OpenID, you will need to setup a authentication provider. This requires a bit of extra setup. Follow these instructions to setup an OpenID service through google.
Set an environment variable "SSO_ENABLED" to true and add the client ID and secret you obtained from google. Environment variables can be set with a .env file in the root directory, by defining them in the command line, or with a docker container.
.env File
Environment variable (linux)
Docker
After you restart Trilium Notes, you will be redirected to Google's account selection page. Login to an account and Trilium Next will bind to that account, allowing you to login with it.
You can now login using your google account.