0

When I include spring-boot-starter-security in my project, it automatically creates a new database Table "users" which leads me to believe that it would automatically authenticate against entries in that table when trying to login on the login-page (which is correctly displayed under "/login")

My question is how I can add new users into this table -> what password encryption is used by default, or do I need to change it? Is there maybe a default registration page I can activate and then customize? Or do I need to write my own Login-Verification and then customize my registration to it?

Since the Login-Authentication seems to be already coming with the package I was hoping I could simply write a method to add users but I can't find information on how.

Juliette
  • 606
  • 7
  • 25

1 Answers1

1

I don't think spring-boot automatically create new users table in your database. It is the default UserDetailsService which as a single user with username user and random password. You can modify it in application.properties file (I supposed you are using .proprites):

spring.security.user.name
spring.security.user.password

I do not think you will do this in production when you application can have multiple users.

For more detail and to implement your worn UserDetailsService, please check here

Ponleu
  • 895
  • 7
  • 19
  • Ah I just realized that my mistake might have been that I created an Entity-Class User with TableName users that probably already created the database (since I added it at the same time as the security configuration I missunderstood why it was created) Thanks a lot! – Juliette Mar 06 '19 at 10:29