So far so good; If I create “@Route public class PersonView” it is accessible as “/<contextRoot>/app/person” and requires logon.
Any resource in webapp is handled by the webserver, is publicly available and requires no logon.
Now the problem: What if I also want to have a publicly available Vaadin page?
Say a “NewUserView”, and I want it to have url “/<contextRoot>/public/newUser”
I can add <url-pattern>/public/* to <servlet-mapping>, but that only means that all routes are available over both /app and /public.
I assume I can’t add two vaadin servlets either, because both of them would presumably find and add all @Routes…
I’ve worked around this by creating a separate public.war and put NewUserView there, but I wondered if there is a better way to do it.
You can use Vaadin built-in security feature and use annotations to define routes protection level.
Assuming your application is not based on Spring (and Spring Security), you can take a look at the Securing Plain Java App documentation.
Ah, I assumed that only worked with Spring Boot, so I’ve never investigated. Thanks.
Skimming the documentation it does leave me feeling a bit uneasy; I assume it would mean leaving Vaadin completely open from the web server’s point of view, and trusting that there is no bugs in Vaadin’s security code or my own setup of it.
I’ll have to let the idea sink in a bit before deciding
Yes, but we don’t secure individual URLs. We secure everything that goes to vaadin, which I think should be OK.
That means the web server only guarantees that the user is authenticated within the required security realm.
We handle the internal access ourselves.
We can’t do something like " @RolesAllowed(Receptionist), since the roles are not static. Our customers define them.
But, this might explain why I can’t expect there to (safely) be two entrypoints to vaadin, one secure and one public, in the same war.