当前位置: 首页>>代码示例>>Java>>正文


Java LogoutFilter类代码示例

本文整理汇总了Java中org.apache.shiro.web.filter.authc.LogoutFilter的典型用法代码示例。如果您正苦于以下问题:Java LogoutFilter类的具体用法?Java LogoutFilter怎么用?Java LogoutFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LogoutFilter类属于org.apache.shiro.web.filter.authc包,在下文中一共展示了LogoutFilter类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shiroFilter

import org.apache.shiro.web.filter.authc.LogoutFilter; //导入依赖的package包/类
@Bean
public ShiroFilterFactoryBean shiroFilter() {
	ShiroFilterFactoryBean factoryBean = new ShiroFilterFactoryBean();
	
	//设置Filter映射
	LinkedHashMap<String, Filter> filterMap = new LinkedHashMap<>();
	DefaultCasFilter casFilter = new DefaultCasFilter();
	casFilter.setFailureUrl(loginProperties.getFailureUrl()); //配置验证错误时的失败页面
	casFilter.setReloginUrl(loginProperties.getCasLogin() + "&msg={0}"); //验证错误后显示登录页面,并提示错误信息。只试用于ErrorContext异常
	casFilter.setLogoutUrl(loginProperties.getCasLogout());
	filterMap.put("casFilter", casFilter);
	LogoutFilter logoutFilter = new LogoutFilter();
	logoutFilter.setRedirectUrl(loginProperties.getCasLogout() + "?service=" + loginProperties.getCasLogoutCallback());
	filterMap.put("logoutFilter", logoutFilter);
	filterMap.put("perms", new DefaultPermissionsAuthorizationFilter());
	filterMap.put("authc", new DefaultFormAuthenticationFilter());
	filterMap.put("sense", new SenseLoginFilter());
	factoryBean.setFilters(filterMap);
	
	factoryBean.setSecurityManager(securityManager());
	factoryBean.setLoginUrl(loginProperties.getCasLogin());
	factoryBean.setUnauthorizedUrl(loginProperties.getUnauthorizedUrl());
	//加载权限配置
	Ini ini = new Ini();
	ini.loadFromPath(loginProperties.getShiroFilterFile());
	//did they explicitly state a 'urls' section?  Not necessary, but just in case:
	Ini.Section section = ini.getSection(IniFilterChainResolverFactory.URLS);
	if (MapUtils.isEmpty(section)) {
		//no urls section.  Since this _is_ a urls chain definition property, just assume the
		//default section contains only the definitions:
		section = ini.getSection(Ini.DEFAULT_SECTION_NAME);
	}
	factoryBean.setFilterChainDefinitionMap(section);
	return factoryBean;
}
 
开发者ID:easycodebox,项目名称:easycode,代码行数:36,代码来源:ShiroConfig.java

示例2: shiroFilter

import org.apache.shiro.web.filter.authc.LogoutFilter; //导入依赖的package包/类
@Bean
public ShiroFilterFactoryBean shiroFilter(SecurityManager securityManager, LogoutFilter logoutFilter) {
    ShiroFilterFactoryBean sffb = new ShiroFilterFactoryBean();
    sffb.setSecurityManager(securityManager);
    //
    sffb.getFilters().put("logout", logoutFilter);
    //
    sffb.setLoginUrl(WebappPath.getWebappPath() + "/a/user/loginForm");
    // TODO: ?? sffb.setSuccessUrl("/");
    sffb.setUnauthorizedUrl(WebappPath.getWebappPath() + "/a/error/unauthorized");
    //
    sffb.setFilterChainDefinitionMap(ImmutableMap.<String, String>builder()
            .put(WebappPath.getWebappPath() + "/a/user/loginForm", "authc")
            .put(WebappPath.getWebappPath() + "/a/user/logout", "logout")
            .put(WebappPath.getWebappPath() + "/a/shiro/restricted", "user")
            .put(WebappPath.getWebappPath() + "/a/shiro/privileged", "user, roles[never_given_permission]")
            .build());
    //
    LOG.debug(ObjectUtils.toString(sffb.getFilters()));
    //
    return sffb;
}
 
开发者ID:ageldama,项目名称:glados-wiki,代码行数:23,代码来源:ShiroContext.java

示例3: FDWebEnvironment

import org.apache.shiro.web.filter.authc.LogoutFilter; //导入依赖的package包/类
public FDWebEnvironment() {
    BasicHttpAuthenticationFilter authc = new CorsBasicHttpAuthenticationFilter();
    LogoutFilter logout = new LogoutFilter();
    logout.setRedirectUrl("http://www.freedomotic.com/");
    
    FilterChainManager fcMan = new DefaultFilterChainManager();
    fcMan.addFilter("authc", authc);
    fcMan.addFilter("logout", logout);
    fcMan.createChain("/auth/logout", "logout");
    fcMan.createChain("/v3/**", "authc");

    PathMatchingFilterChainResolver resolver = new PathMatchingFilterChainResolver();
    resolver.setFilterChainManager(fcMan);

    setFilterChainResolver(resolver);
    setWebSecurityManager(RestAPIv3.defaultWebSecurityManager);
}
 
开发者ID:freedomotic,项目名称:freedomotic,代码行数:18,代码来源:FDWebEnvironment.java

示例4: configureShiroWeb

import org.apache.shiro.web.filter.authc.LogoutFilter; //导入依赖的package包/类
protected void configureShiroWeb() {
    bindConstant().annotatedWith(Names.named("shiro.loginUrl")).to( "/login.jsp" );
	bindRealm().to(CustomDomainADRealm.class);
	bind( LogoutFilter.class);
    
    addFilterChain("/login", ANON);
    addFilterChain("/logout", ANON);
    addFilterChain("/withsocket.jsp", AUTHC );
    addFilterChain("/withsocket2.jsp", ANON );
}
 
开发者ID:OpenSOC,项目名称:opensoc-streaming,代码行数:11,代码来源:DefaultShiroWebModule.java


注:本文中的org.apache.shiro.web.filter.authc.LogoutFilter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。