【问题标题】:Cannot upload files, Upload Components returns forbidden无法上传文件,上传组件返回禁止
【发布时间】:2021-06-29 12:40:33
【问题描述】:

我无法使用 UploadComponent 上传文件。我有一个 Spring 应用程序,使用启用了 Spring Security 的 Vaadin 21。

spring 安全文件,如下所示:

@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);
    }
}

错误截图:

上传组件被集成到一个Dialog中。

希望有人可以帮助我, 弗洛里安

【问题讨论】:

    标签: spring vaadin vaadin-flow


    【解决方案1】:

    此问题已在 Vaadin 21 alpha 8 中修复,请参阅 https://github.com/vaadin/flow/pull/11278

    【讨论】:

    • 谢谢您提供的信息,这就是原因。弗洛里安
    猜你喜欢
    • 2019-02-28
    • 2013-11-30
    • 1970-01-01
    • 2020-03-03
    • 1970-01-01
    • 1970-01-01
    • 2015-05-13
    • 2013-06-09
    相关资源
    最近更新 更多