牛骨文教育服务平台(让学习变的简单)
博文笔记

spring boot csrf

创建时间:2017-03-26 投稿人: 浏览次数:1754
Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Sun Mar 26 22:46:00 CST 2017
There was an unexpected error (type=Forbidden, status=403).
Could not verify the provided CSRF token because your session was not found.

解决办法1:关闭csrf
添加:http.csrf().disable();

protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests()
                .anyRequest().authenticated()
                .and().formLogin().loginPage("/login").failureUrl("/login?error").permitAll()
                .and()
                .logout()
                .permitAll();
        http.csrf().disable();

    }

正在寻求其他解决办法

声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。