-
-
Notifications
You must be signed in to change notification settings - Fork 157
Feature addition: Multi-Factor Authentication #401
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your great work! I didn't finish testing the functionality, but the setup steps need some changes I believe.
Since you are adding a new table, and it doesn't add it automatically. I got an error here:
I'm not sure whether I'm doing something wrong, if not, I think this PR also need to fix the database migration stuff.
I don't know exactly how the database version is handled in Trilium, but for syncing, the database version should be the same. So after we merge this PR, it won't compatible with the latest Trilium from Zadam. (Correct me if I'm wrong) It could be the first big step for TriliumNext, not sure how careful we should be hhh.
Some minor stuffs I find so far:
TOTP is moved out from config.ini, and OAuth is still there for security concern. I think now it makes more sense now. |
so happy to see this happening, thank you. Is hardware auth like Yubikey or fingerprint reader part of this or would that be an additional feature? |
I think that will be an additional feature then, at least won't in this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there, @JYC333 ! :)
src/public/app/widgets/type_widgets/abstract_code_type_widget.ts
Outdated
Show resolved
Hide resolved
src/public/app/widgets/type_widgets/options/multi_factor_authentication.ts
Outdated
Show resolved
Hide resolved
For TOTP_ENABLED and TOTP_SECRET - I believe that these variable names should be prepended with TRILIUM_ with our release of environment variables since this PR was created. |
TOTP_ENABLED and TOTP_SECRET are removed from settings, and let user to config through option page. The settings that required for OAuth need to set through |
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.