1
我想爲我的Vaadin應用程序創建自定義登錄頁面。Vaadin + Spring Security + Ldap自定義登錄表格
MyUi.class
@Theme("valo")
@SpringUI
@Widgetset("pl.warta.AppWidgetSet")
public class MyUI extends UI {
@Autowired
private SpringViewProvider ViewProvider;
@Override
protected void init(VaadinRequest request) {
final Navigator navigator = new Navigator(this, this);
navigator.addProvider(ViewProvider);
setNavigator(navigator);
}
}
WebSecurityConfig.class
@Configuration
@EnableWebMvcSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
http.authorizeRequests().anyRequest().authenticated().and().formLogin().loginPage("/login").permitAll();
}
@Configuration
protected static class AuthenticationConfiguration extends GlobalAuthenticationConfigurerAdapter {
@Override
public void init(AuthenticationManagerBuilder auth) throws Exception {
auth.ldapAuthentication().userDnPatterns("uid={0},ou=people").groupSearchBase("ou=groups").contextSource().ldif("classpath:test-server.ldif");
}
}
}
SecuredView.class
@SpringView(name = SecuredView.NAME)
@UIScope
public class SecuredView extends VerticalLayout implements View {
private static final long serialVersionUID = 6937605817612926676L;
public static final String NAME = "";
@PostConstruct
private void postConstruct() {
setSizeFull();
setSpacing(true);
setMargin(true);
addComponent(new Label("<h3>Secured View</h3>", ContentMode.HTML));
}
@Override
public void enter(ViewChangeEvent event) {
}
}
你可以向我展示LoginView.class的示例實現以匹配我的Spring Security配置嗎?當我創建的視圖與NAME = "login"
我越來越:
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Thu Sep 10 09:47:14 CEST 2015
There was an unexpected error (type=Not Found, status=404).
No message available
然而即使頁面將apear,我不知道如何在按鈕點擊注入安全驗證。
我沒有提及 - 使用默認表單登錄工作完美。