當前位置: 首頁>>代碼示例>>Java>>正文


Java ShiroFilterFactoryBean.setSuccessUrl方法代碼示例

本文整理匯總了Java中org.apache.shiro.spring.web.ShiroFilterFactoryBean.setSuccessUrl方法的典型用法代碼示例。如果您正苦於以下問題:Java ShiroFilterFactoryBean.setSuccessUrl方法的具體用法?Java ShiroFilterFactoryBean.setSuccessUrl怎麽用?Java ShiroFilterFactoryBean.setSuccessUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.shiro.spring.web.ShiroFilterFactoryBean的用法示例。


在下文中一共展示了ShiroFilterFactoryBean.setSuccessUrl方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getShiroFilterFactoryBean

import org.apache.shiro.spring.web.ShiroFilterFactoryBean; //導入方法依賴的package包/類
@Bean(name = "shiroFilter")
public ShiroFilterFactoryBean getShiroFilterFactoryBean(DefaultWebSecurityManager securityManager) {
    ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
    shiroFilterFactoryBean
            .setSecurityManager(securityManager);
    shiroFilterFactoryBean.setLoginUrl("/login");
    shiroFilterFactoryBean.setSuccessUrl("/");
    filterChainDefinitionMap.put("/login", "authc");
    filterChainDefinitionMap.put("/logout", "logout");
    filterChainDefinitionMap.put("/static/**", "anon");
    filterChainDefinitionMap.put("/api/**", "anon");
    filterChainDefinitionMap.put("/register/**", "anon");
    filterChainDefinitionMap.put("/admin/**", "roles[admin]");
    filterChainDefinitionMap.put("/**", "user");

    shiroFilterFactoryBean
            .setFilterChainDefinitionMap(filterChainDefinitionMap);
    return shiroFilterFactoryBean;
}
 
開發者ID:fireshort,項目名稱:spring-boot-quickstart,代碼行數:20,代碼來源:ShiroConfiguration.java

示例2: getShiroFilterFactoryBean

import org.apache.shiro.spring.web.ShiroFilterFactoryBean; //導入方法依賴的package包/類
/**
 * ShiroFilter<br/>
 * 注意這裏參數中的 StudentService 和 IScoreDao 隻是一個例子,因為我們在這裏可以用這樣的方式獲取到相關訪問數據庫的對象,
 * 然後讀取數據庫相關配置,配置到 shiroFilterFactoryBean 的訪問規則中。實際項目中,請使用自己的Service來處理業務邏輯。
 *
 * @param securityManager
 * @param casFilter
 * @param userDao
 * @return
 * @author SHANHY
 * @create  2016年1月14日
 */
@Bean(name = "shiroFilter")
public ShiroFilterFactoryBean getShiroFilterFactoryBean(DefaultWebSecurityManager securityManager, CasFilter casFilter, UserDao userDao) {
    ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
    // 必須設置 SecurityManager
    shiroFilterFactoryBean.setSecurityManager(securityManager);
    // 如果不設置默認會自動尋找Web工程根目錄下的"/login.jsp"頁麵
    shiroFilterFactoryBean.setLoginUrl(loginUrl);
    // 登錄成功後要跳轉的連接
    shiroFilterFactoryBean.setSuccessUrl(loginSuccessUrl);
    shiroFilterFactoryBean.setUnauthorizedUrl(unauthorizedUrl);
    // 添加casFilter到shiroFilter中
    Map<String, Filter> filters = new HashMap<>();
    filters.put("casFilter", casFilter);
   // filters.put("logout",logoutFilter());
    shiroFilterFactoryBean.setFilters(filters);

    loadShiroFilterChain(shiroFilterFactoryBean, userDao);
    return shiroFilterFactoryBean;
}
 
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:32,代碼來源:ShiroCasConfiguration.java

示例3: shiroFilter

import org.apache.shiro.spring.web.ShiroFilterFactoryBean; //導入方法依賴的package包/類
@Bean(name="shiroFilter")
public ShiroFilterFactoryBean shiroFilter(@Qualifier("securityManager")SecurityManager manager) {
    ShiroFilterFactoryBean bean=new ShiroFilterFactoryBean();
    bean.setSecurityManager(manager);
    //配置登錄的url和登錄成功的url
    bean.setLoginUrl("/login");
    bean.setSuccessUrl("/home");
    //配置訪問權限
    LinkedHashMap<String, String> filterChainDefinitionMap=new LinkedHashMap<>();
    filterChainDefinitionMap.put("/login", "anon"); //表示可以匿名訪問
    filterChainDefinitionMap.put("/common/**", "anon"); 
    filterChainDefinitionMap.put("/js/**","anon");
    filterChainDefinitionMap.put("/druid/**","anon");
    filterChainDefinitionMap.put("/captcha","anon");
    filterChainDefinitionMap.put("/**", "authc");//表示需要認證才可以訪問
    bean.setFilterChainDefinitionMap(filterChainDefinitionMap);
    return bean;
}
 
