I configured and tested security feature in general for views according description in vaadin documentation: https://vaadin.com/docs/latest/security/enabling-security
I use
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency>
and added @PermitAll to one of my views and user is forced to login.
What Im asking for is the following scenario:
Id like to have a view without login (security) so I added @AnonymousAllowed to it. Works well, no login required. In this view, I open a dialog (dialog.open()). And Id like this dialog to be secured, so that if the user want to see the content of the dialog, it has to log in. Tried to add @PermitAll to the dialog but doesnt change anthing. I assume, that the dialog is opened in the context of the view where I added @AnonymousAllowed as its not a separate view, just a dialog. Is their any way of forcing the dialog to require login? Maybe, before opening the dialog call a "doLoginNow" method from any of the vaadin / spring security classes?
Asked in Vaadin forum, tried different approaches according to documentation, e.g. @PermitAll or working with AuthenticationContext, but this doesnt work or just provide methods for information about context.