-
Notifications
You must be signed in to change notification settings - Fork 22
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
Create root
account during installation
#775
Comments
I'd also say that on my side I also have an OIDC provider, and I can add claims to the jwt token as needed (so I could add "TORRUST_ADMIN" role to the token). Very likely out of scope, but it may let this application get away with a simpler user management system by offloading it for the cases when you need more. |
Here are the pros and cons of using a hardcoded root account (predefined during installation) versus creating a root/admin account dynamically during installation: Other things to consider by ChatGPT: Hardcoded Root AccountPros
Cons
Creating Root Account During InstallationPros
Cons
Recommendation
|
Proposal 1Since we don't have a Torrust Installer yet, I would propose the following:
[auth]
[auth.root]
email = "admin@example.org"
password = "password" NOTE: This section will be mandatory, and the password must be masked in output and logs.
This depends on other features, like improving user management. You need to find the user. In the first version, the |
Proposal 2Instead of using the configuration, we can pass an env var When you run the index:
The sysadmin (installer) can run the index with the env var. Pros:
This would be like a minimal installer where installation settings are provided via env vars instead of via the app UI. |
Proposal 3
Proposed by @mickvandijke here. Pros:
Cons:
|
Generic considerations for all proposals
Proposal 4 (GitLab)This is a more elaborated version of proposal 3 based on how GitLab does it. Set the
|
Hi @Frontrider, If I understand correctly, your proposal is adding a claim with the role. We already have the admin flag because we only have two roles:
But we don't rely on that info for authorization. We use the token only for authentication. If we want to support that in the future, I guess we have to make some changes like:
I don't understand when you would refresh the user's role. In the simplest implementation, it is done only when the users log in. FYI, we are using casbin for authorization, but it's not exposed via our public API. |
Yeah, if it remains that simple then just let me tell you what value to look for in the claim. The tokens I have on an internal network have an array with the items being the roles (in this case look for an "admin" string inside that array), but on a different setup with Cognito I could just give it an "is_admin" claim. (may not be reasonable, as I'd have other roles in the token too) So yeah, give me some way to set that boolean from my id token. |
Relates to:
Context
Currently, the application allows only one
admin
user, the first registered user. That produces some known issues:admin
, so testing must be done directly in the database.UPDATE: I moved the initial proposal to comment.
@da2ce7
The text was updated successfully, but these errors were encountered: