私の現在のプロジェクトは、peholmst の vaadin4spring MVP の構造に基づいています。
https://github.com/peholmst/vaadin4spring/tree/master/samples/mvp-sample
Vaadin 7.5.3、SpringBoot 1.2.5.RELEASEおよびJSR-330 1.0 (@Inject)を使用しています。
今、春のセキュリティと組み合わせて新しいvaadinビューログインページを作成したい...私の試みは次のとおりでした:
HttpSecurityConfigurer.java
import org.springframework.context.ApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint;
[...]
void configure(Environment env, ApplicationContext appContext, HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/VAADIN/**", "/PUSH/**", "/UIDL/**", "/resources/**").permitAll()
.anyRequest().authenticated()
.and()
.csrf().disable();
http
.formLogin()
.loginPage("/login").defaultSuccessUrl("/", true).permitAll()
.and()
.logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout")).logoutSuccessUrl("/login").permitAll();
}
[...]
LoginUI.java
import javax.inject.Inject;
import org.vaadin.spring.events.EventBus;
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.Title;
import com.vaadin.server.VaadinRequest;
import com.vaadin.spring.annotation.SpringUI;
import com.vaadin.ui.UI;
import my.example.application.ui.presenter.Action;
import my.example.application.ui.presenter.LoginPresenter;
@SpringUI(path = "/login")
@Theme("valo")
@Title("MyLogin")
public class MyLoginUI extends UI {
private static final long serialVersionUID = -1746340376430847935L;
@Inject
LoginPresenter presenter;
@Override
protected void init(VaadinRequest vaadinRequest) {
eventBus.publish(this, Action.START);
setContent(presenter.getView());
}
}
LoginPresenter.java
import org.vaadin.spring.events.Event;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import org.vaadin.spring.navigator.Presenter;
import org.vaadin.spring.navigator.annotation.VaadinPresenter;
import my.example.application.ui.view.LoginView;
@VaadinPresenter(viewName = LoginView.NAME)
public class LoginPresenter extends Presenter<LoginView> {
@EventBusListenerMethod(scope = EventScope.SESSION, filter = StartupFilter.class)
public void onStartup(Event<Action> event) {
getView().setBody();
}
}
LoginView.java
import com.vaadin.spring.annotation.UIScope;
import javax.annotation.PostConstruct;
import com.vaadin.spring.annotation.SpringView;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.navigator.View;
[...]
@UIScope
@SpringView(name = LoginView.NAME, ui = MyLoginUI.class)
public class LoginView extends VerticalLayout implements View {
private static final long serialVersionUID = 8034398112492147989L;
public static final String NAME = "loginView";
@PostConstruct
private void init() {
setMargin(true);
setSpacing(true);
setSizeFull();
}
public void setBody() {
addComponent(new Label("Heey, thats my login page! :)"));
}
@Override
public void enter(ViewChangeEvent event) {
}
}
したがって、アプリケーションを起動すると、ブラウザは「http://localhost:8080/login」にリダイレクトされますが、vaadin の読み込みアニメーションのみがレンダリングされます。
誰かが私を助けることができますか?