Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring安全配置;基本身份验证和SiteMinder_Java_Spring_Spring Security - Fatal编程技术网

Java Spring安全配置;基本身份验证和SiteMinder

Java Spring安全配置;基本身份验证和SiteMinder,java,spring,spring-security,Java,Spring,Spring Security,我有一个SpringBootWeb应用程序,它提供web内容并公开REST服务。web内容由SiteMinder保护,其余服务由“基本身份验证”保护 I使用弹簧安全4.2.3。我的Java代码正在扩展WebSecurityConfigureAdapter类,我的configure(HttpSecurity)方法如下所示: @Override protected void configure(HttpSecurity http) throws Exception { RequestHea

我有一个SpringBootWeb应用程序,它提供web内容并公开REST服务。web内容由SiteMinder保护,其余服务由“基本身份验证”保护

I使用弹簧安全4.2.3。我的Java代码正在扩展WebSecurityConfigureAdapter类,我的configure(HttpSecurity)方法如下所示:

@Override
protected void configure(HttpSecurity http) throws Exception {

    RequestHeaderAuthenticationFilter siteMinderFilter = new RequestHeaderAuthenticationFilter();
    siteMinderFilter.setAuthenticationManager(authenticationManager());

    http
      // Error page is for everyone
      .authorizeRequests()
      .antMatchers("/error.html")
      .permitAll()
      .anyRequest()
      .anonymous()

      // Basic Auth for our REST services
      .and()
      .authorizeRequests()
      .antMatchers("/services/**")
      .permitAll()
      .anyRequest()
      .authenticated()
      .and()
      .httpBasic()
      .authenticationEntryPoint(authenticationEntryPoint)

      // Site-Minder protection for the web content
      .and()
      .addFilter(siteMinderFilter)
      .authorizeRequests()
      .antMatchers("/**").permitAll()
      .anyRequest().hasRole(ApplicationConstants.SITE_MINDER_AUTHORITY);

    http.addFilterAfter(new CustomFilter(), BasicAuthenticationFilter.class);
}
我的配置有问题吗?我的配置是否创建了三个单独的过滤器?也许我的问题应该是,如何创建这三个过滤器

当我尝试使用PostMan/“Basic Auth”调用REST服务时,会收到错误消息:

  org.springframework.security.web.authentication.preauth.PreAuthenticatedCredentialsNotFoundException: SM_USER header not found in request.

我希望服务会被调用,而不是触发SiteMinder筛选器。

此配置发生了什么?嗨@rick,我在原始帖子中添加了错误消息。谢谢你指出我忘了……我删除了答案,因为我在她身上找到了另一个答案:在答案的评论中,你可以找到一个与你的Hanks@rick相似的案例。你的帮助推动了我的解决方案。