How to add the initial, very first user to a web a

2019-02-28 06:07发布

问题:

I am building a web app that goes to many customers. Tha app enables customers to manage their users: create user with user name, password, permissions, etc. There needs to be first admin user that has a permisssion to create other users.

Problem is the initial user setup:

  • When the app is first installed, how should the first user be added?
  • Should this user be pre-installed in the user database?
  • Which password to set for this initial user and which email to recover the password in case it is forgotten?
  • Etc.

How are situations like this handled?

回答1:

Some webapps will show you install screen on their first run when there are no users in database. You can enter administrator login, password and some preferences, and after that webapp switches to normal operation mode and you can login as newly created administrator user and create other users.



回答2:

There's no rule for a situation like this. There are only guidelines and best-practices. The solution that i've seen more often in the market is to create automatically in the database an Admin user with a weak password (ex.: password, admin, etc) and ask the administrator to change it the first time he logs in the system.



标签: java security