開發者ID:ranji1221,項目名稱:lemcloud,代碼行數:19,代碼來源:ShiroConfig.java

示例4: getShiroFilterFactoryBean

import org.apache.shiro.spring.web.ShiroFilterFactoryBean; //導入方法依賴的package包/類
@Bean(name = "shiroFilter")
public ShiroFilterFactoryBean getShiroFilterFactoryBean() {
	ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
	// 必須設置 SecurityManager
	shiroFilterFactoryBean.setSecurityManager(securityManager());
	// 如果不設置默認會自動尋找Web工程根目錄下的"/login.jsp"頁麵
	shiroFilterFactoryBean.setLoginUrl("/login");
	// 登錄成功後要跳轉的連接
	shiroFilterFactoryBean.setSuccessUrl("/user");
	shiroFilterFactoryBean.setUnauthorizedUrl("/403");
	// 添加casFilter到shiroFilter中
	Map<String, Filter> filters = new HashMap<String, Filter>();
	filters.put("authc",new FormAuthenticationFilter());
	shiroFilterFactoryBean.setFilters(filters);

	Map<String,String> shiroFilterChainDefinitions = Maps.newHashMap();
	shiroFilterChainDefinitions.put("/static/**","anon");
	shiroFilterFactoryBean.setFilterChainDefinitionMap(shiroFilterChainDefinitions);
	return shiroFilterFactoryBean;
}
 
開發者ID:whatlookingfor,項目名稱:spring-boot-sample,代碼行數:21,代碼來源:ShiroConfiguration.java

示例5: getShiroFilterFactoryBean

import org.apache.shiro.spring.web.ShiroFilterFactoryBean; //導入方法依賴的package包/類
@Bean(name = "shiroFilter")
public ShiroFilterFactoryBean getShiroFilterFactoryBean() {
    ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
    shiroFilterFactoryBean.setSecurityManager(securityManager());
    shiroFilterFactoryBean.setLoginUrl("/login.html");
    shiroFilterFactoryBean.setSuccessUrl("/overview/dashboard.html");
    Map<String, Filter> filters = new LinkedHashMap<String, Filter>();
    filters.put("authc", createLoginFilter());
    filters.put("forceLogout", new ForceLogoutFilter());
    shiroFilterFactoryBean.setFilters(filters);
    filterChainDefinitionMap.put("/static/**", "anon");
    filterChainDefinitionMap.put("/test/**", "anon");
    filterChainDefinitionMap.put("/logout", "logout");
    filterChainDefinitionMap.put("/authenticated", "authc");
    filterChainDefinitionMap.put("/login.json", "authc");
    filterChainDefinitionMap.put("/**", "user");
    shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
    return shiroFilterFactoryBean;
}
 
開發者ID:liaojiacan,項目名稱:zkAdmin,代碼行數:20,代碼來源:ShiroConfiguration.java

示例6: getShiroFilterFactoryBean

import org.apache.shiro.spring.web.ShiroFilterFactoryBean; //導入方法依賴的package包/類
@Bean(name = "shiroFilter")
    public ShiroFilterFactoryBean getShiroFilterFactoryBean(
            DefaultWebSecurityManager securityManager,
            FormAuthenticationFilter formAuthenticationFilter) {

        ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
        // 必須設置 SecurityManager
        shiroFilterFactoryBean.setSecurityManager(securityManager);
        // 如果不設置默認會自動尋找Web工程根目錄下的"/login.jsp"頁麵
        shiroFilterFactoryBean.setLoginUrl("/oss/login");
        // 登錄成功後要跳轉的連接
        shiroFilterFactoryBean.setSuccessUrl("/admin/index");
        shiroFilterFactoryBean.setUnauthorizedUrl("/403");
        Map map=new HashMap<>();
//        map.put("authc",formAuthenticationFilter);
        shiroFilterFactoryBean.setFilters(map);
        loadShiroFilterChain(shiroFilterFactoryBean);
        return shiroFilterFactoryBean;
    }
 
開發者ID:egojit8,項目名稱:easyweb,代碼行數:20,代碼來源:ShiroConfiguration.java

