Is it possible to create a new user in sonar without using the web interface? I need to write a script that inserts the same users for some tools, including sonar.
When installing SonarQube, a default user with Administer System permission is created automatically: Login: admin. Password: admin.
Sonar, by default, creates an Administrator account with username admin and password admin . Point your browser at http://localhost:9000/ . At the top right of the dashboard, click on the Log in link and fill in the form with username as admin and password as admin .
There are three ways you can do this:
Write directly to the database (there is a simple table called users).
Use the LDAP plugin, if you specify sonar.authenticator.createUsers: true
in sonar.properties, it will create the users in the sonar database automatically the first time they authenticate.
Write a java application that depends on the sonar plugin API, you can then use constructor injection to get a Sonar hibernate session and persist the user you want. See Here.
Since SonarQube version 3.6, there is support for user management in webservice API: https://sonarqube.com/web_api/api/users
http://docs.sonarqube.org/display/DEV/Web+API
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With