Request for a Vaadin 24 Security for REST API

Hi, I’m really struggling to add security to my Vaadin project, that includes a REST API. Does anyone have an example of a project (on Github or anywhere else) that has security for both the UI interface and the rest api?

My problem is that when i added the security suggested in this offical video
https://www.youtube.com/watch?v=dZuy1v9isXE&ab_channel=vaadinofficial
It disabled my REST requests. I added a picture of the responses I got.

So in application.yml I excluded the URLs of the rest api, and added this to my configure function:
http.authorizeHttpRequests().requestMatchers(new AntPathRequestMatcher(“/mockers/**”))
.permitAll();

Now i want to add security to the REST as well (a simple one, just hard coded username and passwords), how can i do it?
image.png

Take a look at this comment https://github.com/vaadin/flow/issues/16839#issuecomment-1608887832

im having a hard time understanding it because i dont use kotlin @quirky-zebra

Isnt there even one example project thay uses vaadin secutity and Rest API?

Take a look here Java Configuration :: Spring Security

You will have one SecurityFilterChain provided by VaadinWebSecurity and you could add another one for your API

do you have a version of this that uses spring 6?

The link I posted is from the latest Spring Security documentation

yes you are correct, sorry

I cant seem to make it work on my application, that has a SecurityConfiguration class that extends VaadinWebSecurity. Is there a Vaadin example of a VaadinWebSecurity that uses REST?

ok it worked! thank you marcoc!