如何禁用 spring-security 登录屏幕? [英] How to disable spring-security login screen?
问题描述
我正在使用 spring-boot-starter-security
依赖项,以利用 spring-security
附带的几个类.但由于我想将它集成到现有的 vaadin
应用程序中,我只想使用这些类,而不是 spring 的默认登录/身份验证屏幕.
I'm using spring-boot-starter-security
dependency, to make use of several classes that come with spring-security
. But as I want to integrate it in an existing vaadin
application, I only want to make use of the classes, and not of the default login/auth screen of spring.
如何禁用此屏幕?
我无法通过扩展WebSecurityConfigurerAdapter
进行任何配置,因为我的主入口类已经扩展了SpringBootServletInitializer
.此外,vaadin 应用程序基本上一直在相同的 URL 路径上运行并使用内部导航.
I cannot make any configurations by extending WebSecurityConfigurerAdapter
as my main entry class already extends SpringBootServletInitializer
. Also, vaadin applications basically run on the same URL path all the time and use internal navigation.
@EnableAutoConfiguration
public class MyApp extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(MyApp.class);
}
public static void main(String[] args) {
SpringApplication.run(MyApp.class, args);
}
}
那么,我可以做些什么来禁用登录屏幕,但可以使用 spring 安全功能?
So, what could I do to disable the login screen, but though make use of spring security features?
推荐答案
Spring Boot 中的默认安全性是 Basic.您可以通过设置 security.basic.enabled=false
来禁用它.更多关于这个这里和这里.
The default security in Spring Boot is Basic. You could disable it by setting security.basic.enabled=false
. More about this here and here.
这篇关于如何禁用 spring-security 登录屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!