[main] # Objects and their properties are defined here, # Such as the securityManager, Realms and anything # else needed to build the SecurityManager authc.loginUrl = /login.jsp authc.successUrl = /web/index.jsp #cache manager builtInCacheManager = org.apache.shiro.cache.MemoryConstrainedCacheManager securityManager=org.apache.shiro.web.mgt.DefaultWebSecurityManager securityManager.cacheManager = $builtInCacheManager securityManager.sessionManager=$sessionManager #session 必须配置session,强制退出时,通过将session移除实现 sessionManager=org.apache.shiro.web.session.mgt.DefaultWebSessionManager sessionManager.sessionDAO=$sessionDAO sessionDAO=org.apache.shiro.session.mgt.eis.MemorySessionDAO # Create ldap realm ldapRealm = org.apache.shiro.realm.ldap.JndiLdapRealm #...... # Configure JDBC realm datasource dataSource = org.postgresql.ds.PGPoolingDataSource #....... # Create JDBC realm. jdbcRealm.permissionsLookupEnabled = true jdbcRealm = org.apache.shiro.realm.jdbc.JdbcRealm jdbcRealm.userRolesQuery = ...... jdbcRealm.permissionsQuery = ...... jdbcRealm.dataSource = $dataSource #self realm localAuthorizingRealm = com.redbudtek.shiro.LocalAuthorizingRealm securityManager.realms = $ldapRealm, $localAuthorizingRealm
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException {
String userName = (String)authenticationToken.getPrincipal();
//处理session
DefaultWebSecurityManager securityManager = (DefaultWebSecurityManager) SecurityUtils.getSecurityManager();
DefaultWebSessionManager sessionManager = (DefaultWebSessionManager)securityManager.getSessionManager();
Collection<Session> sessions = sessionManager.getSessionDAO().getActiveSessions();//获取当前已登录的用户session列表
for(Session session:sessions){
//清除该用户以前登录时保存的session
if(userName.equals(String.valueOf(session.getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY)))) {
sessionManager.getSessionDAO().delete(session);
}
}
String pwd = null;
return new SimpleAuthenticationInfo(userName,pwd,getName());
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有