Image didn't show up

image
image
image

Why only Jmix image can work?

The default security configuration applied by Vaadin enables only the /icons/icon.png file for anonymous user.

Add the following bean to your security configuration to enable anonymous access to all files in the resources/META-INF/resources/icons folder:

package com.company.untitled.security;

import io.jmix.core.JmixSecurityFilterChainOrder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.SecurityFilterChain;

@Configuration
public class UntitledSecurityConfiguration {

    @Bean
    @Order(JmixSecurityFilterChainOrder.CUSTOM)
    SecurityFilterChain iconsFilterChain(HttpSecurity http) throws Exception {
        http.securityMatcher("/icons/**")
                .authorizeHttpRequests(authorize ->
                        authorize.anyRequest().permitAll()
                );
        return http.build();
    }
}

See also Custom Endpoints :: Jmix Documentation

Regards,
Konstantin

1 Like