После внедрения HTTPS в application.properties я могу go анонимно переходить на страницы, указанные в моем WebSecurityConfigurerAdapter, как я хочу. Однако, когда я go перехожу на страницу, требующую авторизации, я получаю сообщение HTTP ERROR 404 page not found:
«Эта страница localhost не может быть найдена. Веб-страница для веб-адреса не найдена: https://localhost/login HTTP. ОШИБКА 404 ".
Если я уберу реализацию https в application.properties, тогда я смогу go переходить на страницы, которые хочу анонимно, а если я go на что-нибудь еще, появится удобная форма входа по умолчанию. Почему такое же поведение не происходит с реализованным https ????
application.properties:
server.ssl.key-store-type=PKCS12
server.ssl.key-store=classpath:server4.p12
server.ssl.key-store-password=******
server.ssl.key-alias=1
security.require-ssl=true
WebSecurityConfig. java
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
protected void configure(HttpSecurity http) throws Exception {
http
.csrf().disable().authorizeRequests().antMatchers("/", "/save","/success", "/images/**","/css/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin();
}
}