示例7: getShiroFilterFactoryBean

import org.apache.shiro.spring.web.ShiroFilterFactoryBean; //導入方法依賴的package包/類
@Bean(name = "shiroFilter")
@DependsOn("securityManager")
@ConditionalOnMissingBean
public ShiroFilterFactoryBean getShiroFilterFactoryBean(DefaultSecurityManager securityManager, Realm realm, ShiroFilterRegistry registry) {
	securityManager.setRealm(realm);

       Map<String, String> filterDef = swapKeyValue(properties.getFilterChainDefinitions());
       log.info("過慮器配置: {}", filterDef);
       log.info("自定義過慮器: {}", registry.getFilterMap());

	ShiroFilterFactoryBean shiroFilter = new ShiroFilterFactoryBean();
	shiroFilter.setSecurityManager(securityManager);
	shiroFilter.setLoginUrl(properties.getLoginUrl());
	shiroFilter.setSuccessUrl(properties.getSuccessUrl());
	shiroFilter.setUnauthorizedUrl(properties.getUnauthorizedUrl());

	shiroFilter.setFilterChainDefinitionMap(filterDef);
       shiroFilter.getFilters().putAll(registry.getFilterMap());

	return shiroFilter;
}
 
開發者ID:wanghongfei,項目名稱:shiro-spring-boot-starter,代碼行數:22,代碼來源:ShiroAutoConfiguration.java

示例8: getShiroFilterFactoryBean

import org.apache.shiro.spring.web.ShiroFilterFactoryBean; //導入方法依賴的package包/類
/**
 * ShiroFilter<br/>
 * 注意這裏參數中的 StudentService 和 IScoreDao 隻是一個例子,因為我們在這裏可以用這樣的方式獲取到相關訪問數據庫的對象,
 * 然後讀取數據庫相關配置,配置到 shiroFilterFactoryBean 的訪問規則中。實際項目中,請使用自己的Service來處理業務邏輯。
 *
 * @param myShiroRealm
 * @param stuService
 * @param scoreDao
 * @return
 * @author SHANHY
 * @create  2016年1月14日
 */
@Bean(name = "shiroFilter")
public ShiroFilterFactoryBean getShiroFilterFactoryBean(DefaultWebSecurityManager securityManager, StudentService stuService,UserDao userDao) {

    ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
    // 必須設置 SecurityManager  
    shiroFilterFactoryBean.setSecurityManager(securityManager);
    // 如果不設置默認會自動尋找Web工程根目錄下的"/login.jsp"頁麵
    shiroFilterFactoryBean.setLoginUrl("/login");
    // 登錄成功後要跳轉的連接
    shiroFilterFactoryBean.setSuccessUrl("/user");
    shiroFilterFactoryBean.setUnauthorizedUrl("/403");

    loadShiroFilterChain(shiroFilterFactoryBean, stuService, userDao);
    return shiroFilterFactoryBean;
}
 
開發者ID:seagrape,項目名稱:kekoa,代碼行數:28,代碼來源:ShiroConfiguration.java

示例9: getShiroFilterFactoryBean

import org.apache.shiro.spring.web.ShiroFilterFactoryBean; //導入方法依賴的package包/類
/**
 * ShiroFilter<br/>
 * 注意這裏參數中的 StudentService 和 IScoreDao 隻是一個例子,因為我們在這裏可以用這樣的方式獲取到相關訪問數據庫的對象,
 * 然後讀取數據庫相關配置,配置到 shiroFilterFactoryBean 的訪問規則中。實際項目中,請使用自己的Service來處理業務邏輯。
 *
 * @param myShiroRealm
 * @param stuService
 * @param scoreDao
 * @return
 * @author SHANHY
 * @create 2016年1月14日
 */
@Bean(name = "shiroFilter")
public ShiroFilterFactoryBean getShiroFilterFactoryBean(
		DefaultWebSecurityManager securityManager,
		StudentService stuService, UserDao userDao) {

	ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
	// 必須設置 SecurityManager
	shiroFilterFactoryBean.setSecurityManager(securityManager);
	// 如果不設置默認會自動尋找Web工程根目錄下的"/login.jsp"頁麵
	shiroFilterFactoryBean.setLoginUrl("/login");
	// 登錄成功後要跳轉的連接
	shiroFilterFactoryBean.setSuccessUrl("/user");
	shiroFilterFactoryBean.setUnauthorizedUrl("/403");
	// shiroFilterFactoryBean.setFilters(filters);

	loadShiroFilterChain(shiroFilterFactoryBean, stuService, userDao);
	return shiroFilterFactoryBean;
}
 
