Spring Boot安全认证 - 未发送认证头

问题描述 投票:0回答:1

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

只要我从我的服务器发送请求作为主机,一切正常:https://hostname.domain.com/test发送POST https://hostname.domain.com/endpoint

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

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

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

我允许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:协商并且不回复身份验证标头。

我对这些网络问题的了解不多,所以我可能会在这里混淆一​​些事情,但我希望你能解决这个问题。

java spring http authentication kerberos
1个回答
0
投票

发现了问题。您需要禁用选项方法的身份验证。

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

Authorization header not sent with http request angular 6 with OPTIONS method

Disable Spring Security for OPTIONS Http Method

© www.soinside.com 2019 - 2024. All rights reserved.