繁体   English   中英

Spring Boot安全认证-没有发送认证头

[英]Spring Boot Security Authentication - No Authentication header sent

我有一个Spring Boot应用程序,其中的端点通过Kerberos进行了身份验证。

只要我以主机的身份从服务器发送请求,一切就可以正常进行: https : //hostname.domain.com/test发送POST https://hostname.domain.com/endpoint

但是,当我将主机名更改为另一主机名时,它将停止工作。

https://hostname2.domain.com/test发送POST https://hostname.domain.com/endpoint

客户端不发送身份验证头(尝试匿名),因此身份验证失败。 用户仍然在同一台计算机上,只是在同一域内的另一台主机上。

我允许cors进行这样的测试,但是并不能解决问题:

@Bean
    CorsConfigurationSource corsConfigurationSource () {

        UrlBasedCorsConfigurationSource source;
        source = new UrlBasedCorsConfigurationSource();

        CorsConfiguration configuration = new CorsConfiguration();
        List<String> all = Collections.singletonList("*");
        configuration.setAllowedOrigins(all);
        configuration.setAllowedMethods(all);
        configuration.setAllowedHeaders(all);

        source.registerCorsConfiguration("/**", configuration);
        return source;

    }

由于某些原因,客户端会忽略WWW-Authenticate:协商,并且不会使用身份验证标头进行答复。

我对这些网络问题不是很感兴趣,所以我可能在这里有些困惑,但我希望您能解决这个问题。

找到了问题。 您需要为选项方法禁用身份验证。

有关其他信息,请参见以下问题:

使用OPTIONS方法未随HTTP请求角度6发送授权标头

为OPTIONS Http方法禁用Spring Security

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM