Customize the jump address after Shiro logout

Customize the jump address after Shiro logout
1. Modify the LogoutFilter redirect address

LogoutFilter logout=new LogoutFilter();
logout.setRedirectUrl(Contants.MANAGE_PREFIX+"/login");

2. Modify ShiroFilterFactoryBean’s filters

Map<String,Filter> filters=new HashMap();
filters.put("logout",logout);
shiroFilterFactoryBean.setFilters(filters);

3. Modify the FilterChainDefinitionMap of ShiroFilterFactoryBean

LinkedHashMap<String, String> filterChainDefinitionMap = new LinkedHashMap<>();
filterChainDefinitionMap.put(Contants.MANAGE_PREFIX+"/logout", "logout");


@Bean
public ShiroFilterFactoryBean shiroFilterFactoryBean(SecurityManager securityManager) {
      ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
      shiroFilterFactoryBean.setSecurityManager(securityManager);
      shiroFilterFactoryBean.setLoginUrl(Contants.MANAGE_PREFIX+"/login");
      shiroFilterFactoryBean.setSuccessUrl(Contants.MANAGE_PREFIX+"/index");
      shiroFilterFactoryBean.setUnauthorizedUrl("/403");
//Custom Exit Redirection
LogoutFilter logout=new LogoutFilter();
logout.setRedirectUrl(Contants.MANAGE_PREFIX+"/login");
Map<String,Filter> filters=new HashMap();
filters.put("logout",logout);
shiroFilterFactoryBean.setFilters(filters);

LinkedHashMap<String, String> filterChainDefinitionMap = new LinkedHashMap<>();
filterChainDefinitionMap.put("/system.css/**", "anon");
filterChainDefinitionMap.put("/system.js/**", "anon");
filterChainDefinitionMap.put("/system.fonts/**", "anon");
filterChainDefinitionMap.put("/system.img/**", "anon");
filterChainDefinitionMap.put(Contants.MANAGE_PREFIX+"/logout", "logout");
filterChainDefinitionMap.put(Contants.MANAGE_PREFIX+"/**", "authc");
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
return shiroFilterFactoryBean;
}

See the picture below

Read More: