This question already has an answer here:
Spring Security causes / or any path to redirect to /login
, and /login
to generate and serve a login form. I tried many options like adding these lines to my properties file
security.ignored=/**
spring.security.enabled=false
management.security.enabled=false
security.basic.enabled=false
Nothing worked.
This has been deprecated maybe.
Seems security.ignored=/**
has been moved out from Spring Boot 2.x as if Spring Security
is on the classpath
, Spring Boot will add @EnableWebSecurity
so adding entries to the application.properties
ain't gonna work.
Here is how you can disable by configuring security config...
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/**").permitAll();
}
}
Remove Spring Security from the classpath:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
This will remove a barrier that forces the user to sign in before seeing a page.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.