在 Spring 框架中,我目前正在尝试使用自定义标头而不是 url 来区分某些端点。目前,我似乎看不出如何允许带有自定义标头的特定 URL,但在 Spring Security 中拒绝另一个 URL。我的安全配置当前有一个 antMatcher,如下所示:
.antMatchers( HttpMethod.POST, "/api/website-user" ).permitAll()
但是,我还有一些其他的“POST”方法也受到保护——对于这个特定的端点,我只希望通过发送的标头识别和排除它。
您如何告诉 Spring 安全该 URL 应该通过未经身份验证的方式传递
@PostMapping( headers = "X-Operation-Name=forgot-password" ) public WebsiteUser forgotPassword( @Valid PasswordResetRequestModel passwordReset )
但是这个例如没有(并且依赖于经过身份验证的用户)?
@PostMapping( headers = "X-Operation-Name=resend-verification" ) public WebsiteUser resendVerification( Principal principal )
哈士奇WWW
相关分类