小编Pur*_*dhi的帖子

使用Spring Security 3.0.5覆盖ChannelProcessingFilter不起作用

通道处理器的默认行为是执行sendRedirect(使用302代码临时重定向).我需要更改此行为,以便执行永久(301)重定向而不是302重定向.我试着做以下事情:

  1. 通过扩展ChannelProcessingFilter创建自定义ChannelProcessingFilter:

    public class MyChannelProcessingFilter extends ChannelProcessingFilter{
       //No implementation, I needed this to just make sure that a custom filter is created and I can configure it as a custom filter in the xml file. 
    }
    
    Run Code Online (Sandbox Code Playgroud)
  2. 通过扩展AbstractRetryEntryPoint创建自定义EntryPoint

    public class RetryWithHttpsEntryPoint extends org.springframework.security.web.access.channel.AbstractRetryEntryPoint {
        private PortResolver portResolver = new PortResolverImpl();
        private final String scheme ="https://";
        /** The standard port for the scheme (80 for http, 443 for https) */
        private final int standardPort = 443;
    
        public RetryWithHttpsEntryPoint() {
            super("https://", 443);
        } …
    Run Code Online (Sandbox Code Playgroud)

spring-security

9
推荐指数
1
解决办法
7171
查看次数

标签 统计

spring-security ×1