Florian
Florian

Reputation: 120

Cannot upload files, Upload Components returns forbidden

I am not able to upload files with the UploadComponent. I have a Spring application, using Vaadin 21 with enabled Spring Security.

The spring seccurity file, looks the following way:

@EnableWebSecurity
@Configuration
public class SecurityConfig extends VaadinWebSecurityConfigurerAdapter {

    // Our custom authentication provider
    @Autowired
    private AppCustomAuthenticationProvider authProvider;

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.rememberMe().alwaysRemember(false);

        http.authorizeRequests().antMatchers("/VAADIN/**").permitAll();

        super.configure(http);

        // This is important to register your login view to the
        // view access checker mechanism:
        setLoginView(http, LoginView.class);

        // Set the default success Url
        http.formLogin().defaultSuccessUrl(ApplicationUrl.APP);

        // Set the default failure Url
        http.formLogin().failureUrl(ApplicationUrl.APP_LOGIN_FAILURE_URL);
    }

    /**
     * Configuration of the custom authentication provider
     */
    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth.authenticationProvider(authProvider);
    }


    /**
     * Exclude Vaadin-framework communication and static assets from Spring Security
     */
    @Override
    public void configure(WebSecurity web) throws Exception {
        // Configure your static resources with public access here:
        web.ignoring().antMatchers(
                "/images/**"
        );

        // Delegating the ignoring configuration for Vaadin's
        // related static resources to the super class:
        super.configure(web);
    }
}

Screenshot of the error: Screenshot

The upload component is integrated into a Dialog.

Hopefully someone can help me, Florian

Upvotes: 0

Views: 722

Answers (1)

Artur Signell
Artur Signell

Reputation: 1822

This was fixed in Vaadin 21 alpha 8, see https://github.com/vaadin/flow/pull/11278

Upvotes: 1

Related Questions