Cors problem with authenticatedUrlPatterns

Gives cors error to api after adding authenticatedUrlPatterns to application.properties

I am using jmix custom controller

Снимок экрана 2022-03-01 в 14.01.26

application.properties
Снимок экрана 2022-03-01 в 14.03.35

Снимок экрана 2022-03-01 в 14.13.54

Hi,

Currently, the jmix.rest.authenticated-url-patterns property only enables token security for the specified endpoints and doesn’t apply any CORS settings for the URLs.

Probably, CORS settings from the jmix.rest.allowed-origins should be applied to such URLs, I’ve created an issue for that.

What you can do now is to specify CORS configuration for your URLs explicitly:

    @Bean
    public WebMvcConfigurer corsConfigurer() {

        return new WebMvcConfigurer() {
            @Override
            public void addCorsMappings(CorsRegistry registry) {
                registry.addMapping("/rest-api/**").allowedOrigins("http://localhost:3000");
            }
        };
    }

Where to add this in project.

In main application class annotated with @SpringBootApplication.

Sorry, i have missed to mention that i require it in my Cuba application. I have searched through my Cuba application but could not find the main application class. I am accessing rest API through URLs. I have posted a support question in cuba forum at Rest api cors issue - CUBA.Platform but could not get any guidance. Please guide.
Thanks