REST API发布提供html响应

时间:2019-03-21 15:26:13

标签: java spring rest security

我在使用REST API时遇到问题,当我从登录表单发出请求(POST)时,会收到登录html而不是User JSON。我猜问题出在Spring Security的配置上,但是我不知道如何解决它。我的configure方法:

SELECT 
    sum(budget) AS budget
FROM 
    funds f
INNER JOIN 
    #TEMP_TABLE t ON t.location_id = f.location_id
AND 
    nofa_id = 45

和Post控制器:

@Override
protected void configure(HttpSecurity http) throws Exception {
    http
            .authorizeRequests()
            .antMatchers("/", "/signin.html","/index.css","/javascript/**", "api/**").permitAll()
            .anyRequest().authenticated()
            .and()
            .formLogin()
            .loginPage("/signin.html");

}

已请求/ api / users。有人可以帮忙吗?

0 个答案:

没有答案