如何禁用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
作为我的主条目类extends 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屋!