I am currently trying to use the ViewAccessControl Interface of vaadin.spring as explained in the last paragraph of this tutorial.
But when implementing the isAccessGranted Method I get the following error:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'frontPageView': Scope 'vaadin-view' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No active view
The declaration of the FrontPageView class (The only thing I do in the enter method, is to add some vaadin ui elements):
@SpringView(name = FrontPageView.NAME)
public class FrontPageView extends DashboardDesign implements View, ViewAccessControl {
@Override
public void enter(ViewChangeEvent event) {
}
}
And my implementation of the isAccessGranted Method:
@Override
public boolean isAccessGranted(UI ui, String beanName) {
return SecurityContextHolder.getContext().getAuthentication().isAuthenticated();
}
P.S. Its basically the same problem this guy had a year ago: How to create a secure view with Vaadin and SpringViewProvider
Ok I figured it out now. If anyone else ever finds this problem, the solution is to use the ViewInstanceAccessControl interface instead of the ViewAccessControl iterface. Everything works fine this way.