開發者ID:seagrape,項目名稱:kekoa,代碼行數:31,代碼來源:KekoaShiroConfiguration.java

示例10: shiroFilter

import org.apache.shiro.spring.web.ShiroFilterFactoryBean; //導入方法依賴的package包/類
@Bean(name = "shiroFilter")
public ShiroFilterFactoryBean shiroFilter() {
	ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
	shiroFilterFactoryBean.setSecurityManager(securityManager);
	shiroFilterFactoryBean.setLoginUrl("/admin");
	shiroFilterFactoryBean.setSuccessUrl("/admin");
	shiroFilterFactoryBean.setUnauthorizedUrl("/error");

	Map<String, Filter> filters = Application.getSecurityfilters();
	AjaxAuthenticationFilter ajaxAuthenticationFilter = new AjaxAuthenticationFilter();
	ajaxAuthenticationFilter.setRobotPrevention(new CaptchaRobotPrevention());
	filters.put(DefaultFilter.authc.name(), ajaxAuthenticationFilter);
	shiroFilterFactoryBean.setFilters(filters);

	shiroFilterFactoryBean.setFilterChainDefinitionMap(Application.getSecurityFilterChainDefinitionMap());
	return shiroFilterFactoryBean;
}
 
開發者ID:xiangxik,項目名稱:java-platform,代碼行數:18,代碼來源:ApplicationConfiguration.java

示例11: shiroFilter

import org.apache.shiro.spring.web.ShiroFilterFactoryBean; //導入方法依賴的package包/類
@Bean
public ShiroFilterFactoryBean shiroFilter() {
    final ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
    shiroFilterFactoryBean.setSecurityManager(securityManager());
    shiroFilterFactoryBean.setLoginUrl("/member/login");
    shiroFilterFactoryBean.setSuccessUrl("/home/index");
    shiroFilterFactoryBean.setUnauthorizedUrl("/error/401");

    final Map<String, Filter> filters = Maps.newHashMap();
    filters.put("authc", this.authcFilter());
    filters.put("membership", this.membershipFilter());
    shiroFilterFactoryBean.setFilters(filters);

    final Map<String, String> chains = Maps.newLinkedHashMap();
    chains.put("/member/logout", "logout");
    chains.put("/", this.configProperties.getShiro().getFilters());
    chains.put("/home/**", this.configProperties.getShiro().getFilters());
    chains.put("/views/**", this.configProperties.getShiro().getFilters());
    chains.put("/rest/**", this.configProperties.getShiro().getFilters());
    chains.put("/**", "anon");
    shiroFilterFactoryBean.setFilterChainDefinitionMap(chains);

    return shiroFilterFactoryBean;
}
 
開發者ID:xianrendzw,項目名稱:EasyReport,代碼行數:25,代碼來源:ShiroConfig.java

示例12: shiroFilterFactoryBean

import org.apache.shiro.spring.web.ShiroFilterFactoryBean; //導入方法依賴的package包/類
@Bean(name = "shiroFilter")
public ShiroFilterFactoryBean shiroFilterFactoryBean(DefaultWebSecurityManager securityManager){
	ShiroFilterFactoryBean factoryBean = new MyShiroFilterFactoryBean();
	factoryBean.setSecurityManager(securityManager);
	factoryBean.setLoginUrl("/restlogin");
	factoryBean.setSuccessUrl("/user");
	factoryBean.setUnauthorizedUrl("/403");

	loadShiroFilterChain(factoryBean);
	return factoryBean;
}
 
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:12,代碼來源:ShiroConfig.java

示例13: shiroFilterFactoryBean

import org.apache.shiro.spring.web.ShiroFilterFactoryBean; //導入方法依賴的package包/類
@Bean(name = "shiroFilter")
public ShiroFilterFactoryBean shiroFilterFactoryBean(DefaultWebSecurityManager securityManager, CasConfig casConfig, CasFilter casFilter){
	ShiroFilterFactoryBean factoryBean = new MyShiroFilterFactoryBean();
	factoryBean.setSecurityManager(securityManager);
	factoryBean.setLoginUrl(casConfig.getLocalServerLoginUrl());
	factoryBean.setSuccessUrl("/user");
	factoryBean.setUnauthorizedUrl("/403");
	// 添加casFilter到shiroFilter中
	Map<String, Filter> filterMap = new HashMap<String, Filter>(1);
	filterMap.put(CAS_FILTER, casFilter);
	factoryBean.setFilters(filterMap);

	loadShiroFilterChain(factoryBean, casConfig);
	return factoryBean;
}
 
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:16,代碼來源:ShiroCasConfig.java

