How to get past the Authentication Required Spring-boot Security

前端 未结 5 1126
无人共我
无人共我 2021-02-12 17:18

I have put in the password which is \"root\" and it keeps popping back up. How can I suppress this or get rid of it. I am using spring boot and spring security.

5条回答
  •  一整个雨季
    2021-02-12 18:11

    ACV's answer is probably the easiest way to turn off the authentication completely by adding security.basic.enabled=false to the application.properties file which is usually located under src/main/resources folder.

    or you just type in the password :)

    1. use default password

    When you run your spring application, there is usually a whole bunch of logging printed, which people usually don't read. The password is actually generated and printed to the screen at the startup. and the username is simply user. If you are testing using a browser and it probably only need you enter it once and caches it, so once for all, you should be securely logged in without authenticating every time. (however, every time you restart your app, it will generate a new password)

    2. customize your password

    Add the following properties to your application.properties if you want to customize your username and password:

    security.user.name=myuser
    security.user.password=mypassword
    

    And here is how it looks like with your own username and password

    Reference:

    1. Spring Boot Features - Security
    2. Monitoring and Management over HTTP

提交回复
热议问题