Spring mvc 如何使用Spring在http连接而不是https上返回http状态403

Spring mvc 如何使用Spring在http连接而不是https上返回http状态403,spring-mvc,spring-security,Spring Mvc,Spring Security,我正在使用SpringMVC和SpringSecurity来锁定Web服务。我已使用此限制所有连接使用https <http auto-config='true'> <intercept-url pattern="/**" access="ROLE_USER" requires-channel="https"/> <http-basic/> </http> 但是,当我通过http连接时,我没有收到http状态代码403禁止。我

我正在使用SpringMVC和SpringSecurity来锁定Web服务。我已使用此限制所有连接使用https

<http auto-config='true'>
    <intercept-url pattern="/**" access="ROLE_USER" requires-channel="https"/>
    <http-basic/>
</http>


但是,当我通过http连接时,我没有收到http状态代码403禁止。

我想您需要拦截的创建(例如,使用
BeanPostProcessor
),并为其提供自定义
ChannelEntryPoint
,该点将发送“403禁止”