微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法上传文件,上传组件返回被禁止

如何解决无法上传文件,上传组件返回被禁止

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

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

错误截图:

Screenshot

上传组件集成到一个对话框中。

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

解决方法

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。