【发布时间】:2019-01-23 10:07:46
【问题描述】:
我创建了一个简单的 Spring Boot 应用程序。当我在 pom.xml 中添加 vaadin 依赖项时。注销是不可能的。用户仍处于登录状态,无需输入密码。
我对 Vaadin 10 和 Vaadin 12 得到相同的结果。春季版本是 2.1.2.RELEASE
@RestController
@EnableAutoConfiguration
@SpringBootApplication
public class TestApplication {
@RequestMapping("/")
String home() {return "Hello World!";}
public static void main(String[] args) {
SpringApplication.run(TestApplication.class, args);
}
}
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.httpBasic().and().
.authorizeRequests().anyRequest().fullyAuthenticated();
http.httpBasic().and().logout()
.logoutRequestMatcher(new AntPathRequestMatcher("/logout")).logoutSuccessUrl("/")
.invalidateHttpSession(true).deleteCookies("JSESSIONID");
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
auth.inMemoryAuthentication().passwordEncoder(new BCryptPasswordEncoder()).withUser("thomas")
.password(encoder.encode("xxx")).roles("USER");
}
}
Dependeny:
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-spring-boot-starter</artifactId>
</dependency>
我希望关注结果
我调用 localhost:xxx/ => 浏览器询问用户名/密码
我调用 localhost:xxx/logout => 浏览器再次询问用户名/密码
在我将 vaadin 依赖项添加到 pom 之后
我得到关注结果
我调用 localhost:xxx/ => 浏览器询问用户名/密码
我调用 localhost:xxx/logout => 浏览器不问密码!
【问题讨论】:
标签: spring spring-boot spring-security vaadin