I have a vaadin application and want to create additional endpoints. Therefore, I tried many many things, but unfortunatley I’m not able to write my own web security config (without destorying my vaadin application).
My goals are:
run vaadin application without any security on “/myvaadinapp”
add additional endpoint “/endpoint1” without any security checks
add additional endpoint “/endpoint2” with security (basic auth)
Does anyone have an example? This would help me a lot
I also tried this, but maybe no Vaadin issue. Unfortunatley I receive in Swagger for every test the window to enter user and password (I only wanted to have it for “entpoint2”. Second, the user and password will not be accepted in Swagger. Also I receive the window to add the credentials by opening the Vaadin application (“myvaadinapp”).
I tried, but I do not understand how to integrate the securityMatcher, because in the example (Spring Security Docs) it matches to “api” and the requestMatchers on “user” and “admin”. I is not clear for me how to adapt it in the above example.
Great, now I have it. But one problem. I added an additional SecurityChain to block all other endpoints. Now Vaadin app is not reachable anymore without allow specific endpoints in an additional security chain (“/vaadin/", "/VAADIN/”, “/frontend/", "/webjars/”). Are more needed?
I do not want to protect the vaadin page. I only want to extend with additional endpoints. To extend the VaadinWebSecurity I have to set the setLoginView() and given each views @AnonymousAllowed annotations, etc.
Nevertheless by opening the web page I receive a white page with an red error text
it is a good idea.
But in this case to allow Vaadin requests the best way is to use VaadinWebSecurity. Otherwise you may have to replicate all configurations on your configuration class
You have to build separated security filter chains.
The one provided by VaadinWebSecurity requires user to be authenticated if no other rules are defined
By adding one additional method (SecurityFilterChain) my vaadin application is blocked and it is required to allow explicit this endpoint in another SecurityFilterChain. Sorry for my questions… ;-)
@Configuration @EnableWebSecurity
public class WebSecurityConfig extends VaadinWebSecurity {