示例14: shirFilter

import org.apache.shiro.spring.web.ShiroFilterFactoryBean; //導入方法依賴的package包/類
/**
 * 處理攔截資源文件問題。
 *
 * @param securityManager
 * @return
 */
@Bean
public ShiroFilterFactoryBean shirFilter(SecurityManager securityManager) {
    ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();

    // 設置 SecurityManager
    shiroFilterFactoryBean.setSecurityManager(securityManager);

    // 如果不設置默認會自動尋找Web工程根目錄下的"/login.html"頁麵
    shiroFilterFactoryBean.setLoginUrl("/login");
    // 登錄成功後要跳轉的鏈接
    shiroFilterFactoryBean.setSuccessUrl("/initPage");
    //未授權界麵
    shiroFilterFactoryBean.setUnauthorizedUrl("/403");
    //攔截器.
    Map<String, String> filterChainDefinitionMap = new LinkedHashMap<>();
    filterChainDefinitionMap.put("/favicon.png","anon");//解決彈出favicon.ico下載
    filterChainDefinitionMap.put("/logout", "logout");
    filterChainDefinitionMap.put("/css/**", "anon");
    filterChainDefinitionMap.put("/js/**", "anon");
    filterChainDefinitionMap.put("/img/**", "anon");
    filterChainDefinitionMap.put("/font-awesome/**", "anon");

    //自定義加載權限資源關係
    List<Permission> list = permissionService.findAll();
    for (Permission p : list) {
        if (!p.getPerurl().isEmpty()) {
            String permission = "perms[" + p.getPerurl() + "]";
            filterChainDefinitionMap.put(p.getPerurl(), permission);
        }
    }


    //過濾鏈定義,從上向下順序執行,一般將 /**放在最為下邊
    filterChainDefinitionMap.put("/**", "authc");
    shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
    return shiroFilterFactoryBean;
}
 
開發者ID:ChinaLHR,項目名稱:JavaQuarkBBS,代碼行數:44,代碼來源:ShiroConfig.java

示例15: shirFilter

import org.apache.shiro.spring.web.ShiroFilterFactoryBean; //導入方法依賴的package包/類
/**
     * 配置shiro框架過濾器工廠
     * 設置一些過濾器
     */
    @Bean
public ShiroFilterFactoryBean shirFilter(SecurityManager securityManager){
    System.out.println("ShiroConfiguration.shirFilter()");
        ShiroFilterFactoryBean shiroFilterFactoryBean  = new ShiroFilterFactoryBean();

        // 必須設置 SecurityManager
        shiroFilterFactoryBean.setSecurityManager(securityManager);

        //攔截器.
        Map<String,String> filterChainDefinitionMap = new LinkedHashMap<String,String>();

        //配置退出過濾器,其中的具體的退出代碼Shiro已經替我們實現了
        //filterChainDefinitionMap.put(LOGOUT_URL, "logout");

        //<!-- 過濾鏈定義,從上向下順序執行,一般將 /**放在最為下邊 -->:這是一個坑呢,一不小心代碼就不好使了;
        //<!-- authc:所有url都必須認證通過才可以訪問; anon:所有url都都可以匿名訪問-->

        //靜態資源
        filterChainDefinitionMap.put("/css/**","anon");
        filterChainDefinitionMap.put("/js/**","anon");
        filterChainDefinitionMap.put("/images/**","anon");
        filterChainDefinitionMap.put("/lib/**","anon");

        filterChainDefinitionMap.put("/login","anon");
        filterChainDefinitionMap.put("/","anon");

        // 如果不設置默認會自動尋找Web工程根目錄下的"/login.jsp"頁麵
        shiroFilterFactoryBean.setLoginUrl(LOGIN_URL);
        // 登錄成功後要跳轉的鏈接
        shiroFilterFactoryBean.setSuccessUrl(LOGIN_SUCCESS_URL);
        //未授權界麵;
        shiroFilterFactoryBean.setUnauthorizedUrl("/403");
        //
        filterChainDefinitionMap.put("/**", "authc");

        shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
        return shiroFilterFactoryBean;
    }
 
開發者ID:mmdsyl,項目名稱:BLOG-Microservice,代碼行數:43,代碼來源:ShiroConfiguration.java


注:本文中的org.apache.shiro.spring.web.ShiroFilterFactoryBean.setSuccessUrl方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。