Spring Boot的HAL浏览器默认凭据是什么?

问题描述 投票:0回答:1

我正在使用Spring Boot,并且正在使用spring-data-rest-hal-browser,一切似乎都很好,除非当我尝试访问URL时:localhost:8080我被重定向到http://localhost:8080/login以使用使用HAL浏览器浏览我的端点,然后出现一个屏幕,要求输入用户名和密码,而我却没有。

要登录的默认凭据是什么,如何更改它们或禁用登录选项?

这是我正在使用的依赖项:

<dependency>
 <groupId>org.springframework.data</groupId>
 <artifactId>spring-data-rest-hal-browser</artifactId>
</dependency>

这是登录屏幕:

enter image description here

java spring spring-boot hateoas
1个回答
0
投票

运行应用程序后,查看控制台输出。如果没有运行时异常,则应轻松找到凭据。默认情况下,用户名和密码始终不同,因此是从系统生成的。

为了更加清楚,登录页面带有此依赖项:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>

此外,如果要为凭据设置一些值,请转到application.properties文件并添加这两行:

spring.security.user.name= your_username
spring.security.user.password= your_password
© www.soinside.com 2019 - 2024. All rights reserved.