本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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 );
}