小编J. *_* S.的帖子

使用Vaadin登录的Spring Boot安全性

我尝试构建一个基于Spring Boot(1.2.7.RELEASE)和Vaadin(7.6.3)的应用程序.我的问题是我无法将Spring Security与Vaadin集成.我想要一个自定义的Vaadin内置的LoginScreen和Spring Security控件.我的项目设置如下:

@Configuration
@EnableWebSecurity
public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable().
                exceptionHandling().authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/login")).accessDeniedPage("/accessDenied")
                .and().authorizeRequests()
                .antMatchers("/VAADIN/**", "/PUSH/**", "/UIDL/**", "/login", "/login/**", "/error/**", "/accessDenied/**", "/vaadinServlet/**").permitAll()
                .antMatchers("/authorized", "/**").fullyAuthenticated();
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我的Vaadin登录界面

 @SpringUI(path = "/login")
    @Title("LoginPage")
    @Theme("valo")
    public class LoginUI extends UI {

        TextField user;
        PasswordField password;
        Button loginButton = new Button("Login", this::loginButtonClick);
        private static final String username = "username";
        private static final String passwordValue = "test123";

        @Override
        protected void init(VaadinRequest request) {
            setSizeFull();

            user …
Run Code Online (Sandbox Code Playgroud)

java spring-security vaadin7 spring-boot

11
推荐指数
1
解决办法
1万
查看次数

标签 统计

java ×1

spring-boot ×1

spring-security ×1

vaadin7 ×1