spring与olingo的引导集成抛出403 head调用错误?

s5a0g9ez  于 2021-07-14  发布在  Java
关注(0)|答案(0)|浏览(220)

我在springboot中集成了olingo类,并且我能够从中使用数据。然而,我注意到 HEAD 对odata端点进行的调用将导致403错误。
是否缺少任何配置?
1.odataconfiguration.java文件

@Configuration
public class OdataConfiguration {

  @Bean
  ServletRegistrationBean<CXFNonSpringJaxrsServlet> odataBean() {
      ServletRegistrationBean<CXFNonSpringJaxrsServlet> odataServlet = new ServletRegistrationBean<>(
              new CXFNonSpringJaxrsServlet(), "/api/v1/uiservice/seo.svc/*");
      Map<String, String> initParameters = new HashMap<>();
      initParameters.put("javax.ws.rs.Application", "org.apache.olingo.odata2.core.rest.app.ODataApplication");
      initParameters.put("org.apache.olingo.odata2.service.factory",
              "com.java.odata.SeoODataFactory");
      odataServlet.setInitParameters(initParameters);

      return odataServlet;
  }
}

下面是项目的安全配置-
安全配置.java

@Override
    protected void configure(HttpSecurity http) throws Exception {
        http
                .sessionManagement()
                .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
                .and()
                .authorizeRequests()
                .antMatchers("api/v1/**").authenticated()
                .antMatchers("actuator/**").hasAuthority("Internal")
                .anyRequest().authenticated()
                .and()
                .oauth2ResourceServer()
                .bearerTokenResolver(new ....)
                .jwt()
                .jwtAuthenticationConverter(getJwtAuthenticationConverter());

        http.headers().frameOptions().disable();
    }

odata端点url模式如下- /api/v1/uiservice/seo.svc/

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题