├── .gitattributes ├── .gitignore ├── README.md ├── db ├── mytest.sql └── readme.txt ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── study │ │ ├── config │ │ ├── CachingConfig.java │ │ ├── DataSourceConfig.java │ │ ├── MyServletInitializer.java │ │ ├── RootConfig.java │ │ ├── SecurityWebApplicationInitializer.java │ │ ├── WebConfig.java │ │ ├── WebProjectConfigInitializer.java │ │ └── WebSecurityConfig.java │ │ ├── controller │ │ ├── IndexController.java │ │ ├── ResourcesController.java │ │ ├── RoleController.java │ │ └── UserController.java │ │ ├── dao │ │ ├── BaseDao.java │ │ ├── ResourcesDao.java │ │ ├── RoleDao.java │ │ └── UserDao.java │ │ ├── model │ │ ├── RResources.java │ │ ├── Resources.java │ │ ├── Role.java │ │ ├── RoleResources.java │ │ ├── URole.java │ │ ├── User.java │ │ └── UserRole.java │ │ ├── security │ │ ├── MyAccessDecisionManager.java │ │ ├── MyFilterSecurityInterceptor.java │ │ ├── MySecurityMetadataSource.java │ │ └── MyUserDetailServiceImpl.java │ │ ├── service │ │ ├── ResourcesService.java │ │ ├── RoleService.java │ │ ├── UserService.java │ │ └── impl │ │ │ ├── ResourcesServiceImpl.java │ │ │ ├── RoleServiceImpl.java │ │ │ └── UserServiceImpl.java │ │ ├── tag │ │ └── AuthorizeTag.java │ │ └── util │ │ └── SpringWiredBean.java ├── resources │ ├── ehcache.xml │ ├── jdbc.properties │ ├── log4j.properties │ └── mapping │ │ ├── ResourcesDaoMapping.xml │ │ ├── RoleDaoMapping.xml │ │ └── UserDaoMapping.xml └── webapp │ ├── META-INF │ └── MANIFEST.MF │ ├── WEB-INF │ ├── authorize.tld │ └── web.xml │ ├── css │ ├── bootstrap.min.css │ ├── dataTables.bootstrap.min.css │ ├── img │ │ ├── line_conn.png │ │ ├── loading.gif │ │ ├── metro.gif │ │ └── metro.png │ ├── jquery.dataTables.min.css │ ├── matrix-login.css │ ├── matrix-media.css │ ├── matrix-style.css │ └── metroStyle.css │ ├── font-awesome │ ├── css │ │ ├── Descr.WD3 │ │ └── font-awesome.css │ └── font │ │ ├── Descr.WD3 │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.eot@ │ │ ├── fontawesome-webfont.ttf │ │ └── fontawesome-webfont.woff │ ├── images │ ├── backgrounds │ │ ├── Descr.WD3 │ │ ├── blank2 │ │ ├── calActiveBg.html │ │ └── skype_3Asuniljoshi19@call │ ├── gallery │ │ └── imgbox3.html │ ├── sort_asc.png │ ├── sort_both.png │ └── sort_desc.png │ ├── img │ ├── Descr.WD3 │ ├── Thumbs.db │ ├── alpha.html │ ├── breadcrumb.png │ ├── demo │ │ ├── Descr.WD3 │ │ ├── Thumbs.db │ │ ├── av1.jpg │ │ ├── av2.jpg │ │ ├── av3.jpg │ │ ├── av4.jpg │ │ ├── av5.jpg │ │ ├── demo-image1.jpg │ │ ├── demo-image2.jpg │ │ ├── demo-image3.jpg │ │ └── envelope.png │ ├── gallery │ │ ├── Descr.WD3 │ │ ├── Thumbs.db │ │ ├── imgbox1.jpg │ │ ├── imgbox2.jpg │ │ ├── imgbox3.jpg │ │ ├── imgbox4.jpg │ │ └── imgbox5.jpg │ ├── glyphicons-halflings-white.png │ ├── glyphicons-halflings.html │ ├── gritter.png │ ├── hue.png │ ├── larrow.png │ ├── line.png │ ├── logo.png │ ├── menu-active.png │ ├── rarrow.png │ ├── saturation.png │ ├── select2.png │ ├── spinner.gif │ └── sprite.png │ ├── js │ ├── bootstrap.min.js │ ├── jquery-1.11.2.min.js │ ├── jquery.dataTables.min.js │ ├── jquery.ztree.core.js │ ├── jquery.ztree.excheck.js │ ├── layer.js │ ├── matrix.interface.js │ ├── matrix.js │ ├── matrix.login.js │ └── skin │ │ └── default │ │ ├── icon-ext.png │ │ ├── icon.png │ │ ├── layer.css │ │ ├── loading-0.gif │ │ ├── loading-1.gif │ │ └── loading-2.gif │ └── jsp │ ├── common │ ├── common.jsp │ ├── menu.jsp │ └── top.jsp │ ├── index.jsp │ ├── login.jsp │ ├── resources │ └── resourceList.jsp │ ├── role │ └── roleList.jsp │ └── user │ └── userList.jsp └── test └── java └── com └── test ├── SpringTestCase.java └── TestRole.java /.gitattributes: -------------------------------------------------------------------------------- 1 | *.js linguist-language=java 2 | *.css linguist-language=java 3 | *.html linguist-language=java -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.settings 2 | 3 | /.classpath 4 | /.project 5 | /.mymetadata 6 | /target -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # springsecuritydemo 2 | 使用javaconfig的方式整合SpringMVC+Mybatis+SpringSecurity实现基于数据库的权限系统,包括对按钮的权限控制。 3 | 详情请到http://blog.csdn.net/poorcoder_/article/details/70231779 4 | -------------------------------------------------------------------------------- /db/mytest.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat MySQL Data Transfer 3 | 4 | Source Server : jj 5 | Source Server Version : 50022 6 | Source Host : localhost:3306 7 | Source Database : mytest 8 | 9 | Target Server Type : MYSQL 10 | Target Server Version : 50022 11 | File Encoding : 65001 12 | 13 | Date: 2017-04-18 21:46:14 14 | */ 15 | 16 | SET FOREIGN_KEY_CHECKS=0; 17 | 18 | -- ---------------------------- 19 | -- Table structure for `t_resources` 20 | -- ---------------------------- 21 | DROP TABLE IF EXISTS `t_resources`; 22 | CREATE TABLE `t_resources` ( 23 | `id` int(11) NOT NULL auto_increment, 24 | `name` varchar(30) default NULL, 25 | `resUrl` varchar(100) default NULL, 26 | `type` int(11) default NULL, 27 | `parentId` int(11) default NULL, 28 | `sort` int(11) default NULL, 29 | `resKey` varchar(50) default NULL, 30 | PRIMARY KEY (`id`) 31 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 32 | 33 | -- ---------------------------- 34 | -- Records of t_resources 35 | -- ---------------------------- 36 | INSERT INTO `t_resources` VALUES ('1', '基本设置', 'base', '0', '0', '1', 'base'); 37 | INSERT INTO `t_resources` VALUES ('2', '用户管理', '/index.do', '1', '1', '2', 'sys_user_manage'); 38 | INSERT INTO `t_resources` VALUES ('3', '角色管理', '/roles.do', '1', '1', '3', 'sys_role_manage'); 39 | INSERT INTO `t_resources` VALUES ('4', '资源管理', '/resources.do', '1', '1', '4', 'sys_res_manage'); 40 | INSERT INTO `t_resources` VALUES ('5', '添加用户', '/user/addUser.do', '2', '2', '5', 'sys_user_add'); 41 | INSERT INTO `t_resources` VALUES ('6', '删除用户', '/user/delUser.do', '2', '2', '6', 'sys_use_del'); 42 | INSERT INTO `t_resources` VALUES ('7', '添加角色', '/role/addRole.do', '2', '3', '7', 'sys_role_add'); 43 | INSERT INTO `t_resources` VALUES ('8', '删除角色', '/role/delRole.do', '2', '3', '8', 'sys_role_del'); 44 | INSERT INTO `t_resources` VALUES ('9', '添加资源', '/resources/addResources.do', '2', '4', '9', 'sys_res_add'); 45 | INSERT INTO `t_resources` VALUES ('10', '删除资源', '/resources/delResources.do', '2', '4', '10', 'sys_res_del'); 46 | INSERT INTO `t_resources` VALUES ('11', '分配角色', '/user/saveUserRoles.do', '2', '2', '9', 'sys_role_allot'); 47 | INSERT INTO `t_resources` VALUES ('12', '分配权限', '/role/saveRoleResources.do', '2', '3', '10', 'sys_res_allot'); 48 | 49 | -- ---------------------------- 50 | -- Table structure for `t_role` 51 | -- ---------------------------- 52 | DROP TABLE IF EXISTS `t_role`; 53 | CREATE TABLE `t_role` ( 54 | `id` int(11) NOT NULL auto_increment, 55 | `roleKey` varchar(50) NOT NULL, 56 | `roleDesc` varchar(255) default NULL, 57 | PRIMARY KEY (`id`) 58 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 59 | 60 | -- ---------------------------- 61 | -- Records of t_role 62 | -- ---------------------------- 63 | INSERT INTO `t_role` VALUES ('1', 'ADMIN', '管理员'); 64 | INSERT INTO `t_role` VALUES ('2', 'MEMBER', '普通用户'); 65 | INSERT INTO `t_role` VALUES ('3', 'SUPER', '超级管理员'); 66 | INSERT INTO `t_role` VALUES ('4', 'ROLE1', '角色1'); 67 | 68 | -- ---------------------------- 69 | -- Table structure for `t_role_resources` 70 | -- ---------------------------- 71 | DROP TABLE IF EXISTS `t_role_resources`; 72 | CREATE TABLE `t_role_resources` ( 73 | `roleId` int(11) NOT NULL, 74 | `resourcesId` int(11) NOT NULL, 75 | PRIMARY KEY (`roleId`,`resourcesId`) 76 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 77 | 78 | -- ---------------------------- 79 | -- Records of t_role_resources 80 | -- ---------------------------- 81 | INSERT INTO `t_role_resources` VALUES ('1', '2'); 82 | INSERT INTO `t_role_resources` VALUES ('1', '3'); 83 | INSERT INTO `t_role_resources` VALUES ('1', '4'); 84 | INSERT INTO `t_role_resources` VALUES ('1', '5'); 85 | INSERT INTO `t_role_resources` VALUES ('1', '6'); 86 | INSERT INTO `t_role_resources` VALUES ('1', '7'); 87 | INSERT INTO `t_role_resources` VALUES ('1', '8'); 88 | INSERT INTO `t_role_resources` VALUES ('1', '9'); 89 | INSERT INTO `t_role_resources` VALUES ('1', '10'); 90 | INSERT INTO `t_role_resources` VALUES ('1', '11'); 91 | INSERT INTO `t_role_resources` VALUES ('1', '12'); 92 | INSERT INTO `t_role_resources` VALUES ('2', '2'); 93 | INSERT INTO `t_role_resources` VALUES ('2', '5'); 94 | INSERT INTO `t_role_resources` VALUES ('3', '2'); 95 | INSERT INTO `t_role_resources` VALUES ('3', '6'); 96 | 97 | -- ---------------------------- 98 | -- Table structure for `t_user` 99 | -- ---------------------------- 100 | DROP TABLE IF EXISTS `t_user`; 101 | CREATE TABLE `t_user` ( 102 | `id` int(11) NOT NULL auto_increment, 103 | `username` varchar(33) default NULL, 104 | `password` varchar(33) default NULL, 105 | `enable` int(10) default NULL COMMENT '是否启用', 106 | PRIMARY KEY (`id`) 107 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 108 | 109 | -- ---------------------------- 110 | -- Records of t_user 111 | -- ---------------------------- 112 | INSERT INTO `t_user` VALUES ('1', 'admin', '21232f297a57a5a743894a0e4a801fc3', '1'); 113 | INSERT INTO `t_user` VALUES ('3', 'user2', 'user2', '0'); 114 | INSERT INTO `t_user` VALUES ('4', 'user3', 'user3', '1'); 115 | INSERT INTO `t_user` VALUES ('5', 'user4', 'user4', '1'); 116 | INSERT INTO `t_user` VALUES ('6', 'user5', 'user5', '1'); 117 | INSERT INTO `t_user` VALUES ('7', 'user6', 'user6', '1'); 118 | INSERT INTO `t_user` VALUES ('8', 'user7', 'user7', '1'); 119 | INSERT INTO `t_user` VALUES ('9', 'user8', 'user8', '1'); 120 | INSERT INTO `t_user` VALUES ('14', 'user13', 'user13', '1'); 121 | INSERT INTO `t_user` VALUES ('15', 'user14', 'user15', '1'); 122 | INSERT INTO `t_user` VALUES ('16', 'user15', 'user15', '1'); 123 | INSERT INTO `t_user` VALUES ('17', 'teste', '123456', '1'); 124 | INSERT INTO `t_user` VALUES ('18', 'user1', 'e10adc3949ba59abbe56e057f20f883e', '1'); 125 | 126 | -- ---------------------------- 127 | -- Table structure for `t_user_role` 128 | -- ---------------------------- 129 | DROP TABLE IF EXISTS `t_user_role`; 130 | CREATE TABLE `t_user_role` ( 131 | `userId` int(11) NOT NULL, 132 | `roleId` int(11) NOT NULL, 133 | PRIMARY KEY (`userId`,`roleId`) 134 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 135 | 136 | -- ---------------------------- 137 | -- Records of t_user_role 138 | -- ---------------------------- 139 | INSERT INTO `t_user_role` VALUES ('1', '1'); 140 | INSERT INTO `t_user_role` VALUES ('2', '2'); 141 | -------------------------------------------------------------------------------- /db/readme.txt: -------------------------------------------------------------------------------- 1 | 使用zTree时,由于同时使用了bootstrap插件,导致样式起了冲突,生成的树都挤在一起了, 2 | 最后的解决办法是设置zTreeStyle.css文件的.ztree li ul{}属性,在里面加入height: auto就ok了! 3 | (metro分格则改metroStyle.css文件) 4 | 5 | 6 | 第一次使用时导入mytest.sql 7 | admin 的密码为admin ,因为密码的加密是后面加入的,所以现在库里只有admin可以登录。要想使用其他用户,请重新创建, 8 | 并分配相应的权限。 9 | 10 | 详情请查看博客 http://blog.csdn.net/poorCoder_/article/details/70231779 -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.study 4 | springsecuritydemo 5 | 0.0.1-SNAPSHOT 6 | war 7 | springsecuritydemo 8 | 9 | 10 | 4.3.5.RELEASE 11 | 4.2.1.RELEASE 12 | 13 | 14 | 15 | 16 | org.springframework 17 | spring-webmvc 18 | ${spring.version} 19 | 20 | 21 | org.springframework 22 | spring-context-support 23 | ${spring.version} 24 | 25 | 26 | 27 | org.springframework.security 28 | spring-security-web 29 | ${springsecurity.version} 30 | 31 | 32 | org.springframework.security 33 | spring-security-config 34 | ${springsecurity.version} 35 | 36 | 37 | org.springframework.security 38 | spring-security-taglibs 39 | ${springsecurity.version} 40 | 41 | 42 | 43 | mysql 44 | mysql-connector-java 45 | 5.1.27 46 | jar 47 | compile 48 | 49 | 50 | 51 | javax.servlet 52 | javax.servlet-api 53 | 3.1.0 54 | provided 55 | 56 | 57 | 58 | jstl 59 | jstl 60 | 1.2 61 | 62 | 63 | javax.servlet 64 | jsp-api 65 | 2.0 66 | provided 67 | 68 | 69 | commons-logging 70 | commons-logging 71 | 1.2 72 | 73 | 74 | 75 | org.mybatis 76 | mybatis 77 | 3.3.0 78 | 79 | 80 | 81 | org.mybatis 82 | mybatis-spring 83 | 1.2.2 84 | 85 | 86 | 87 | 88 | junit 89 | junit 90 | 4.12 91 | test 92 | 93 | 94 | 95 | 96 | org.springframework 97 | spring-test 98 | ${spring.version} 99 | test 100 | 101 | 102 | com.alibaba 103 | fastjson 104 | 1.2.15 105 | 106 | 107 | 108 | com.github.pagehelper 109 | pagehelper 110 | 4.1.4 111 | 112 | 113 | commons-dbcp 114 | commons-dbcp 115 | 1.4 116 | 117 | 118 | 119 | 120 | net.sf.ehcache 121 | ehcache 122 | 2.7.5 123 | 124 | 125 | 126 | 127 | 128 | org.slf4j 129 | slf4j-api 130 | 1.7.18 131 | 132 | 133 | 134 | 135 | 136 | org.slf4j 137 | slf4j-log4j12 138 | 1.7.18 139 | 140 | 141 | 142 | 143 | 144 | org.apache.logging.log4j 145 | log4j-core 146 | 2.5 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | org.apache.maven.plugins 156 | maven-compiler-plugin 157 | 2.3.2 158 | 159 | 1.7 160 | 1.7 161 | 162 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /src/main/java/com/study/config/CachingConfig.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import org.apache.log4j.Logger; 4 | import org.springframework.cache.CacheManager; 5 | import org.springframework.cache.annotation.EnableCaching; 6 | import org.springframework.cache.ehcache.EhCacheCacheManager; 7 | import org.springframework.cache.ehcache.EhCacheManagerFactoryBean; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.context.annotation.Configuration; 10 | import org.springframework.core.io.ClassPathResource; 11 | 12 | @Configuration 13 | @EnableCaching// 14 | public class CachingConfig { 15 | 16 | private static final Logger logger = Logger.getLogger(CachingConfig.class); 17 | 18 | @Bean 19 | public EhCacheManagerFactoryBean ehCacheManagerFactoryBean() { 20 | EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean(); 21 | ehCacheManagerFactoryBean.setConfigLocation(new ClassPathResource( 22 | "ehcache.xml")); 23 | return ehCacheManagerFactoryBean; 24 | } 25 | 26 | @Bean 27 | public CacheManager cacheManager() { 28 | logger.info("EhCacheCacheManager"); 29 | EhCacheCacheManager cacheManager = new EhCacheCacheManager(); 30 | cacheManager.setCacheManager(ehCacheManagerFactoryBean().getObject()); 31 | return cacheManager; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/study/config/DataSourceConfig.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import java.util.Properties; 4 | 5 | import javax.sql.DataSource; 6 | 7 | import org.apache.commons.dbcp.BasicDataSource; 8 | import org.apache.ibatis.plugin.Interceptor; 9 | import org.apache.ibatis.session.SqlSessionFactory; 10 | import org.apache.log4j.Logger; 11 | import org.mybatis.spring.SqlSessionFactoryBean; 12 | import org.mybatis.spring.annotation.MapperScan; 13 | import org.springframework.beans.factory.annotation.Value; 14 | import org.springframework.context.annotation.Bean; 15 | import org.springframework.context.annotation.Configuration; 16 | import org.springframework.context.annotation.PropertySource; 17 | import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; 18 | import org.springframework.core.io.support.PathMatchingResourcePatternResolver; 19 | import org.springframework.jdbc.datasource.DataSourceTransactionManager; 20 | import org.springframework.transaction.PlatformTransactionManager; 21 | import org.springframework.transaction.annotation.EnableTransactionManagement; 22 | 23 | import com.github.pagehelper.PageHelper; 24 | 25 | @Configuration 26 | //加载资源文件 27 | @PropertySource({"classpath:jdbc.properties"}) 28 | //加上这个注解,使得支持事务 29 | @EnableTransactionManagement 30 | @MapperScan(basePackages = {"com.study.dao"}) 31 | public class DataSourceConfig { 32 | private static final Logger logger = Logger.getLogger(DataSourceConfig.class); 33 | /* 34 | * 绑定资源属性 35 | */ 36 | @Value("${jdbc.driver}") 37 | private String driverClass; 38 | @Value("${jdbc.url}") 39 | private String url; 40 | @Value("${jdbc.username}") 41 | private String userName; 42 | @Value("${jdbc.password}") 43 | private String passWord; 44 | @Value("${maxActive}") 45 | private int maxActive; 46 | @Value("${maxIdle}") 47 | private int maxIdle; 48 | @Value("${maxWait}") 49 | private long maxWait; 50 | 51 | 52 | /** 53 | * 必须加上static 54 | */ 55 | public static PropertySourcesPlaceholderConfigurer placehodlerConfigurer() { 56 | logger.info("PropertySourcesPlaceholderConfigurer"); 57 | return new PropertySourcesPlaceholderConfigurer(); 58 | } 59 | 60 | @Bean(destroyMethod="close") 61 | public BasicDataSource dataSource() { 62 | logger.info("DataSource"); 63 | BasicDataSource dataSource = new BasicDataSource(); 64 | dataSource.setDriverClassName(driverClass); 65 | dataSource.setUrl(url); 66 | dataSource.setUsername(userName); 67 | dataSource.setPassword(passWord); 68 | dataSource.setMaxActive(maxActive); 69 | dataSource.setMaxIdle(maxIdle); 70 | dataSource.setMaxWait(maxWait); 71 | return dataSource; 72 | } 73 | 74 | @Bean 75 | public PlatformTransactionManager txManager(DataSource dataSource) { 76 | return new DataSourceTransactionManager(dataSource); 77 | } 78 | 79 | @Bean 80 | public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception { 81 | SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); 82 | sessionFactory.setDataSource(dataSource); 83 | PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); 84 | sessionFactory.setMapperLocations(resolver.getResources("classpath:mapping/*Mapping.xml")); 85 | //配置pageHelper 86 | sessionFactory.setPlugins(new Interceptor[]{pageHelper()}); 87 | return sessionFactory.getObject(); 88 | } 89 | 90 | /*@Bean 91 | public MapperScannerConfigurer scannerConfigurer(){ 92 | MapperScannerConfigurer configurer = new MapperScannerConfigurer(); 93 | configurer.setBasePackage("com.study.dao"); 94 | configurer.setSqlSessionFactoryBeanName("sqlSessionFactory"); 95 | return configurer; 96 | }*/ 97 | /** 98 | * mybatis 分页插件配置 99 | * @return 100 | */ 101 | @Bean 102 | public PageHelper pageHelper() { 103 | logger.info("MyBatisConfiguration.pageHelper()"); 104 | PageHelper pageHelper = new PageHelper(); 105 | Properties p = new Properties(); 106 | p.setProperty("offsetAsPageNum", "true"); 107 | p.setProperty("rowBoundsWithCount", "true"); 108 | p.setProperty("reasonable", "true"); 109 | pageHelper.setProperties(p); 110 | return pageHelper; 111 | } 112 | 113 | 114 | 115 | 116 | 117 | } 118 | 119 | 120 | -------------------------------------------------------------------------------- /src/main/java/com/study/config/MyServletInitializer.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import javax.servlet.FilterRegistration; 4 | import javax.servlet.ServletContext; 5 | import javax.servlet.ServletException; 6 | 7 | import org.springframework.web.WebApplicationInitializer; 8 | import org.springframework.web.context.request.RequestContextListener; 9 | import org.springframework.web.filter.CharacterEncodingFilter; 10 | 11 | public class MyServletInitializer implements WebApplicationInitializer { 12 | 13 | @Override 14 | public void onStartup(ServletContext servletContext) throws ServletException { 15 | FilterRegistration.Dynamic characterEncoding=servletContext.addFilter("characterEncoding", CharacterEncodingFilter.class); 16 | characterEncoding.setInitParameter("forceEncoding", "true"); 17 | characterEncoding.setInitParameter("encoding", "UTF-8"); 18 | characterEncoding.addMappingForUrlPatterns(null, true, "/*"); 19 | 20 | servletContext.addListener(RequestContextListener.class); 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/study/config/RootConfig.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.ComponentScan.Filter; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.context.annotation.FilterType; 7 | import org.springframework.web.servlet.config.annotation.EnableWebMvc; 8 | 9 | @Configuration 10 | @ComponentScan(basePackages={"com.study"},excludeFilters={@Filter(type=FilterType.ANNOTATION,value=EnableWebMvc.class)}) 11 | public class RootConfig { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/study/config/SecurityWebApplicationInitializer.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer; 4 | /** 5 | * 配置Delegating-FilterProxy 6 | * 继承AbstractSecurityWebApplicationInitializer会自动注册DelegatingFilterProxy 7 | * 等价于xml配置 8 | * 9 | springSecurityFilterChain 10 | org.springframework.web.filter.DelegatingFilterProxy 11 | 12 | * 13 | * 14 | */ 15 | public class SecurityWebApplicationInitializer extends AbstractSecurityWebApplicationInitializer{ 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/study/config/WebConfig.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.ComponentScan; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.http.converter.HttpMessageConverter; 9 | import org.springframework.web.servlet.ViewResolver; 10 | import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; 11 | import org.springframework.web.servlet.config.annotation.EnableWebMvc; 12 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; 13 | import org.springframework.web.servlet.view.InternalResourceViewResolver; 14 | import org.springframework.web.servlet.view.JstlView; 15 | 16 | import com.alibaba.fastjson.serializer.SerializerFeature; 17 | import com.alibaba.fastjson.support.config.FastJsonConfig; 18 | import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; 19 | 20 | @Configuration 21 | @EnableWebMvc 22 | @ComponentScan("com.study.controller") 23 | public class WebConfig extends WebMvcConfigurerAdapter { 24 | 25 | @Bean 26 | public ViewResolver viewResolver(){ 27 | InternalResourceViewResolver resolver = new InternalResourceViewResolver(); 28 | resolver.setPrefix("/jsp/"); 29 | resolver.setSuffix(".jsp"); 30 | resolver.setExposeContextBeansAsAttributes(true); 31 | resolver.setViewClass(JstlView.class); 32 | return resolver; 33 | } 34 | 35 | //配置静态资源的处理 使DispatcherServlet对静态资源的请求转发到Servlet容器默认的Servlet上,而不是使用DispatcherServlet本身来处理此类请求 36 | @Override 37 | public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { 38 | configurer.enable(); 39 | } 40 | 41 | /* @Override 42 | public void addResourceHandlers(ResourceHandlerRegistry registry) { 43 | registry.addResourceHandler("/css/**").addResourceLocations("classpath:/css"); 44 | registry.addResourceHandler("/js/**").addResourceLocations("classpath:/js"); 45 | registry.addResourceHandler("/img/**").addResourceLocations("classpath:/img"); 46 | }*/ 47 | 48 | 49 | @Override 50 | public void configureMessageConverters(List> converters) { 51 | super.configureMessageConverters(converters); 52 | 53 | FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter(); 54 | 55 | FastJsonConfig fastJsonConfig = new FastJsonConfig(); 56 | fastJsonConfig.setSerializerFeatures( 57 | SerializerFeature.PrettyFormat 58 | ); 59 | fastConverter.setFastJsonConfig(fastJsonConfig); 60 | 61 | converters.add(fastConverter); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/study/config/WebProjectConfigInitializer.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; 4 | 5 | 6 | public class WebProjectConfigInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { 7 | 8 | /** 9 | * 加载驱动应用后端的中间层和数据层组件 10 | */ 11 | @Override 12 | protected Class[] getRootConfigClasses() { 13 | return new Class[]{RootConfig.class}; 14 | } 15 | /** 指定配置类 16 | * 加载包含web组件的bean,如控制机器、视图解析器以及映射处理器 17 | */ 18 | @Override 19 | protected Class[] getServletConfigClasses() { 20 | return new Class[]{WebConfig.class}; 21 | } 22 | 23 | //将DispatcherServlet 映射到“/” 24 | @Override 25 | protected String[] getServletMappings() { 26 | return new String[] { "/" }; 27 | } 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/study/config/WebSecurityConfig.java: -------------------------------------------------------------------------------- 1 | package com.study.config; 2 | 3 | import javax.annotation.Resource; 4 | 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.security.authentication.encoding.Md5PasswordEncoder; 7 | import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; 8 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 9 | import org.springframework.security.config.annotation.web.builders.WebSecurity; 10 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 11 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 12 | import org.springframework.security.core.userdetails.UserDetailsService; 13 | import org.springframework.security.web.access.intercept.FilterSecurityInterceptor; 14 | import org.springframework.security.web.util.matcher.AntPathRequestMatcher; 15 | 16 | import com.study.security.MyFilterSecurityInterceptor; 17 | 18 | @Configuration 19 | @EnableWebSecurity 20 | public class WebSecurityConfig extends WebSecurityConfigurerAdapter { 21 | 22 | // @Resource 23 | // private DataSource dataSource; 24 | 25 | @Resource(name="myUserDetailService") 26 | private UserDetailsService myUserDetailService; 27 | 28 | @Resource 29 | private MyFilterSecurityInterceptor myFilterSecurityInterceptor; 30 | 31 | 32 | // @Override 33 | // public AuthenticationManager authenticationManagerBean() throws Exception { 34 | // return super.authenticationManagerBean(); 35 | // } 36 | 37 | @Override 38 | public void configure(WebSecurity web)throws Exception { 39 | // 设置不拦截规则 40 | web.ignoring().antMatchers("/css/**","/js/**","/img/**","/font-awesome/**"); 41 | } 42 | 43 | @Override 44 | protected void configure(HttpSecurity http) throws Exception { 45 | http 46 | .addFilterBefore(myFilterSecurityInterceptor, FilterSecurityInterceptor.class)//在正确的位置添加我们自定义的过滤器 47 | .authorizeRequests() 48 | .anyRequest().authenticated() 49 | // .and().formLogin().and() 50 | // .httpBasic(); 51 | // 自定义登录页面 52 | .and() 53 | .formLogin().loginPage("/jsp/login.jsp") 54 | .failureUrl("/jsp/login.jsp?error=1") 55 | .loginProcessingUrl("/spring_security_check") 56 | .usernameParameter("username") 57 | .passwordParameter("password").permitAll().defaultSuccessUrl("/index.do"); 58 | 59 | //如果开启了CSRF 退出则需要使用POST访问,可以使用以下方式解决,但并不推荐 60 | http.logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout")) 61 | // 登陆成功后跳转的地址,以及删除的cookie名称 62 | .logoutSuccessUrl("/jsp/login.jsp?error=logout") 63 | .invalidateHttpSession(true); 64 | } 65 | 66 | 67 | 68 | @Override 69 | protected void configure(AuthenticationManagerBuilder auth) 70 | throws Exception { 71 | 72 | //启用内存用户存储 73 | /*auth.inMemoryAuthentication() 74 | .withUser("user1").password("123456").roles("USER").and() 75 | .withUser("admin").password("admin").roles("USER","ADMIN");*/ 76 | // 77 | //给予数据库表认证 78 | /*auth.jdbcAuthentication().dataSource(dataSource) 79 | .usersByUsernameQuery("select username,password,enable from t_user where username=?") 80 | .authoritiesByUsernameQuery("select username,rolename from t_role where username=?"); 81 | */ 82 | //配置自定义的用户服务 83 | auth.userDetailsService(myUserDetailService).passwordEncoder(new Md5PasswordEncoder()); 84 | 85 | } 86 | 87 | 88 | 89 | } 90 | -------------------------------------------------------------------------------- /src/main/java/com/study/controller/IndexController.java: -------------------------------------------------------------------------------- 1 | package com.study.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | @Controller 7 | public class IndexController { 8 | 9 | @RequestMapping(value={"/index.do",""}) 10 | public String index(){ 11 | return "user/userList"; 12 | } 13 | 14 | @RequestMapping("roles.do") 15 | public String roles(){ 16 | return "role/roleList"; 17 | } 18 | 19 | @RequestMapping("resources.do") 20 | public String resources(){ 21 | return "resources/resourceList"; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/study/controller/ResourcesController.java: -------------------------------------------------------------------------------- 1 | package com.study.controller; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import javax.annotation.Resource; 8 | import javax.servlet.http.HttpServletRequest; 9 | 10 | import org.springframework.security.core.context.SecurityContextImpl; 11 | import org.springframework.stereotype.Controller; 12 | import org.springframework.web.bind.annotation.RequestMapping; 13 | import org.springframework.web.bind.annotation.RequestParam; 14 | import org.springframework.web.bind.annotation.RestController; 15 | 16 | import com.github.pagehelper.PageInfo; 17 | import com.study.model.RResources; 18 | import com.study.model.Resources; 19 | import com.study.service.ResourcesService; 20 | 21 | @Controller 22 | @RestController 23 | @RequestMapping("/resources") 24 | public class ResourcesController { 25 | 26 | @Resource 27 | private ResourcesService resourcesService; 28 | 29 | 30 | /** 31 | * 查询资源列表,并且返回指定角色是否拥有该资源的权限 32 | * @param rid 角色id 33 | * @return 34 | */ 35 | @RequestMapping("/resourcesListWithRole.do") 36 | public List resourcesListWithRole(Integer rid){ 37 | List list = resourcesService.resourcesListWithRole(rid); 38 | return list; 39 | } 40 | 41 | 42 | @RequestMapping("/resourcesList.do") 43 | public Map resourcesList(Resources resources,String draw, 44 | @RequestParam(required = false, defaultValue = "1") int start, 45 | @RequestParam(required = false, defaultValue = "10") int length){ 46 | Map map = new HashMap<>(); 47 | PageInfo pageInfo = resourcesService.selectByPage(resources, start, length); 48 | map.put("draw",draw); 49 | map.put("recordsTotal",pageInfo.getTotal()); 50 | map.put("recordsFiltered",pageInfo.getTotal()); 51 | map.put("data", pageInfo.getList()); 52 | return map; 53 | } 54 | 55 | @RequestMapping("/addResources.do") 56 | public String addResources(Resources resources){ 57 | try { 58 | resourcesService.addResources(resources); 59 | return "success"; 60 | } catch (Exception e) { 61 | e.printStackTrace(); 62 | return "fail"; 63 | } 64 | } 65 | 66 | 67 | @RequestMapping("/delResources.do") 68 | public String delResources(Integer id){ 69 | try { 70 | resourcesService.delResources(id); 71 | return "success"; 72 | } catch (Exception e) { 73 | e.printStackTrace(); 74 | return "fail"; 75 | } 76 | } 77 | 78 | @RequestMapping("/loadMenu.do") 79 | public List loadMenu(HttpServletRequest request){ 80 | SecurityContextImpl securityContextImpl = (SecurityContextImpl) request 81 | .getSession().getAttribute("SPRING_SECURITY_CONTEXT"); 82 | String name = securityContextImpl.getAuthentication().getName(); 83 | Resources resources= new Resources(); 84 | resources.setUsername(name); 85 | resources.setType(1); 86 | List menu = resourcesService.loadMenu(resources); 87 | return menu; 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/main/java/com/study/controller/RoleController.java: -------------------------------------------------------------------------------- 1 | package com.study.controller; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import javax.annotation.Resource; 8 | 9 | import org.springframework.stereotype.Controller; 10 | import org.springframework.util.StringUtils; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RequestParam; 13 | import org.springframework.web.bind.annotation.RestController; 14 | 15 | import com.github.pagehelper.PageInfo; 16 | import com.study.model.Role; 17 | import com.study.model.RoleResources; 18 | import com.study.model.URole; 19 | import com.study.service.RoleService; 20 | 21 | @Controller 22 | @RestController 23 | @RequestMapping("/role") 24 | public class RoleController { 25 | 26 | @Resource 27 | private RoleService roleService; 28 | 29 | @RequestMapping("/roleList.do") 30 | public Map userList(Role role,String draw, 31 | @RequestParam(required = false, defaultValue = "1") int start, 32 | @RequestParam(required = false, defaultValue = "10") int length){ 33 | Map map = new HashMap<>(); 34 | PageInfo pageInfo = roleService.selectByPage(role, start, length); 35 | map.put("draw",draw); 36 | map.put("recordsTotal",pageInfo.getTotal()); 37 | map.put("recordsFiltered",pageInfo.getTotal()); 38 | map.put("data", pageInfo.getList()); 39 | return map; 40 | } 41 | 42 | /** 43 | * 查询角色列表,并且返回指定用户是否拥有该角色 44 | * @param uid 用户id 45 | * @return 46 | */ 47 | @RequestMapping("/roleListWithUser.do") 48 | public List roleListWithUser(Integer uid){ 49 | List list = roleService.queryRoleListWithUser(uid); 50 | return list; 51 | } 52 | 53 | /** 54 | * 保存角色的权限 55 | * @param roleResources 56 | * roleResources 中的resourcesId 现在是以“,”分隔的字符串 57 | * @return 58 | */ 59 | @RequestMapping("/saveRoleResources.do") 60 | public String saveRoleResources(RoleResources roleResources){ 61 | if(StringUtils.isEmpty(roleResources.getRoleId())) 62 | return "error"; 63 | try { 64 | roleService.saveRoleResources(roleResources); 65 | return "success"; 66 | } catch (Exception e) { 67 | e.printStackTrace(); 68 | return "fail"; 69 | } 70 | } 71 | 72 | /** 73 | * 添加角色 74 | * @return 75 | */ 76 | @RequestMapping("/addRole.do") 77 | public String addRole(Role role){ 78 | try { 79 | roleService.addRole(role); 80 | return "success"; 81 | } catch (Exception e) { 82 | e.printStackTrace(); 83 | return "fail"; 84 | } 85 | } 86 | 87 | @RequestMapping("/delRole.do") 88 | public String delRole(Integer id){ 89 | try { 90 | roleService.delRole(id); 91 | return "success"; 92 | } catch (Exception e) { 93 | e.printStackTrace(); 94 | return "fail"; 95 | } 96 | } 97 | 98 | 99 | } 100 | -------------------------------------------------------------------------------- /src/main/java/com/study/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.study.controller; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | import javax.annotation.Resource; 7 | 8 | import org.springframework.stereotype.Controller; 9 | import org.springframework.util.StringUtils; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RequestParam; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | import com.github.pagehelper.PageInfo; 15 | import com.study.model.User; 16 | import com.study.model.UserRole; 17 | import com.study.service.UserService; 18 | 19 | @Controller 20 | @RequestMapping("/user") 21 | @RestController 22 | public class UserController { 23 | 24 | @Resource 25 | private UserService userService; 26 | /** 27 | * 获取用户列表 28 | * @param user 用户对象 29 | * @param draw dataTables特有参数,原样返回即可 30 | * @param start 起始数据 31 | * @param length 每页的长度 32 | * @return 33 | */ 34 | @RequestMapping("/userList.do") 35 | public Map userList(User user,String draw, 36 | @RequestParam(required = false, defaultValue = "1") int start, 37 | @RequestParam(required = false, defaultValue = "10") int length){ 38 | Map map = new HashMap<>(); 39 | PageInfo pageInfo = userService.selectByPage(user, start, length); 40 | System.out.println("pageInfo.getTotal():"+pageInfo.getTotal()); 41 | map.put("draw",draw); 42 | map.put("recordsTotal",pageInfo.getTotal()); 43 | map.put("recordsFiltered",pageInfo.getTotal()); 44 | map.put("data", pageInfo.getList()); 45 | return map; 46 | } 47 | 48 | /** 49 | * 保存用户角色 50 | * @param userRole 用户角色 51 | * 此处获取的参数的角色id是以 “,” 分隔的字符串 52 | * @return 53 | */ 54 | @RequestMapping("/saveUserRoles.do") 55 | public String saveUserRoles(UserRole userRole){ 56 | if(StringUtils.isEmpty(userRole.getUserId())) 57 | return "error"; 58 | try { 59 | userService.saveUserRoles(userRole); 60 | return "success"; 61 | } catch (Exception e) { 62 | e.printStackTrace(); 63 | return "fail"; 64 | } 65 | } 66 | 67 | @RequestMapping("/addUser.do") 68 | public String addUser(User user){ 69 | User u = userService.queryByName(user.getUsername()); 70 | if(u != null) 71 | return "error"; 72 | try { 73 | userService.addUser(user); 74 | return "success"; 75 | } catch (Exception e) { 76 | e.printStackTrace(); 77 | return "fail"; 78 | } 79 | } 80 | 81 | @RequestMapping("/delUser.do") 82 | public String delUser(Integer id){ 83 | try { 84 | userService.delUser(id); 85 | return "success"; 86 | } catch (Exception e) { 87 | e.printStackTrace(); 88 | return "fail"; 89 | } 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/com/study/dao/BaseDao.java: -------------------------------------------------------------------------------- 1 | package com.study.dao; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * 已经实现基本的 分页 增,删,改,查接口,不需要重复写 7 | * 所有dao都继承这个BaseDao 8 | */ 9 | public interface BaseDao { 10 | //public List findByPage(Map map); 11 | 12 | //public int getCount(Map map); 13 | 14 | public List queryAll(Object obj); 15 | 16 | public Object queryEntityById(String id); 17 | 18 | public void addEntity(Object obj); 19 | 20 | public void deleteEntity(Integer id); 21 | 22 | public void editEntity(Object obj); 23 | 24 | public Object queryEntity(Object obj); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/study/dao/ResourcesDao.java: -------------------------------------------------------------------------------- 1 | package com.study.dao; 2 | 3 | import java.util.List; 4 | 5 | import com.study.model.RResources; 6 | import com.study.model.Resources; 7 | 8 | public interface ResourcesDao extends BaseDao{ 9 | 10 | public List resourcesListWithRole(Integer rid); 11 | 12 | public List findAllResourcesWithRoles(); 13 | 14 | public List loadMenu(Resources resources); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/study/dao/RoleDao.java: -------------------------------------------------------------------------------- 1 | package com.study.dao; 2 | 3 | import java.util.List; 4 | 5 | import com.study.model.RoleResources; 6 | import com.study.model.URole; 7 | 8 | public interface RoleDao extends BaseDao{ 9 | 10 | 11 | public List queryRoleListWithUser(Integer id); 12 | 13 | public void deleteRoleResources(Integer id); 14 | 15 | public void addRoleResources(RoleResources roleResources); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/study/dao/UserDao.java: -------------------------------------------------------------------------------- 1 | package com.study.dao; 2 | 3 | import com.study.model.User; 4 | import com.study.model.UserRole; 5 | 6 | public interface UserDao extends BaseDao{ 7 | 8 | public User findUserByName(String username); 9 | 10 | public void delRolesByUserId(String userId); 11 | 12 | public void addUserRole(UserRole userRole); 13 | 14 | public User queryByName(String username); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/study/model/RResources.java: -------------------------------------------------------------------------------- 1 | package com.study.model; 2 | /** 3 | * 用于前台资源列表展示 4 | * @author Administrator 5 | * 6 | */ 7 | public class RResources extends Resources{ 8 | /** 9 | * 10 | */ 11 | private static final long serialVersionUID = 1L; 12 | private String checked;//是否选中 13 | 14 | public String getChecked() { 15 | return checked; 16 | } 17 | 18 | public void setChecked(String checked) { 19 | this.checked = checked; 20 | } 21 | 22 | 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/study/model/Resources.java: -------------------------------------------------------------------------------- 1 | package com.study.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | /** 6 | * 资源实体类 7 | * @author Administrator 8 | * 9 | */ 10 | public class Resources implements Serializable { 11 | /** 12 | * 13 | */ 14 | private static final long serialVersionUID = -7749594385945332343L; 15 | private Integer id; 16 | private String name;//资源名称 17 | private String parentId;//父资源 18 | private String resUrl;//资源链接 19 | private String resKey;//资源key 20 | private Integer type;//资源类型 1:菜单 2:按钮 21 | private Integer sort;//排序 22 | 23 | private List roles; //可访问角色 24 | 25 | private String username;//只用于临时存储数据 26 | public Integer getId() { 27 | return id; 28 | } 29 | public void setId(Integer id) { 30 | this.id = id; 31 | } 32 | public String getName() { 33 | return name; 34 | } 35 | public void setName(String name) { 36 | this.name = name; 37 | } 38 | public String getParentId() { 39 | return parentId; 40 | } 41 | public void setParentId(String parentId) { 42 | this.parentId = parentId; 43 | } 44 | public String getResUrl() { 45 | return resUrl; 46 | } 47 | public void setResUrl(String resUrl) { 48 | this.resUrl = resUrl; 49 | } 50 | public Integer getType() { 51 | return type; 52 | } 53 | public void setType(Integer type) { 54 | this.type = type; 55 | } 56 | 57 | public Integer getSort() { 58 | return sort; 59 | } 60 | public void setSort(Integer sort) { 61 | this.sort = sort; 62 | } 63 | 64 | public List getRoles() { 65 | return roles; 66 | } 67 | public void setRoles(List roles) { 68 | this.roles = roles; 69 | } 70 | public String getUsername() { 71 | return username; 72 | } 73 | public void setUsername(String username) { 74 | this.username = username; 75 | } 76 | public String getResKey() { 77 | return resKey; 78 | } 79 | public void setResKey(String resKey) { 80 | this.resKey = resKey; 81 | } 82 | @Override 83 | public String toString() { 84 | return "Resources [id=" + id + ", name=" + name + ", parentId=" 85 | + parentId + ", resUrl=" + resUrl + ", resKey=" + resKey 86 | + ", type=" + type + ", sort=" + sort + ", roles=" + roles 87 | + ", username=" + username + "]"; 88 | } 89 | 90 | 91 | 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/com/study/model/Role.java: -------------------------------------------------------------------------------- 1 | package com.study.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | /** 6 | * 角色实体类 7 | * @author Administrator 8 | * 9 | */ 10 | public class Role implements Serializable{ 11 | /** 12 | * 13 | */ 14 | private static final long serialVersionUID = 2322564038632517975L; 15 | private Integer id; 16 | private String roleKey; //角色key 17 | private String roleDesc;//角色名称 18 | 19 | private List resources; 20 | 21 | public Integer getId() { 22 | return id; 23 | } 24 | public void setId(Integer id) { 25 | this.id = id; 26 | } 27 | public String getRoleKey() { 28 | return roleKey; 29 | } 30 | public void setRoleKey(String roleKey) { 31 | this.roleKey = roleKey; 32 | } 33 | public String getRoleDesc() { 34 | return roleDesc; 35 | } 36 | public void setRoleDesc(String roleDesc) { 37 | this.roleDesc = roleDesc; 38 | } 39 | 40 | public List getResources() { 41 | return resources; 42 | } 43 | public void setResources(List resources) { 44 | this.resources = resources; 45 | } 46 | 47 | @Override 48 | public String toString() { 49 | return "Role [id=" + id + ", roleKey=" + roleKey + ", roleDesc=" 50 | + roleDesc + ", resources=" + resources + "]"; 51 | } 52 | 53 | 54 | 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/study/model/RoleResources.java: -------------------------------------------------------------------------------- 1 | package com.study.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * 角色资源实体类 7 | * @author Administrator 8 | * 9 | */ 10 | public class RoleResources implements Serializable{ 11 | 12 | /** 13 | * 14 | */ 15 | private static final long serialVersionUID = 3011087297090375810L; 16 | private String roleId;//角色id 17 | private String resourcesId;//资源id 18 | 19 | public String getRoleId() { 20 | return roleId; 21 | } 22 | public void setRoleId(String roleId) { 23 | this.roleId = roleId; 24 | } 25 | public String getResourcesId() { 26 | return resourcesId; 27 | } 28 | public void setResourcesId(String resourcesId) { 29 | this.resourcesId = resourcesId; 30 | } 31 | 32 | 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/study/model/URole.java: -------------------------------------------------------------------------------- 1 | package com.study.model; 2 | 3 | /** 4 | * 用于前台 角色列表展示,selected 代表选择用户是否拥有该角色 5 | * @author Administrator 6 | * 7 | */ 8 | public class URole extends Role{ 9 | 10 | /** 11 | * 12 | */ 13 | private static final long serialVersionUID = 1L; 14 | private Integer selected; 15 | 16 | public Integer getSelected() { 17 | return selected; 18 | } 19 | 20 | public void setSelected(Integer selected) { 21 | this.selected = selected; 22 | } 23 | 24 | @Override 25 | public String toString() { 26 | return "URole [selected=" + selected + "]"; 27 | } 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/study/model/User.java: -------------------------------------------------------------------------------- 1 | package com.study.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Set; 5 | /** 6 | * 用户实体类 7 | * @author Administrator 8 | * 9 | */ 10 | public class User implements Serializable{ 11 | /** 12 | * 13 | */ 14 | private static final long serialVersionUID = -1223385920196007622L; 15 | private Integer id; 16 | private String username; 17 | private String password; 18 | private Integer enable; 19 | 20 | private Set roles; 21 | 22 | public Integer getId() { 23 | return id; 24 | } 25 | public void setId(Integer id) { 26 | this.id = id; 27 | } 28 | public String getUsername() { 29 | return username; 30 | } 31 | public void setUsername(String username) { 32 | this.username = username; 33 | } 34 | public String getPassword() { 35 | return password; 36 | } 37 | public void setPassword(String password) { 38 | this.password = password; 39 | } 40 | 41 | public Integer getEnable() { 42 | return enable; 43 | } 44 | public void setEnable(Integer enable) { 45 | this.enable = enable; 46 | } 47 | public Set getRoles() { 48 | return roles; 49 | } 50 | public void setRoles(Set roles) { 51 | this.roles = roles; 52 | } 53 | @Override 54 | public String toString() { 55 | return "User [id=" + id + ", username=" + username + ", password=" 56 | + password + ", enable=" + enable + ", roles=" + roles + "]"; 57 | } 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/study/model/UserRole.java: -------------------------------------------------------------------------------- 1 | package com.study.model; 2 | 3 | import java.io.Serializable; 4 | /** 5 | * 用户角色实体类 6 | * @author Administrator 7 | * 8 | */ 9 | public class UserRole implements Serializable { 10 | 11 | /** 12 | * 13 | */ 14 | private static final long serialVersionUID = -8427279160142988516L; 15 | 16 | private String userId; 17 | private String roleId; 18 | public String getUserId() { 19 | return userId; 20 | } 21 | public void setUserId(String userId) { 22 | this.userId = userId; 23 | } 24 | public String getRoleId() { 25 | return roleId; 26 | } 27 | public void setRoleId(String roleId) { 28 | this.roleId = roleId; 29 | } 30 | 31 | 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/study/security/MyAccessDecisionManager.java: -------------------------------------------------------------------------------- 1 | package com.study.security; 2 | import java.util.Collection; 3 | import java.util.Iterator; 4 | 5 | import org.springframework.security.access.AccessDecisionManager; 6 | import org.springframework.security.access.AccessDeniedException; 7 | import org.springframework.security.access.ConfigAttribute; 8 | import org.springframework.security.authentication.InsufficientAuthenticationException; 9 | import org.springframework.security.core.Authentication; 10 | import org.springframework.security.core.GrantedAuthority; 11 | import org.springframework.stereotype.Component; 12 | /** 13 | * 14 | * 15 | */ 16 | @Component 17 | public class MyAccessDecisionManager implements AccessDecisionManager { 18 | 19 | public void decide(Authentication authentication, Object object, Collection configAttributes) throws AccessDeniedException, InsufficientAuthenticationException { 20 | if(configAttributes == null) { 21 | return; 22 | } 23 | //所请求的资源拥有的权限(一个资源对多个权限) 24 | Iterator iterator = configAttributes.iterator(); 25 | while(iterator.hasNext()) { 26 | ConfigAttribute configAttribute = iterator.next(); 27 | //访问所请求资源所需要的权限 28 | String needPermission = configAttribute.getAttribute(); 29 | System.out.println("needPermission is " + needPermission); 30 | //用户所拥有的权限authentication 31 | for(GrantedAuthority ga : authentication.getAuthorities()) { 32 | if(needPermission.equals(ga.getAuthority())) { 33 | return; 34 | } 35 | } 36 | } 37 | //没有权限 38 | throw new AccessDeniedException(" 没有权限访问或未重新登录! "); 39 | } 40 | 41 | public boolean supports(ConfigAttribute attribute) { 42 | // TODO Auto-generated method stub 43 | return true; 44 | } 45 | 46 | public boolean supports(Class clazz) { 47 | // TODO Auto-generated method stub 48 | return true; 49 | } 50 | 51 | } -------------------------------------------------------------------------------- /src/main/java/com/study/security/MyFilterSecurityInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.study.security; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.annotation.PostConstruct; 6 | import javax.annotation.Resource; 7 | import javax.servlet.Filter; 8 | import javax.servlet.FilterChain; 9 | import javax.servlet.FilterConfig; 10 | import javax.servlet.ServletException; 11 | import javax.servlet.ServletRequest; 12 | import javax.servlet.ServletResponse; 13 | 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.security.access.SecurityMetadataSource; 16 | import org.springframework.security.access.intercept.AbstractSecurityInterceptor; 17 | import org.springframework.security.access.intercept.InterceptorStatusToken; 18 | import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration; 19 | import org.springframework.security.web.FilterInvocation; 20 | import org.springframework.stereotype.Component; 21 | 22 | 23 | 24 | @Component 25 | public class MyFilterSecurityInterceptor extends AbstractSecurityInterceptor implements Filter { 26 | @Autowired 27 | private MySecurityMetadataSource securityMetadataSource; 28 | @Autowired 29 | private MyAccessDecisionManager accessDecisionManager; 30 | // @Resource(name="myAuthenticationManager") 31 | // private AuthenticationManager authenticationManager; 32 | 33 | @Resource 34 | private AuthenticationConfiguration authenticationConfiguration; 35 | 36 | // @Autowired 37 | // public void setAuthenticationConfiguration(AuthenticationConfiguration authenticationConfiguration) { 38 | // this.authenticationConfiguration = authenticationConfiguration; 39 | // } 40 | 41 | @PostConstruct 42 | public void init() throws Exception{ 43 | super.setAccessDecisionManager(accessDecisionManager); 44 | super.setAuthenticationManager(authenticationConfiguration.getAuthenticationManager()); 45 | } 46 | 47 | @Override 48 | public SecurityMetadataSource obtainSecurityMetadataSource() { 49 | return this.securityMetadataSource; 50 | } 51 | 52 | public void doFilter(ServletRequest request, ServletResponse response, 53 | FilterChain chain) throws IOException, ServletException { 54 | FilterInvocation fi = new FilterInvocation(request, response, chain); 55 | invoke(fi); 56 | } 57 | 58 | private void invoke(FilterInvocation fi) throws IOException, ServletException { 59 | // object为FilterInvocation对象 60 | //super.beforeInvocation(fi);源码 61 | //1.获取请求资源的权限 62 | //执行Collection attributes = SecurityMetadataSource.getAttributes(object); 63 | //2.是否拥有权限 64 | //this.accessDecisionManager.decide(authenticated, object, attributes); 65 | // System.err.println(" --------------- MySecurityFilter invoke--------------- "); 66 | InterceptorStatusToken token = super.beforeInvocation(fi); 67 | try { 68 | fi.getChain().doFilter(fi.getRequest(), fi.getResponse()); 69 | } finally { 70 | super.afterInvocation(token, null); 71 | } 72 | } 73 | 74 | public void init(FilterConfig arg0) throws ServletException { 75 | } 76 | 77 | public void destroy() { 78 | 79 | } 80 | 81 | @Override 82 | public Class getSecureObjectClass() { 83 | //下面的MyAccessDecisionManager的supports方面必须放回true,否则会提醒类型错误 84 | return FilterInvocation.class; 85 | } 86 | } -------------------------------------------------------------------------------- /src/main/java/com/study/security/MySecurityMetadataSource.java: -------------------------------------------------------------------------------- 1 | package com.study.security; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collection; 5 | import java.util.HashMap; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | import javax.annotation.PostConstruct; 10 | import javax.annotation.Resource; 11 | 12 | import org.springframework.security.access.ConfigAttribute; 13 | import org.springframework.security.access.SecurityConfig; 14 | import org.springframework.security.web.FilterInvocation; 15 | import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; 16 | import org.springframework.stereotype.Component; 17 | 18 | import com.study.dao.ResourcesDao; 19 | import com.study.model.Resources; 20 | 21 | /** 22 | * 加载资源与权限的对应关系 23 | */ 24 | @Component 25 | public class MySecurityMetadataSource implements FilterInvocationSecurityMetadataSource { 26 | 27 | @Resource 28 | private ResourcesDao resourcesDao; 29 | 30 | 31 | private static Map> resourceMap = null; 32 | 33 | public Collection getAllConfigAttributes() { 34 | return null; 35 | } 36 | 37 | public boolean supports(Class clazz) { 38 | return true; 39 | } 40 | /** 41 | * @PostConstruct是Java EE 5引入的注解, 42 | * Spring允许开发者在受管Bean中使用它。当DI容器实例化当前受管Bean时, 43 | * @PostConstruct注解的方法会被自动触发,从而完成一些初始化工作, 44 | * 45 | * //加载所有资源与权限的关系 46 | */ 47 | @PostConstruct 48 | private void loadResourceDefine() { 49 | if (resourceMap == null) { 50 | resourceMap = new HashMap>(); 51 | List list = resourcesDao.queryAll(new Resources()); 52 | for (Resources resources : list) { 53 | Collection configAttributes = new ArrayList(); 54 | // 通过资源名称来表示具体的权限 注意:必须"ROLE_"开头 55 | ConfigAttribute configAttribute = new SecurityConfig("ROLE_" + resources.getResKey()); 56 | configAttributes.add(configAttribute); 57 | resourceMap.put(resources.getResUrl(), configAttributes); 58 | } 59 | } 60 | } 61 | //返回所请求资源所需要的权限 62 | public Collection getAttributes(Object object) throws IllegalArgumentException { 63 | String requestUrl = ((FilterInvocation) object).getRequestUrl(); 64 | // System.out.println("requestUrl is " + requestUrl); 65 | if(resourceMap == null) { 66 | loadResourceDefine(); 67 | } 68 | //System.err.println("resourceMap.get(requestUrl); "+resourceMap.get(requestUrl)); 69 | if(requestUrl.indexOf("?")>-1){ 70 | requestUrl=requestUrl.substring(0,requestUrl.indexOf("?")); 71 | } 72 | Collection configAttributes = resourceMap.get(requestUrl); 73 | return configAttributes; 74 | } 75 | 76 | 77 | } -------------------------------------------------------------------------------- /src/main/java/com/study/security/MyUserDetailServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.study.security; 2 | 3 | import java.util.HashSet; 4 | import java.util.List; 5 | import java.util.Set; 6 | 7 | import javax.annotation.Resource; 8 | 9 | import org.springframework.security.core.GrantedAuthority; 10 | import org.springframework.security.core.authority.SimpleGrantedAuthority; 11 | import org.springframework.security.core.userdetails.UserDetails; 12 | import org.springframework.security.core.userdetails.UserDetailsService; 13 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 14 | import org.springframework.stereotype.Component; 15 | 16 | import com.study.model.Resources; 17 | import com.study.model.User; 18 | import com.study.service.ResourcesService; 19 | import com.study.service.UserService; 20 | 21 | @Component("myUserDetailService") 22 | public class MyUserDetailServiceImpl implements UserDetailsService{ 23 | 24 | @Resource 25 | private UserService userService; 26 | 27 | @Resource 28 | private ResourcesService resourcesService; 29 | @Override 30 | public UserDetails loadUserByUsername(String username) 31 | throws UsernameNotFoundException { 32 | User user = userService.findUserByName(username); 33 | if(user ==null) 34 | throw new UsernameNotFoundException(username+" not exist!"); 35 | Set authSet = new HashSet(); 36 | Resources resources = new Resources(); 37 | resources.setUsername(username); 38 | List list = resourcesService.loadMenu(resources); 39 | for (Resources r : list) { 40 | authSet.add(new SimpleGrantedAuthority("ROLE_" +r.getResKey())); 41 | } 42 | return new org.springframework.security.core.userdetails.User(user.getUsername(), 43 | user.getPassword(), 44 | user.getEnable()==1?true:false, 45 | true, 46 | true, 47 | true, 48 | authSet); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/study/service/ResourcesService.java: -------------------------------------------------------------------------------- 1 | package com.study.service; 2 | 3 | import java.util.List; 4 | 5 | import com.github.pagehelper.PageInfo; 6 | import com.study.model.RResources; 7 | import com.study.model.Resources; 8 | 9 | public interface ResourcesService { 10 | 11 | public List resourcesListWithRole(Integer rid); 12 | 13 | public PageInfo selectByPage(Resources resources, int start, int length); 14 | 15 | public void addResources(Resources resources); 16 | 17 | public void delResources(Integer id); 18 | 19 | public List loadMenu(Resources resources); 20 | 21 | public ListqueryAll(); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/study/service/RoleService.java: -------------------------------------------------------------------------------- 1 | package com.study.service; 2 | 3 | import java.util.List; 4 | 5 | import com.github.pagehelper.PageInfo; 6 | import com.study.model.Role; 7 | import com.study.model.RoleResources; 8 | import com.study.model.URole; 9 | 10 | public interface RoleService { 11 | 12 | 13 | public PageInfo selectByPage(Role role, int start, int length); 14 | 15 | /** 16 | * 查询所有角色,并且包含当前用户是否选中 17 | * @param id 18 | * @return 19 | */ 20 | public List queryRoleListWithUser(Integer id); 21 | 22 | public void saveRoleResources(RoleResources roleResources); 23 | 24 | public void addRole(Role role); 25 | 26 | public void delRole(Integer id); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/study/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.study.service; 2 | 3 | import com.github.pagehelper.PageInfo; 4 | import com.study.model.User; 5 | import com.study.model.UserRole; 6 | 7 | public interface UserService { 8 | 9 | public User findUserByName(String name); 10 | 11 | /** 12 | * 根据条件分页查询 13 | * 14 | * @param user 15 | * @param page 16 | * @param rows 17 | * @return 18 | */ 19 | public PageInfo selectByPage(User user, int start, int length); 20 | 21 | public void saveUserRoles(UserRole userRole); 22 | 23 | public void addUser(User user); 24 | 25 | public void delUser(Integer id); 26 | 27 | public User queryByName(String username); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/study/service/impl/ResourcesServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.study.service.impl; 2 | 3 | import java.util.List; 4 | 5 | import javax.annotation.Resource; 6 | 7 | import org.springframework.cache.annotation.CacheEvict; 8 | import org.springframework.cache.annotation.Cacheable; 9 | import org.springframework.stereotype.Service; 10 | 11 | import com.github.pagehelper.PageHelper; 12 | import com.github.pagehelper.PageInfo; 13 | import com.study.dao.ResourcesDao; 14 | import com.study.model.RResources; 15 | import com.study.model.Resources; 16 | import com.study.service.ResourcesService; 17 | @Service("resourcesService") 18 | public class ResourcesServiceImpl implements ResourcesService{ 19 | 20 | @Resource 21 | private ResourcesDao resourcesDao; 22 | 23 | @Override 24 | public List resourcesListWithRole(Integer rid) { 25 | return resourcesDao.resourcesListWithRole(rid); 26 | } 27 | 28 | @Override 29 | public PageInfo selectByPage(Resources resources, int start, int length) { 30 | int page = start/length+1; 31 | PageHelper.startPage(page, length); 32 | List resourcelist = resourcesDao.queryAll(resources); 33 | return new PageInfo<>(resourcelist); 34 | } 35 | 36 | @Override 37 | @CacheEvict(cacheNames="myCache",allEntries=true) 38 | public void addResources(Resources resources) { 39 | resourcesDao.addEntity(resources); 40 | } 41 | 42 | @Override 43 | @CacheEvict(cacheNames="myCache",allEntries=true) 44 | public void delResources(Integer id) { 45 | resourcesDao.deleteEntity(id); 46 | } 47 | 48 | @Override 49 | @Cacheable(cacheNames="myCache",key="#resources.resUrl + #resources.username+#resources.type") 50 | public List loadMenu(Resources resources) { 51 | return resourcesDao.loadMenu(resources); 52 | } 53 | @Cacheable(cacheNames="myCache") 54 | @Override 55 | public List queryAll() { 56 | return resourcesDao.queryAll(new Resources()); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/study/service/impl/RoleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.study.service.impl; 2 | 3 | import java.util.List; 4 | 5 | import javax.annotation.Resource; 6 | 7 | import org.springframework.cache.annotation.CacheEvict; 8 | import org.springframework.stereotype.Service; 9 | import org.springframework.transaction.annotation.Propagation; 10 | import org.springframework.transaction.annotation.Transactional; 11 | import org.springframework.util.StringUtils; 12 | 13 | import com.github.pagehelper.PageHelper; 14 | import com.github.pagehelper.PageInfo; 15 | import com.study.dao.RoleDao; 16 | import com.study.dao.UserDao; 17 | import com.study.model.Role; 18 | import com.study.model.RoleResources; 19 | import com.study.model.URole; 20 | import com.study.service.RoleService; 21 | 22 | @Service("roleService") 23 | public class RoleServiceImpl implements RoleService{ 24 | 25 | @Resource 26 | private RoleDao roleDao; 27 | @Resource 28 | private UserDao userDao; 29 | 30 | @Override 31 | public PageInfo selectByPage(Role role,int start, int length) { 32 | int page = start/length+1; 33 | //分页查询 34 | PageHelper.startPage(page, length); 35 | List rolelist = roleDao.queryAll(role); 36 | return new PageInfo<>(rolelist); 37 | } 38 | 39 | @Override 40 | public List queryRoleListWithUser(Integer id) { 41 | return roleDao.queryRoleListWithUser(id); 42 | } 43 | 44 | @Override 45 | @CacheEvict(cacheNames="myCache",allEntries=true) 46 | @Transactional(propagation=Propagation.REQUIRED,readOnly=false,rollbackFor={Exception.class}) 47 | public void saveRoleResources(RoleResources roleResources) { 48 | String roleId = roleResources.getRoleId(); 49 | String resourcesIds = roleResources.getResourcesId(); 50 | //先删除 51 | roleDao.deleteRoleResources(Integer.valueOf(roleId)); 52 | //添加 53 | if(!StringUtils.isEmpty(resourcesIds)){ 54 | String[] resourcesIdArray = resourcesIds.split(","); 55 | for (String resourcesId : resourcesIdArray) { 56 | roleResources.setResourcesId(resourcesId); 57 | roleDao.addRoleResources(roleResources); 58 | } 59 | } 60 | } 61 | 62 | @Override 63 | public void addRole(Role role) { 64 | roleDao.addEntity(role); 65 | } 66 | 67 | @Override 68 | public void delRole(Integer id) { 69 | roleDao.deleteEntity(id); 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/com/study/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.study.service.impl; 2 | 3 | import java.util.List; 4 | 5 | import javax.annotation.Resource; 6 | 7 | import org.springframework.security.authentication.encoding.Md5PasswordEncoder; 8 | import org.springframework.stereotype.Service; 9 | import org.springframework.transaction.annotation.Propagation; 10 | import org.springframework.transaction.annotation.Transactional; 11 | 12 | import com.github.pagehelper.PageHelper; 13 | import com.github.pagehelper.PageInfo; 14 | import com.study.dao.UserDao; 15 | import com.study.model.User; 16 | import com.study.model.UserRole; 17 | import com.study.service.UserService; 18 | @Service 19 | public class UserServiceImpl implements UserService{ 20 | 21 | @Resource 22 | private UserDao userDao; 23 | 24 | @Override 25 | public User findUserByName(String name) { 26 | return userDao.findUserByName(name); 27 | } 28 | 29 | @Override 30 | public PageInfo selectByPage(User user,int start, int length) { 31 | int page = start/length+1; 32 | //分页查询 33 | PageHelper.startPage(page, length); 34 | List userlist = userDao.queryAll(user); 35 | return new PageInfo<>(userlist); 36 | } 37 | 38 | @Override 39 | @Transactional(propagation=Propagation.REQUIRED,readOnly=false,rollbackFor={Exception.class}) 40 | public void saveUserRoles(UserRole userRole) { 41 | userDao.delRolesByUserId(userRole.getUserId()); 42 | String[] roleids = userRole.getRoleId().split(","); 43 | for (String roleId : roleids) { 44 | UserRole u = new UserRole(); 45 | u.setUserId(userRole.getUserId()); 46 | u.setRoleId(roleId); 47 | userDao.addUserRole(u); 48 | } 49 | } 50 | 51 | public void addUser(User user){ 52 | Md5PasswordEncoder md5=new Md5PasswordEncoder(); 53 | String encodePassword = md5.encodePassword(user.getPassword(), null); 54 | user.setPassword(encodePassword); 55 | userDao.addEntity(user); 56 | } 57 | 58 | @Override 59 | public void delUser(Integer id) { 60 | userDao.deleteEntity(id); 61 | } 62 | 63 | @Override 64 | public User queryByName(String username) { 65 | return userDao.queryByName(username); 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/study/tag/AuthorizeTag.java: -------------------------------------------------------------------------------- 1 | package com.study.tag; 2 | 3 | import java.util.List; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | import javax.servlet.jsp.tagext.BodyTagSupport; 7 | 8 | import org.springframework.security.core.context.SecurityContextImpl; 9 | import org.springframework.web.context.request.RequestContextHolder; 10 | import org.springframework.web.context.request.ServletRequestAttributes; 11 | 12 | import com.study.model.Resources; 13 | import com.study.service.ResourcesService; 14 | import com.study.util.SpringWiredBean; 15 | /** 16 | * 自定义标签 用于前台判断按钮权限 17 | * @author A 18 | * 19 | */ 20 | public class AuthorizeTag extends BodyTagSupport { 21 | private static final long serialVersionUID = 1L; 22 | 23 | private String buttonUrl; 24 | 25 | public String getButtonUrl() { 26 | return buttonUrl; 27 | } 28 | 29 | 30 | public void setButtonUrl(String buttonUrl) { 31 | this.buttonUrl = buttonUrl; 32 | } 33 | 34 | 35 | @SuppressWarnings("static-access") 36 | @Override 37 | public int doStartTag() { 38 | HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest(); 39 | SecurityContextImpl securityContextImpl = (SecurityContextImpl) request 40 | .getSession().getAttribute("SPRING_SECURITY_CONTEXT"); 41 | //获取当前登录名 42 | String name = securityContextImpl.getAuthentication().getName(); 43 | 44 | //如果数据库里有该链接,并且该用户的权限拥有该链接,则显示 。如果数据库没有该链接则不显示 45 | ResourcesService resourcesService= (ResourcesService) SpringWiredBean.getInstance().getBeanById("resourcesService"); 46 | List queryAll = resourcesService.queryAll(); 47 | boolean flag = true; 48 | for (Resources resources : queryAll) { 49 | if(resources.getResUrl().equals(buttonUrl)) 50 | flag = false; 51 | } 52 | if(flag) //数据库中没有该链接,直接显示 53 | return EVAL_BODY_INCLUDE; 54 | else{ 55 | Resources resources = new Resources(); 56 | resources.setUsername(name); 57 | resources.setResUrl(buttonUrl); 58 | List resourcesList = resourcesService.loadMenu(resources); 59 | if(resourcesList.size()>0) return EVAL_BODY_INCLUDE;//数据库中有该链接,并且该用户拥有该角色,显示 60 | } 61 | return this.SKIP_BODY; //不显示 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/study/util/SpringWiredBean.java: -------------------------------------------------------------------------------- 1 | package com.study.util; 2 | 3 | 4 | import org.springframework.beans.factory.BeanFactory; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.context.support.SpringBeanAutowiringSupport; 7 | 8 | public class SpringWiredBean extends SpringBeanAutowiringSupport { 9 | 10 | /** 11 | * 自动装配注解会让Spring通过类型匹配为beanFactory注入示例 12 | */ 13 | @Autowired 14 | private BeanFactory beanFactory; 15 | 16 | private SpringWiredBean() { 17 | } 18 | 19 | private static SpringWiredBean instance; 20 | 21 | static { 22 | // 静态块,初始化实例 23 | instance = new SpringWiredBean(); 24 | } 25 | 26 | /** 27 | * 实例方法 28 | * 使用的时候先通过getInstance方法获取实例 29 | * 30 | * @param beanId 31 | * @return 32 | */ 33 | public Object getBeanById(String beanId) { 34 | return beanFactory.getBean(beanId); 35 | } 36 | 37 | public static SpringWiredBean getInstance() { 38 | return instance; 39 | } 40 | } -------------------------------------------------------------------------------- /src/main/resources/ehcache.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 29 | 30 | 40 | 41 | 50 | -------------------------------------------------------------------------------- /src/main/resources/jdbc.properties: -------------------------------------------------------------------------------- 1 | jdbc.driver=com.mysql.jdbc.Driver 2 | jdbc.url=jdbc\:mysql\://localhost\:3306/mytest?useUnicode\=true&characterEncoding\=utf8&zeroDateTimeBehavior\=convertToNull&autoReconnect\=true&failOverReadOnly\=false 3 | jdbc.username=root 4 | jdbc.password=root 5 | initialSize=0 6 | maxActive=20 7 | maxIdle=20 8 | minIdle=1 9 | maxWait=60000 -------------------------------------------------------------------------------- /src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | ### 设置### 2 | log4j.rootLogger = debug,stdout 3 | ##log4j.rootLogger = info,stdout 4 | 5 | ### 输出信息到控制抬 ### 6 | log4j.appender.stdout = org.apache.log4j.ConsoleAppender 7 | log4j.appender.stdout.Target = System.out 8 | log4j.appender.stdout.layout = org.apache.log4j.PatternLayout 9 | log4j.appender.stdout.layout.ConversionPattern = [%-5p] %d{yyyy-MM-dd HH:mm:ss,SSS} method:%l%n%m%n 10 | ##log4j.logger.org.springframework.security=DEBUG 11 | log4j.logger.org.springframework.security=INFO 12 | ### 输出全部级别的日志到=oalog.log ### ### logs/oalog.log ### 13 | ### log4j.appender.D = org.apache.log4j.DailyRollingFileAppender 14 | ### log4j.appender.D.File = E\:\\oalog.log 15 | ### log4j.appender.D.Append = true 16 | ### log4j.appender.D.Threshold = ALL 17 | ### log4j.appender.D.layout = org.apache.log4j.PatternLayout 18 | ### log4j.appender.D.layout.ConversionPattern = %-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n 19 | 20 | ### 输出ERROR 级别以上的日志到=error.log ### 21 | ### log4j.appender.E = org.apache.log4j.DailyRollingFileAppender 22 | ### log4j.appender.E.File = E\:\\oaerror.log 23 | ### log4j.appender.E.Append = true 24 | ### log4j.appender.E.Threshold = ERROR 25 | ### log4j.appender.E.layout = org.apache.log4j.PatternLayout 26 | ### log4j.appender.E.layout.ConversionPattern =%-d{yyyy-MM-dd HH\:mm\:ss} [ %t\:%r ] - [ %p ] 27 | -------------------------------------------------------------------------------- /src/main/resources/mapping/ResourcesDaoMapping.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 15 | 16 | 21 | 22 | 23 | INSERT INTO t_resources(name,parentId,resUrl,type,sort,resKey) VALUES(#{name},#{parentId},#{resUrl},#{type},#{sort},#{resKey}) 24 | 25 | 26 | 27 | DELETE FROM t_resources WHERE id = #{id} 28 | 29 | 30 | 47 | -------------------------------------------------------------------------------- /src/main/resources/mapping/RoleDaoMapping.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 11 | 12 | 16 | 17 | 18 | DELETE FROM t_role_resources WHERE roleId =#{id} 19 | 20 | 21 | 22 | INSERT INTO t_role_resources(roleId,resourcesId) VALUES (#{roleId},#{resourcesId}) 23 | 24 | 25 | 26 | INSERT INTO t_role(roleDesc,roleKey) VALUES (#{roleDesc},#{roleKey}) 27 | 28 | 29 | 30 | DELETE FROM t_role WHERE id = #{id} 31 | 32 | 33 | 34 | UPDATE t_role 35 | SET roleDesc = #{roleDesc} 36 | WHERE id=#{id} 37 | 38 | -------------------------------------------------------------------------------- /src/main/resources/mapping/UserDaoMapping.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 12 | 13 | 26 | 27 | 28 | DELETE FROM t_user_role WHERE userId = #{userId} 29 | 30 | 31 | 32 | INSERT INTO t_user_role(userId,roleId) VALUES (#{userId},#{roleId}) 33 | 34 | 35 | 36 | INSERT INTO t_user(username,password,enable) VALUES(#{username},#{password},1) 37 | 38 | 39 | 40 | DELETE FROM t_user WHERE id = #{id} 41 | 42 | 43 | 48 | 49 | 50 | UPDATE t_user 51 | SET username = #{username}, 52 | password = #{password} 53 | WHERE id=#{id} 54 | 55 | -------------------------------------------------------------------------------- /src/main/webapp/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/authorize.tld: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 1.0 11 | security 12 | http://www.springsecurity.org/jsp 13 | 14 | 15 | 16 | 17 | authorize 18 | 19 | com.study.tag.AuthorizeTag 20 | 21 | JSP 22 | 23 | buttonUrl 24 | false 25 | true 26 | java.lang.String 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/webapp/css/dataTables.bootstrap.min.css: -------------------------------------------------------------------------------- 1 | table.dataTable{clear:both;margin-top:6px !important;margin-bottom:6px !important;max-width:none !important;border-collapse:separate !important}table.dataTable td,table.dataTable th{-webkit-box-sizing:content-box;box-sizing:content-box}table.dataTable td.dataTables_empty,table.dataTable th.dataTables_empty{text-align:center}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}div.dataTables_wrapper div.dataTables_length label{font-weight:normal;text-align:left;white-space:nowrap}div.dataTables_wrapper div.dataTables_length select{width:75px;display:inline-block}div.dataTables_wrapper div.dataTables_filter{text-align:right}div.dataTables_wrapper div.dataTables_filter label{font-weight:normal;white-space:nowrap;text-align:left}div.dataTables_wrapper div.dataTables_filter input{margin-left:0.5em;display:inline-block;width:auto}div.dataTables_wrapper div.dataTables_info{padding-top:8px;white-space:nowrap}div.dataTables_wrapper div.dataTables_paginate{margin:0;white-space:nowrap;text-align:right}div.dataTables_wrapper div.dataTables_paginate ul.pagination{margin:2px 0;white-space:nowrap}div.dataTables_wrapper div.dataTables_processing{position:absolute;top:50%;left:50%;width:200px;margin-left:-100px;margin-top:-26px;text-align:center;padding:1em 0}table.dataTable thead>tr>th.sorting_asc,table.dataTable thead>tr>th.sorting_desc,table.dataTable thead>tr>th.sorting,table.dataTable thead>tr>td.sorting_asc,table.dataTable thead>tr>td.sorting_desc,table.dataTable thead>tr>td.sorting{padding-right:30px}table.dataTable thead>tr>th:active,table.dataTable thead>tr>td:active{outline:none}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_desc,table.dataTable thead .sorting_asc_disabled,table.dataTable thead .sorting_desc_disabled{cursor:pointer;position:relative}table.dataTable thead .sorting:after,table.dataTable thead .sorting_asc:after,table.dataTable thead .sorting_desc:after,table.dataTable thead .sorting_asc_disabled:after,table.dataTable thead .sorting_desc_disabled:after{position:absolute;bottom:8px;right:8px;display:block;font-family:'Glyphicons Halflings';opacity:0.5}table.dataTable thead .sorting:after{opacity:0.2;content:"\e150"}table.dataTable thead .sorting_asc:after{content:"\e155"}table.dataTable thead .sorting_desc:after{content:"\e156"}table.dataTable thead .sorting_asc_disabled:after,table.dataTable thead .sorting_desc_disabled:after{color:#eee}div.dataTables_scrollHead table.dataTable{margin-bottom:0 !important}div.dataTables_scrollBody table{border-top:none;margin-top:0 !important;margin-bottom:0 !important}div.dataTables_scrollBody table thead .sorting:after,div.dataTables_scrollBody table thead .sorting_asc:after,div.dataTables_scrollBody table thead .sorting_desc:after{display:none}div.dataTables_scrollBody table tbody tr:first-child th,div.dataTables_scrollBody table tbody tr:first-child td{border-top:none}div.dataTables_scrollFoot table{margin-top:0 !important;border-top:none}@media screen and (max-width: 767px){div.dataTables_wrapper div.dataTables_length,div.dataTables_wrapper div.dataTables_filter,div.dataTables_wrapper div.dataTables_info,div.dataTables_wrapper div.dataTables_paginate{text-align:center}}table.dataTable.table-condensed>thead>tr>th{padding-right:20px}table.dataTable.table-condensed .sorting:after,table.dataTable.table-condensed .sorting_asc:after,table.dataTable.table-condensed .sorting_desc:after{top:6px;right:6px}table.table-bordered.dataTable th,table.table-bordered.dataTable td{border-left-width:0}table.table-bordered.dataTable th:last-child,table.table-bordered.dataTable th:last-child,table.table-bordered.dataTable td:last-child,table.table-bordered.dataTable td:last-child{border-right-width:0}table.table-bordered.dataTable tbody th,table.table-bordered.dataTable tbody td{border-bottom-width:0}div.dataTables_scrollHead table.table-bordered{border-bottom-width:0}div.table-responsive>div.dataTables_wrapper>div.row{margin:0}div.table-responsive>div.dataTables_wrapper>div.row>div[class^="col-"]:first-child{padding-left:0}div.table-responsive>div.dataTables_wrapper>div.row>div[class^="col-"]:last-child{padding-right:0} 2 | -------------------------------------------------------------------------------- /src/main/webapp/css/img/line_conn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/css/img/line_conn.png -------------------------------------------------------------------------------- /src/main/webapp/css/img/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/css/img/loading.gif -------------------------------------------------------------------------------- /src/main/webapp/css/img/metro.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/css/img/metro.gif -------------------------------------------------------------------------------- /src/main/webapp/css/img/metro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/css/img/metro.png -------------------------------------------------------------------------------- /src/main/webapp/css/jquery.dataTables.min.css: -------------------------------------------------------------------------------- 1 | table.dataTable{width:100%;margin:0 auto;clear:both;border-collapse:separate;border-spacing:0}table.dataTable thead th,table.dataTable tfoot th{font-weight:bold}table.dataTable thead th,table.dataTable thead td{padding:10px 18px;border-bottom:1px solid #111}table.dataTable thead th:active,table.dataTable thead td:active{outline:none}table.dataTable tfoot th,table.dataTable tfoot td{padding:10px 18px 6px 18px;border-top:1px solid #111}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_desc{cursor:pointer;*cursor:hand}table.dataTable thead .sorting,table.dataTable thead .sorting_asc,table.dataTable thead .sorting_desc,table.dataTable thead .sorting_asc_disabled,table.dataTable thead .sorting_desc_disabled{background-repeat:no-repeat;background-position:center right}table.dataTable thead .sorting{background-image:url("../images/sort_both.png")}table.dataTable thead .sorting_asc{background-image:url("../images/sort_asc.png")}table.dataTable thead .sorting_desc{background-image:url("../images/sort_desc.png")}table.dataTable thead .sorting_asc_disabled{background-image:url("../images/sort_asc_disabled.png")}table.dataTable thead .sorting_desc_disabled{background-image:url("../images/sort_desc_disabled.png")}table.dataTable tbody tr{background-color:#ffffff}table.dataTable tbody tr.selected{background-color:#B0BED9}table.dataTable tbody th,table.dataTable tbody td{padding:8px 10px}table.dataTable.row-border tbody th,table.dataTable.row-border tbody td,table.dataTable.display tbody th,table.dataTable.display tbody td{border-top:1px solid #ddd}table.dataTable.row-border tbody tr:first-child th,table.dataTable.row-border tbody tr:first-child td,table.dataTable.display tbody tr:first-child th,table.dataTable.display tbody tr:first-child td{border-top:none}table.dataTable.cell-border tbody th,table.dataTable.cell-border tbody td{border-top:1px solid #ddd;border-right:1px solid #ddd}table.dataTable.cell-border tbody tr th:first-child,table.dataTable.cell-border tbody tr td:first-child{border-left:1px solid #ddd}table.dataTable.cell-border tbody tr:first-child th,table.dataTable.cell-border tbody tr:first-child td{border-top:none}table.dataTable.stripe tbody tr.odd,table.dataTable.display tbody tr.odd{background-color:#f9f9f9}table.dataTable.stripe tbody tr.odd.selected,table.dataTable.display tbody tr.odd.selected{background-color:#acbad4}table.dataTable.hover tbody tr:hover,table.dataTable.display tbody tr:hover{background-color:#f6f6f6}table.dataTable.hover tbody tr:hover.selected,table.dataTable.display tbody tr:hover.selected{background-color:#aab7d1}table.dataTable.order-column tbody tr>.sorting_1,table.dataTable.order-column tbody tr>.sorting_2,table.dataTable.order-column tbody tr>.sorting_3,table.dataTable.display tbody tr>.sorting_1,table.dataTable.display tbody tr>.sorting_2,table.dataTable.display tbody tr>.sorting_3{background-color:#fafafa}table.dataTable.order-column tbody tr.selected>.sorting_1,table.dataTable.order-column tbody tr.selected>.sorting_2,table.dataTable.order-column tbody tr.selected>.sorting_3,table.dataTable.display tbody tr.selected>.sorting_1,table.dataTable.display tbody tr.selected>.sorting_2,table.dataTable.display tbody tr.selected>.sorting_3{background-color:#acbad5}table.dataTable.display tbody tr.odd>.sorting_1,table.dataTable.order-column.stripe tbody tr.odd>.sorting_1{background-color:#f1f1f1}table.dataTable.display tbody tr.odd>.sorting_2,table.dataTable.order-column.stripe tbody tr.odd>.sorting_2{background-color:#f3f3f3}table.dataTable.display tbody tr.odd>.sorting_3,table.dataTable.order-column.stripe tbody tr.odd>.sorting_3{background-color:whitesmoke}table.dataTable.display tbody tr.odd.selected>.sorting_1,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_1{background-color:#a6b4cd}table.dataTable.display tbody tr.odd.selected>.sorting_2,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_2{background-color:#a8b5cf}table.dataTable.display tbody tr.odd.selected>.sorting_3,table.dataTable.order-column.stripe tbody tr.odd.selected>.sorting_3{background-color:#a9b7d1}table.dataTable.display tbody tr.even>.sorting_1,table.dataTable.order-column.stripe tbody tr.even>.sorting_1{background-color:#fafafa}table.dataTable.display tbody tr.even>.sorting_2,table.dataTable.order-column.stripe tbody tr.even>.sorting_2{background-color:#fcfcfc}table.dataTable.display tbody tr.even>.sorting_3,table.dataTable.order-column.stripe tbody tr.even>.sorting_3{background-color:#fefefe}table.dataTable.display tbody tr.even.selected>.sorting_1,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_1{background-color:#acbad5}table.dataTable.display tbody tr.even.selected>.sorting_2,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_2{background-color:#aebcd6}table.dataTable.display tbody tr.even.selected>.sorting_3,table.dataTable.order-column.stripe tbody tr.even.selected>.sorting_3{background-color:#afbdd8}table.dataTable.display tbody tr:hover>.sorting_1,table.dataTable.order-column.hover tbody tr:hover>.sorting_1{background-color:#eaeaea}table.dataTable.display tbody tr:hover>.sorting_2,table.dataTable.order-column.hover tbody tr:hover>.sorting_2{background-color:#ececec}table.dataTable.display tbody tr:hover>.sorting_3,table.dataTable.order-column.hover tbody tr:hover>.sorting_3{background-color:#efefef}table.dataTable.display tbody tr:hover.selected>.sorting_1,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_1{background-color:#a2aec7}table.dataTable.display tbody tr:hover.selected>.sorting_2,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_2{background-color:#a3b0c9}table.dataTable.display tbody tr:hover.selected>.sorting_3,table.dataTable.order-column.hover tbody tr:hover.selected>.sorting_3{background-color:#a5b2cb}table.dataTable.no-footer{border-bottom:1px solid #111}table.dataTable.nowrap th,table.dataTable.nowrap td{white-space:nowrap}table.dataTable.compact thead th,table.dataTable.compact thead td{padding:4px 17px 4px 4px}table.dataTable.compact tfoot th,table.dataTable.compact tfoot td{padding:4px}table.dataTable.compact tbody th,table.dataTable.compact tbody td{padding:4px}table.dataTable th.dt-left,table.dataTable td.dt-left{text-align:left}table.dataTable th.dt-center,table.dataTable td.dt-center,table.dataTable td.dataTables_empty{text-align:center}table.dataTable th.dt-right,table.dataTable td.dt-right{text-align:right}table.dataTable th.dt-justify,table.dataTable td.dt-justify{text-align:justify}table.dataTable th.dt-nowrap,table.dataTable td.dt-nowrap{white-space:nowrap}table.dataTable thead th.dt-head-left,table.dataTable thead td.dt-head-left,table.dataTable tfoot th.dt-head-left,table.dataTable tfoot td.dt-head-left{text-align:left}table.dataTable thead th.dt-head-center,table.dataTable thead td.dt-head-center,table.dataTable tfoot th.dt-head-center,table.dataTable tfoot td.dt-head-center{text-align:center}table.dataTable thead th.dt-head-right,table.dataTable thead td.dt-head-right,table.dataTable tfoot th.dt-head-right,table.dataTable tfoot td.dt-head-right{text-align:right}table.dataTable thead th.dt-head-justify,table.dataTable thead td.dt-head-justify,table.dataTable tfoot th.dt-head-justify,table.dataTable tfoot td.dt-head-justify{text-align:justify}table.dataTable thead th.dt-head-nowrap,table.dataTable thead td.dt-head-nowrap,table.dataTable tfoot th.dt-head-nowrap,table.dataTable tfoot td.dt-head-nowrap{white-space:nowrap}table.dataTable tbody th.dt-body-left,table.dataTable tbody td.dt-body-left{text-align:left}table.dataTable tbody th.dt-body-center,table.dataTable tbody td.dt-body-center{text-align:center}table.dataTable tbody th.dt-body-right,table.dataTable tbody td.dt-body-right{text-align:right}table.dataTable tbody th.dt-body-justify,table.dataTable tbody td.dt-body-justify{text-align:justify}table.dataTable tbody th.dt-body-nowrap,table.dataTable tbody td.dt-body-nowrap{white-space:nowrap}table.dataTable,table.dataTable th,table.dataTable td{-webkit-box-sizing:content-box;box-sizing:content-box}.dataTables_wrapper{position:relative;clear:both;*zoom:1;zoom:1}.dataTables_wrapper .dataTables_length{float:left}.dataTables_wrapper .dataTables_filter{float:right;text-align:right}.dataTables_wrapper .dataTables_filter input{margin-left:0.5em}.dataTables_wrapper .dataTables_info{clear:both;float:left;padding-top:0.755em}.dataTables_wrapper .dataTables_paginate{float:right;text-align:right;padding-top:0.25em}.dataTables_wrapper .dataTables_paginate .paginate_button{box-sizing:border-box;display:inline-block;min-width:1.5em;padding:0.5em 1em;margin-left:2px;text-align:center;text-decoration:none !important;cursor:pointer;*cursor:hand;color:#333 !important;border:1px solid transparent;border-radius:2px}.dataTables_wrapper .dataTables_paginate .paginate_button.current,.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover{color:#333 !important;border:1px solid #979797;background-color:white;background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #fff), color-stop(100%, #dcdcdc));background:-webkit-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:-moz-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:-ms-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:-o-linear-gradient(top, #fff 0%, #dcdcdc 100%);background:linear-gradient(to bottom, #fff 0%, #dcdcdc 100%)}.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active{cursor:default;color:#666 !important;border:1px solid transparent;background:transparent;box-shadow:none}.dataTables_wrapper .dataTables_paginate .paginate_button:hover{color:white !important;border:1px solid #111;background-color:#585858;background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #585858), color-stop(100%, #111));background:-webkit-linear-gradient(top, #585858 0%, #111 100%);background:-moz-linear-gradient(top, #585858 0%, #111 100%);background:-ms-linear-gradient(top, #585858 0%, #111 100%);background:-o-linear-gradient(top, #585858 0%, #111 100%);background:linear-gradient(to bottom, #585858 0%, #111 100%)}.dataTables_wrapper .dataTables_paginate .paginate_button:active{outline:none;background-color:#2b2b2b;background:-webkit-gradient(linear, left top, left bottom, color-stop(0%, #2b2b2b), color-stop(100%, #0c0c0c));background:-webkit-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:-moz-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:-ms-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:-o-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%);background:linear-gradient(to bottom, #2b2b2b 0%, #0c0c0c 100%);box-shadow:inset 0 0 3px #111}.dataTables_wrapper .dataTables_paginate .ellipsis{padding:0 1em}.dataTables_wrapper .dataTables_processing{position:absolute;top:50%;left:50%;width:100%;height:40px;margin-left:-50%;margin-top:-25px;padding-top:20px;text-align:center;font-size:1.2em;background-color:white;background:-webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255,255,255,0)), color-stop(25%, rgba(255,255,255,0.9)), color-stop(75%, rgba(255,255,255,0.9)), color-stop(100%, rgba(255,255,255,0)));background:-webkit-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:-moz-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:-ms-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:-o-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%);background:linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%)}.dataTables_wrapper .dataTables_length,.dataTables_wrapper .dataTables_filter,.dataTables_wrapper .dataTables_info,.dataTables_wrapper .dataTables_processing,.dataTables_wrapper .dataTables_paginate{color:#333}.dataTables_wrapper .dataTables_scroll{clear:both}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody{*margin-top:-1px;-webkit-overflow-scrolling:touch}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody th,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody td{vertical-align:middle}.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody th>div.dataTables_sizing,.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody td>div.dataTables_sizing{height:0;overflow:hidden;margin:0 !important;padding:0 !important}.dataTables_wrapper.no-footer .dataTables_scrollBody{border-bottom:1px solid #111}.dataTables_wrapper.no-footer div.dataTables_scrollHead table,.dataTables_wrapper.no-footer div.dataTables_scrollBody table{border-bottom:none}.dataTables_wrapper:after{visibility:hidden;display:block;content:"";clear:both;height:0}@media screen and (max-width: 767px){.dataTables_wrapper .dataTables_info,.dataTables_wrapper .dataTables_paginate{float:none;text-align:center}.dataTables_wrapper .dataTables_paginate{margin-top:0.5em}}@media screen and (max-width: 640px){.dataTables_wrapper .dataTables_length,.dataTables_wrapper .dataTables_filter{float:none;text-align:center}.dataTables_wrapper .dataTables_filter{margin-top:0.5em}} 2 | -------------------------------------------------------------------------------- /src/main/webapp/css/matrix-login.css: -------------------------------------------------------------------------------- 1 | html, body { width: 100%; height: 100%;} 2 | /*Bootstrap-overlay*/ 3 | 4 | body { 5 | overflow-x: hidden; 6 | margin-top: -10px; font-family: 'Open Sans', sans-serif; font-size:12px; color:#666; 7 | } 8 | a{color:#666;} 9 | a:hover, a:focus { 10 | text-decoration: none; color:#28b779; 11 | } 12 | .dropdown-menu .divider{ margin:4px 0px;} 13 | .dropdown-menu{ min-width:180px;} 14 | .dropdown-menu > li > a{ padding:3px 10px; color:#666; font-size:12px;} 15 | .dropdown-menu > li > a i{ padding-right:3px;} 16 | .userphoto img{ width:19px; height:19px;} 17 | select, textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input, .label, .dropdown-menu, .btn, .well, .progress, .table-bordered, .btn-group > .btn:first-child, .btn-group > .btn:last-child, .btn-group > .btn:last-child, .btn-group > .dropdown-toggle, .alert{ border-radius:0px;} 18 | .btn, textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input{ box-shadow:none;} 19 | .progress, .progress-success .bar, .progress .bar-success, .progress-warning .bar, .progress .bar-warning, .progress-danger .bar, .progress .bar-danger, .progress-info .bar, .progress .bar-info, .btn, .btn-primary{background-image:none;} 20 | .accordion-heading h5{ width:70%; } 21 | .form-horizontal .form-actions{ padding-left:20px; } 22 | #footer{ padding:10px; text-align:center;} 23 | hr{ border-top-color:#dadada;} 24 | .carousel{ margin-bottom:0px;} 25 | .fl { float:left} 26 | .fr {float:right} 27 | .label-important, .badge-important{ background:#f74d4d;} 28 | 29 | /*Metro Background color class*/ 30 | .bg_lb{ background:#27a9e3;} 31 | .bg_db{ background:#2295c9;} 32 | .bg_lg{ background:#28b779;} 33 | .bg_dg{ background:#28b779;} 34 | .bg_ly{ background:#ffb848;} 35 | .bg_dy{ background:#da9628;} 36 | .bg_ls{ background:#2255a4;} 37 | .bg_lo{ background:#da542e;} 38 | .bg_lr{ background:#f74d4d;} 39 | .bg_lv{ background:#603bbc;} 40 | .bg_lh{ background:#b6b3b3;} 41 | 42 | body { background-color:#2E363F; padding: 0; margin-top:10%;} 43 | #logo, #loginbox { width: 32%; margin-left: auto; margin-right: auto; position: relative;} 44 | #logo img { margin: 0 auto; display: block;} 45 | #loginbox { overflow: hidden !important; text-align: left; position: relative; } 46 | #loginbox form{ width:100%; background:#2E363F; position:relative; top:0; left:0; } 47 | #loginbox .form-actions { padding: 14px 20px 15px;} 48 | #loginbox .form-actions .pull-left { margin-top:0px;} 49 | #loginbox form#loginform { z-index: 200; display:block;} 50 | #loginbox form#recoverform { z-index: 100; display:none;} 51 | #loginbox form#recoverform .form-actions { margin-top: 10px;} 52 | #loginbox .main_input_box { margin:0 auto; text-align:center; font-size:13px;} 53 | #loginbox .main_input_box .add-on{ padding:9px 9px; *line-height:31px; color:#fff; width:30px; display:inline-block;} 54 | #loginbox .main_input_box input{ height:30px; border:0px; display:inline-block; width:75%; line-height:28px; margin-bottom:3px;} 55 | #loginbox .controls{ padding:0 20px;} 56 | #loginbox .control-group{ padding:20px 0; margin-bottom:0px;} 57 | .form-vertical, .form-actions { margin-bottom: 0; background:none; border-top:1px solid #3f4954; } 58 | #loginbox .normal_text{ padding:15px 10px; text-align:center; font-size:14px; line-height:20px; background:#2E363F; color:#fff; } 59 | @media (max-width:800px){ 60 | #logo { width: 60%; } 61 | #loginbox{ width:80%} 62 | } 63 | @media (max-width: 480px){ 64 | #logo { width: 40%; } 65 | #loginbox{ width:90%} 66 | #loginbox .control-group{ padding:8px 0; margin-bottom:0px;} 67 | } -------------------------------------------------------------------------------- /src/main/webapp/css/matrix-media.css: -------------------------------------------------------------------------------- 1 | body { 2 | background:#2E363F; 3 | } 4 | 5 | #header { 6 | background-color: #1f262d; 7 | margin-top:10px; 8 | } 9 | #search input[type=text], #search button { 10 | background-color: #28b779; 11 | } 12 | #search input[type=text]:focus { 13 | color: #777777; 14 | } 15 | #sidebar > ul{border-bottom: 1px solid #37414b} 16 | #sidebar > ul > li { 17 | border-top: 1px solid #37414b; border-bottom: 1px solid #1f262d; 18 | } 19 | #sidebar > ul > li.active { 20 | background-color: #27a9e3; border-bottom: 1px solid #27a9e3; border-top: 1px solid #27a9e3; 21 | } 22 | #sidebar > ul > li.active a{ color:#fff; text-decoration:none;} 23 | 24 | #sidebar > ul > li > a > .label { 25 | background-color:#F66; 26 | } 27 | #sidebar > ul > li > a:hover { 28 | background-color: #27a9e3; color:#fff; 29 | } 30 | #sidebar > ul li ul { 31 | background-color: #1e242b; 32 | } 33 | #sidebar > ul li ul li a{ color:#939da8} 34 | #sidebar > ul li ul li a:hover, #sidebar > ul li ul li.active a { 35 | color: #fff; 36 | background-color: #28b779; 37 | } 38 | 39 | 40 | #search input[type=text] { 41 | background-color: #47515b; color: #fff; 42 | } 43 | #search input[type=text]:focus { 44 | color: #2e363f; color: #fff; box-shadow:none; 45 | } 46 | .dropdown-menu li a:hover, .dropdown-menu .active a, .dropdown-menu .active a:hover { 47 | color: #eeeeee; 48 | background:#666; 49 | 50 | } 51 | .top_message{ float:right; padding:20px 12px; position:relative; top:-13px; border-left:1px solid #3D3A37; font-size:14px; line-height:20px; *line-height:20px; color:#333; text-align:center; vertical-align:middle; cursor:pointer; } 52 | .top_message:hover{ background:#000} 53 | .rightzero{ right:0px; display:none;} 54 | @media (max-width: 480px) { 55 | #sidebar > a { 56 | background:#27a9e3; 57 | 58 | } 59 | .quick-actions_homepage .quick-actions li{ min-width:100%;} 60 | } 61 | @media (min-width: 768px) and (max-width: 970px) {.quick-actions_homepage .quick-actions li{ min-width:20.5%;}} 62 | @media (min-width: 481px) and (max-width: 767px) { 63 | #sidebar > ul ul:before { 64 | } 65 | #sidebar > ul ul:after { 66 | border-right: 6px solid #222222; 67 | } 68 | .quick-actions_homepage .quick-actions li{ min-width:47%;} 69 | } 70 | div.tagsinput { border:1px solid #CCC; background: #FFF; padding:5px; width:300px; height:100px; overflow-y: auto;} 71 | div.tagsinput span.tag { border: 1px solid #a5d24a; -moz-border-radius:2px; -webkit-border-radius:2px; display: block; float: left; padding: 5px; text-decoration:none; background: #cde69c; color: #638421; margin-right: 5px; margin-bottom:5px;font-family: helvetica; font-size:13px;} 72 | div.tagsinput span.tag a { font-weight: bold; color: #82ad2b; text-decoration:none; font-size: 11px; } 73 | div.tagsinput input { width:80px; margin:0px; font-family: helvetica; font-size: 13px; border:1px solid transparent; padding:5px; background: transparent; color: #000; outline:0px; margin-right:5px; margin-bottom:5px; } 74 | div.tagsinput div { display:block; float: left; } 75 | .tags_clear { clear: both; width: 100%; height: 0px; } 76 | .not_valid {background: #FBD8DB !important; color: #90111A !important;} 77 | -------------------------------------------------------------------------------- /src/main/webapp/css/metroStyle.css: -------------------------------------------------------------------------------- 1 | /*------------------------------------- 2 | zTree Style 3 | 4 | version: 3.4 5 | author: Hunter.z 6 | email: hunter.z@263.net 7 | website: http://code.google.com/p/jquerytree/ 8 | 9 | -------------------------------------*/ 10 | 11 | .ztree * {padding:0; margin:0; font-size:12px; font-family: Verdana, Arial, Helvetica, AppleGothic, sans-serif} 12 | .ztree {margin:0; padding:5px; color:#333} 13 | .ztree li{padding:0; margin:0; list-style:none; line-height:17px; text-align:left; white-space:nowrap; outline:0} 14 | .ztree li ul{ margin:0; padding:0 0 0 18px;height: auto} 15 | .ztree li ul.line{ background:url(./img/line_conn.png) 0 0 repeat-y;} 16 | 17 | .ztree li a {padding-right:3px; margin:0; cursor:pointer; height:21px; color:#333; background-color: transparent; text-decoration:none; vertical-align:top; display: inline-block} 18 | .ztree li a:hover {text-decoration:underline} 19 | .ztree li a.curSelectedNode {padding-top:0px; background-color:#e5e5e5; color:black; height:21px; opacity:0.8;} 20 | .ztree li a.curSelectedNode_Edit {padding-top:0px; background-color:#e5e5e5; color:black; height:21px; border:1px #666 solid; opacity:0.8;} 21 | .ztree li a.tmpTargetNode_inner {padding-top:0px; background-color:#aaa; color:white; height:21px; border:1px #666 solid; 22 | opacity:0.8; filter:alpha(opacity=80)} 23 | .ztree li a.tmpTargetNode_prev {} 24 | .ztree li a.tmpTargetNode_next {} 25 | .ztree li a input.rename {height:14px; width:80px; padding:0; margin:0; 26 | font-size:12px; border:1px #585956 solid; *border:0px} 27 | .ztree li span {line-height:21px; margin-right:2px} 28 | .ztree li span.button {line-height:0; margin:0; padding: 0; width:21px; height:21px; display: inline-block; vertical-align:middle; 29 | border:0 none; cursor: pointer;outline:none; 30 | background-color:transparent; background-repeat:no-repeat; background-attachment: scroll; 31 | background-image:url("./img/metro.png"); *background-image:url("./img/metro.gif")} 32 | 33 | .ztree li span.button.chk {width:13px; height:13px; margin:0 2px; cursor: auto} 34 | .ztree li span.button.chk.checkbox_false_full {background-position: -5px -5px;} 35 | .ztree li span.button.chk.checkbox_false_full_focus {background-position: -5px -26px;} 36 | .ztree li span.button.chk.checkbox_false_part {background-position: -5px -48px;} 37 | .ztree li span.button.chk.checkbox_false_part_focus {background-position: -5px -68px;} 38 | .ztree li span.button.chk.checkbox_false_disable {background-position: -5px -89px;} 39 | .ztree li span.button.chk.checkbox_true_full {background-position: -26px -5px;} 40 | .ztree li span.button.chk.checkbox_true_full_focus {background-position: -26px -26px;} 41 | .ztree li span.button.chk.checkbox_true_part {background-position: -26px -48px;} 42 | .ztree li span.button.chk.checkbox_true_part_focus {background-position: -26px -68px;} 43 | .ztree li span.button.chk.checkbox_true_disable {background-position: -26px -89px;} 44 | .ztree li span.button.chk.radio_false_full {background-position: -47px -5px;} 45 | .ztree li span.button.chk.radio_false_full_focus {background-position: -47px -26px;} 46 | .ztree li span.button.chk.radio_false_part {background-position: -47px -47px;} 47 | .ztree li span.button.chk.radio_false_part_focus {background-position: -47px -68px;} 48 | .ztree li span.button.chk.radio_false_disable {background-position: -47px -89px;} 49 | .ztree li span.button.chk.radio_true_full {background-position: -68px -5px;} 50 | .ztree li span.button.chk.radio_true_full_focus {background-position: -68px -26px;} 51 | .ztree li span.button.chk.radio_true_part {background-position: -68px -47px;} 52 | .ztree li span.button.chk.radio_true_part_focus {background-position: -68px -68px;} 53 | .ztree li span.button.chk.radio_true_disable {background-position: -68px -89px;} 54 | 55 | .ztree li span.button.switch {width:21px; height:21px} 56 | .ztree li span.button.root_open{background-position:-105px -63px} 57 | .ztree li span.button.root_close{background-position:-126px -63px} 58 | .ztree li span.button.roots_open{background-position: -105px 0;} 59 | .ztree li span.button.roots_close{background-position: -126px 0;} 60 | .ztree li span.button.center_open{background-position: -105px -21px;} 61 | .ztree li span.button.center_close{background-position: -126px -21px;} 62 | .ztree li span.button.bottom_open{background-position: -105px -42px;} 63 | .ztree li span.button.bottom_close{background-position: -126px -42px;} 64 | .ztree li span.button.noline_open{background-position: -105px -84px;} 65 | .ztree li span.button.noline_close{background-position: -126px -84px;} 66 | .ztree li span.button.root_docu{ background:none;} 67 | .ztree li span.button.roots_docu{background-position: -84px 0;} 68 | .ztree li span.button.center_docu{background-position: -84px -21px;} 69 | .ztree li span.button.bottom_docu{background-position: -84px -42px;} 70 | .ztree li span.button.noline_docu{ background:none;} 71 | 72 | .ztree li span.button.ico_open{margin-right:2px; background-position: -147px -21px; vertical-align:top; *vertical-align:middle} 73 | .ztree li span.button.ico_close{margin-right:2px; margin-right:2px; background-position: -147px 0; vertical-align:top; *vertical-align:middle} 74 | .ztree li span.button.ico_docu{margin-right:2px; background-position: -147px -42px; vertical-align:top; *vertical-align:middle} 75 | .ztree li span.button.edit {margin-left:2px; margin-right: -1px; background-position: -189px -21px; vertical-align:top; *vertical-align:middle} 76 | .ztree li span.button.edit:hover { 77 | background-position: -168px -21px; 78 | } 79 | .ztree li span.button.remove {margin-left:2px; margin-right: -1px; background-position: -189px -42px; vertical-align:top; *vertical-align:middle} 80 | .ztree li span.button.remove:hover { 81 | background-position: -168px -42px; 82 | } 83 | .ztree li span.button.add {margin-left:2px; margin-right: -1px; background-position: -189px 0; vertical-align:top; *vertical-align:middle} 84 | .ztree li span.button.add:hover { 85 | background-position: -168px 0; 86 | } 87 | .ztree li span.button.ico_loading{margin-right:2px; background:url(./img/loading.gif) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle} 88 | 89 | ul.tmpTargetzTree {background-color:#FFE6B0; opacity:0.8; filter:alpha(opacity=80)} 90 | 91 | span.tmpzTreeMove_arrow {width:16px; height:21px; display: inline-block; padding:0; margin:2px 0 0 1px; border:0 none; position:absolute; 92 | background-color:transparent; background-repeat:no-repeat; background-attachment: scroll; 93 | background-position:-168px -84px; background-image:url("./img/metro.png"); *background-image:url("./img/metro.gif")} 94 | 95 | ul.ztree.zTreeDragUL {margin:0; padding:0; position:absolute; width:auto; height:auto;overflow:hidden; background-color:#cfcfcf; border:1px #00B83F dotted; opacity:0.8; filter:alpha(opacity=80)} 96 | .ztreeMask {z-index:10000; background-color:#cfcfcf; opacity:0.0; filter:alpha(opacity=0); position:absolute} 97 | -------------------------------------------------------------------------------- /src/main/webapp/font-awesome/css/Descr.WD3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/font-awesome/css/Descr.WD3 -------------------------------------------------------------------------------- /src/main/webapp/font-awesome/font/Descr.WD3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/font-awesome/font/Descr.WD3 -------------------------------------------------------------------------------- /src/main/webapp/font-awesome/font/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/font-awesome/font/fontawesome-webfont.eot -------------------------------------------------------------------------------- /src/main/webapp/font-awesome/font/fontawesome-webfont.eot@: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/font-awesome/font/fontawesome-webfont.eot@ -------------------------------------------------------------------------------- /src/main/webapp/font-awesome/font/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/font-awesome/font/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /src/main/webapp/font-awesome/font/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/font-awesome/font/fontawesome-webfont.woff -------------------------------------------------------------------------------- /src/main/webapp/images/backgrounds/Descr.WD3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/images/backgrounds/Descr.WD3 -------------------------------------------------------------------------------- /src/main/webapp/images/backgrounds/blank2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/images/backgrounds/blank2 -------------------------------------------------------------------------------- /src/main/webapp/images/backgrounds/calActiveBg.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Page not found - Theme Designer 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 55 | 56 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 |
86 |
87 | 88 | 97 |
98 |
99 | 100 | 101 |
102 |
103 | 104 |

404 Not Found

105 |

Apologies, but the page you requested could not be found. Perhaps searching will help.

106 |
107 |

108 |

109 |
110 | 111 | 112 |
113 |
114 | 115 | 116 | 117 | 134 | 135 | 136 | 137 | 138 | 143 | 144 | 149 | 150 | 151 | 152 | -------------------------------------------------------------------------------- /src/main/webapp/images/backgrounds/skype_3Asuniljoshi19@call: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Page not found - Theme Designer 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 55 | 56 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 |
86 |
87 | 88 | 97 |
98 |
99 | 100 | 101 |
102 |
103 | 104 |

404 Not Found

105 |

Apologies, but the page you requested could not be found. Perhaps searching will help.

106 |
107 |

108 |

109 |
110 | 111 | 112 |
113 |
114 | 115 | 116 | 117 | 134 | 135 | 136 | 137 | 138 | 143 | 144 | 149 | 150 | 151 | 152 | -------------------------------------------------------------------------------- /src/main/webapp/images/gallery/imgbox3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Page not found - Theme Designer 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 55 | 56 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 |
86 |
87 | 88 | 97 |
98 |
99 | 100 | 101 |
102 |
103 | 104 |

404 Not Found

105 |

Apologies, but the page you requested could not be found. Perhaps searching will help.

106 |
107 |

108 |

109 |
110 | 111 | 112 |
113 |
114 | 115 | 116 | 117 | 134 | 135 | 136 | 137 | 138 | 143 | 144 | 149 | 150 | 151 | 152 | -------------------------------------------------------------------------------- /src/main/webapp/images/sort_asc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/images/sort_asc.png -------------------------------------------------------------------------------- /src/main/webapp/images/sort_both.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/images/sort_both.png -------------------------------------------------------------------------------- /src/main/webapp/images/sort_desc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/images/sort_desc.png -------------------------------------------------------------------------------- /src/main/webapp/img/Descr.WD3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/Descr.WD3 -------------------------------------------------------------------------------- /src/main/webapp/img/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/Thumbs.db -------------------------------------------------------------------------------- /src/main/webapp/img/alpha.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Page not found - Theme Designer 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 55 | 56 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 |
86 |
87 | 88 | 97 |
98 |
99 | 100 | 101 |
102 |
103 | 104 |

404 Not Found

105 |

Apologies, but the page you requested could not be found. Perhaps searching will help.

106 |
107 |

108 |

109 |
110 | 111 | 112 |
113 |
114 | 115 | 116 | 117 | 134 | 135 | 136 | 137 | 138 | 143 | 144 | 149 | 150 | 151 | 152 | -------------------------------------------------------------------------------- /src/main/webapp/img/breadcrumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/breadcrumb.png -------------------------------------------------------------------------------- /src/main/webapp/img/demo/Descr.WD3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/demo/Descr.WD3 -------------------------------------------------------------------------------- /src/main/webapp/img/demo/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/demo/Thumbs.db -------------------------------------------------------------------------------- /src/main/webapp/img/demo/av1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/demo/av1.jpg -------------------------------------------------------------------------------- /src/main/webapp/img/demo/av2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/demo/av2.jpg -------------------------------------------------------------------------------- /src/main/webapp/img/demo/av3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/demo/av3.jpg -------------------------------------------------------------------------------- /src/main/webapp/img/demo/av4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/demo/av4.jpg -------------------------------------------------------------------------------- /src/main/webapp/img/demo/av5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/demo/av5.jpg -------------------------------------------------------------------------------- /src/main/webapp/img/demo/demo-image1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/demo/demo-image1.jpg -------------------------------------------------------------------------------- /src/main/webapp/img/demo/demo-image2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/demo/demo-image2.jpg -------------------------------------------------------------------------------- /src/main/webapp/img/demo/demo-image3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/demo/demo-image3.jpg -------------------------------------------------------------------------------- /src/main/webapp/img/demo/envelope.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/demo/envelope.png -------------------------------------------------------------------------------- /src/main/webapp/img/gallery/Descr.WD3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/gallery/Descr.WD3 -------------------------------------------------------------------------------- /src/main/webapp/img/gallery/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/gallery/Thumbs.db -------------------------------------------------------------------------------- /src/main/webapp/img/gallery/imgbox1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/gallery/imgbox1.jpg -------------------------------------------------------------------------------- /src/main/webapp/img/gallery/imgbox2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/gallery/imgbox2.jpg -------------------------------------------------------------------------------- /src/main/webapp/img/gallery/imgbox3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/gallery/imgbox3.jpg -------------------------------------------------------------------------------- /src/main/webapp/img/gallery/imgbox4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/gallery/imgbox4.jpg -------------------------------------------------------------------------------- /src/main/webapp/img/gallery/imgbox5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/gallery/imgbox5.jpg -------------------------------------------------------------------------------- /src/main/webapp/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /src/main/webapp/img/glyphicons-halflings.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Page not found - Theme Designer 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 55 | 56 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 |
86 |
87 | 88 | 97 |
98 |
99 | 100 | 101 |
102 |
103 | 104 |

404 Not Found

105 |

Apologies, but the page you requested could not be found. Perhaps searching will help.

106 |
107 |

108 |

109 |
110 | 111 | 112 |
113 |
114 | 115 | 116 | 117 | 134 | 135 | 136 | 137 | 138 | 143 | 144 | 149 | 150 | 151 | 152 | -------------------------------------------------------------------------------- /src/main/webapp/img/gritter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/gritter.png -------------------------------------------------------------------------------- /src/main/webapp/img/hue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/hue.png -------------------------------------------------------------------------------- /src/main/webapp/img/larrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/larrow.png -------------------------------------------------------------------------------- /src/main/webapp/img/line.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/line.png -------------------------------------------------------------------------------- /src/main/webapp/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/logo.png -------------------------------------------------------------------------------- /src/main/webapp/img/menu-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/menu-active.png -------------------------------------------------------------------------------- /src/main/webapp/img/rarrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/rarrow.png -------------------------------------------------------------------------------- /src/main/webapp/img/saturation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/saturation.png -------------------------------------------------------------------------------- /src/main/webapp/img/select2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/select2.png -------------------------------------------------------------------------------- /src/main/webapp/img/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/spinner.gif -------------------------------------------------------------------------------- /src/main/webapp/img/sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/img/sprite.png -------------------------------------------------------------------------------- /src/main/webapp/js/matrix.interface.js: -------------------------------------------------------------------------------- 1 | 2 | $(document).ready(function(){ 3 | 4 | // === jQuery Peity === // 5 | $.fn.peity.defaults.line = { 6 | strokeWidth: 1, 7 | delimeter: ",", 8 | height: 24, 9 | max: null, 10 | min: 0, 11 | width: 50 12 | }; 13 | $.fn.peity.defaults.bar = { 14 | delimeter: ",", 15 | height: 24, 16 | max: null, 17 | min: 0, 18 | width: 50 19 | }; 20 | $(".peity_line_good span").peity("line", { 21 | colour: "#B1FFA9", 22 | strokeColour: "#459D1C" 23 | }); 24 | $(".peity_line_bad span").peity("line", { 25 | colour: "#FFC4C7", 26 | strokeColour: "#BA1E20" 27 | }); 28 | $(".peity_line_neutral span").peity("line", { 29 | colour: "#CCCCCC", 30 | strokeColour: "#757575" 31 | }); 32 | $(".peity_bar_good span").peity("bar", { 33 | colour: "#459D1C" 34 | }); 35 | $(".peity_bar_bad span").peity("bar", { 36 | colour: "#BA1E20" 37 | }); 38 | $(".peity_bar_neutral span").peity("bar", { 39 | colour: "#757575" 40 | }); 41 | 42 | // === jQeury Gritter, a growl-like notifications === // 43 | $.gritter.add({ 44 | title: 'Important Unread messages', 45 | text: 'You have 12 unread messages.', 46 | image: 'img/demo/envelope.png', 47 | sticky: false 48 | }); 49 | $('#gritter-notify .normal').click(function(){ 50 | $.gritter.add({ 51 | title: 'Normal notification', 52 | text: 'This is a normal notification', 53 | sticky: false 54 | }); 55 | }); 56 | 57 | $('#gritter-notify .sticky').click(function(){ 58 | $.gritter.add({ 59 | title: 'Sticky notification', 60 | text: 'This is a sticky notification', 61 | sticky: true 62 | }); 63 | }); 64 | 65 | $('#gritter-notify .image').click(function(){ 66 | var imgsrc = $(this).attr('data-image'); 67 | $.gritter.add({ 68 | title: 'Important Unread messages', 69 | text: 'You have 12 unread messages.', 70 | image: imgsrc, 71 | sticky: false 72 | }); 73 | }); 74 | }); 75 | -------------------------------------------------------------------------------- /src/main/webapp/js/matrix.js: -------------------------------------------------------------------------------- 1 | 2 | $(document).ready(function(){ 3 | 4 | 5 | 6 | // === Sidebar navigation === // 7 | 8 | $('.submenu > a').click(function(e) 9 | { 10 | e.preventDefault(); 11 | var submenu = $(this).siblings('ul'); 12 | var li = $(this).parents('li'); 13 | var submenus = $('#sidebar li.submenu ul'); 14 | var submenus_parents = $('#sidebar li.submenu'); 15 | if(li.hasClass('open')) 16 | { 17 | if(($(window).width() > 768) || ($(window).width() < 479)) { 18 | submenu.slideUp(); 19 | } else { 20 | submenu.fadeOut(250); 21 | } 22 | li.removeClass('open'); 23 | } else 24 | { 25 | if(($(window).width() > 768) || ($(window).width() < 479)) { 26 | submenus.slideUp(); 27 | submenu.slideDown(); 28 | } else { 29 | submenus.fadeOut(250); 30 | submenu.fadeIn(250); 31 | } 32 | submenus_parents.removeClass('open'); 33 | li.addClass('open'); 34 | } 35 | }); 36 | 37 | var ul = $('#sidebar > ul'); 38 | 39 | $('#sidebar > a').click(function(e) 40 | { 41 | e.preventDefault(); 42 | var sidebar = $('#sidebar'); 43 | if(sidebar.hasClass('open')) 44 | { 45 | sidebar.removeClass('open'); 46 | ul.slideUp(250); 47 | } else 48 | { 49 | sidebar.addClass('open'); 50 | ul.slideDown(250); 51 | } 52 | }); 53 | 54 | // === Resize window related === // 55 | $(window).resize(function() 56 | { 57 | if($(window).width() > 479) 58 | { 59 | ul.css({'display':'block'}); 60 | $('#content-header .btn-group').css({width:'auto'}); 61 | } 62 | if($(window).width() < 479) 63 | { 64 | ul.css({'display':'none'}); 65 | fix_position(); 66 | } 67 | if($(window).width() > 768) 68 | { 69 | $('#user-nav > ul').css({width:'auto',margin:'0'}); 70 | $('#content-header .btn-group').css({width:'auto'}); 71 | } 72 | }); 73 | 74 | if($(window).width() < 468) 75 | { 76 | ul.css({'display':'none'}); 77 | fix_position(); 78 | } 79 | 80 | if($(window).width() > 479) 81 | { 82 | $('#content-header .btn-group').css({width:'auto'}); 83 | ul.css({'display':'block'}); 84 | } 85 | 86 | // === Tooltips === // 87 | $('.tip').tooltip(); 88 | $('.tip-left').tooltip({ placement: 'left' }); 89 | $('.tip-right').tooltip({ placement: 'right' }); 90 | $('.tip-top').tooltip({ placement: 'top' }); 91 | $('.tip-bottom').tooltip({ placement: 'bottom' }); 92 | 93 | // === Search input typeahead === // 94 | $('#search input[type=text]').typeahead({ 95 | source: ['Dashboard','Form elements','Common Elements','Validation','Wizard','Buttons','Icons','Interface elements','Support','Calendar','Gallery','Reports','Charts','Graphs','Widgets'], 96 | items: 4 97 | }); 98 | 99 | // === Fixes the position of buttons group in content header and top user navigation === // 100 | function fix_position() 101 | { 102 | var uwidth = $('#user-nav > ul').width(); 103 | $('#user-nav > ul').css({width:uwidth,'margin-left':'-' + uwidth / 2 + 'px'}); 104 | 105 | var cwidth = $('#content-header .btn-group').width(); 106 | $('#content-header .btn-group').css({width:cwidth,'margin-left':'-' + uwidth / 2 + 'px'}); 107 | } 108 | 109 | // === Style switcher === // 110 | $('#style-switcher i').click(function() 111 | { 112 | if($(this).hasClass('open')) 113 | { 114 | $(this).parent().animate({marginRight:'-=190'}); 115 | $(this).removeClass('open'); 116 | } else 117 | { 118 | $(this).parent().animate({marginRight:'+=190'}); 119 | $(this).addClass('open'); 120 | } 121 | $(this).toggleClass('icon-arrow-left'); 122 | $(this).toggleClass('icon-arrow-right'); 123 | }); 124 | 125 | $('#style-switcher a').click(function() 126 | { 127 | var style = $(this).attr('href').replace('#',''); 128 | $('.skin-color').attr('href','css/maruti.'+style+'.css'); 129 | $(this).siblings('a').css({'border-color':'transparent'}); 130 | $(this).css({'border-color':'#aaaaaa'}); 131 | }); 132 | 133 | $('.lightbox_trigger').click(function(e) { 134 | 135 | e.preventDefault(); 136 | 137 | var image_href = $(this).attr("href"); 138 | 139 | if ($('#lightbox').length > 0) { 140 | 141 | $('#imgbox').html('

'); 142 | 143 | $('#lightbox').slideDown(500); 144 | } 145 | 146 | else { 147 | var lightbox = 148 | ''; 153 | 154 | $('body').append(lightbox); 155 | $('#lightbox').slideDown(500); 156 | } 157 | 158 | }); 159 | 160 | 161 | $('#lightbox').live('click', function() { 162 | $('#lightbox').hide(200); 163 | }); 164 | 165 | }); 166 | 167 | -------------------------------------------------------------------------------- /src/main/webapp/js/matrix.login.js: -------------------------------------------------------------------------------- 1 | 2 | $(document).ready(function(){ 3 | 4 | var login = $('#loginform'); 5 | var recover = $('#recoverform'); 6 | var speed = 400; 7 | 8 | $('#to-recover').click(function(){ 9 | 10 | $("#loginform").slideUp(); 11 | $("#recoverform").fadeIn(); 12 | }); 13 | $('#to-login').click(function(){ 14 | 15 | $("#recoverform").hide(); 16 | $("#loginform").fadeIn(); 17 | }); 18 | 19 | 20 | $('#to-login').click(function(){ 21 | 22 | }); 23 | 24 | if($.browser.msie == true && $.browser.version.slice(0,3) < 10) { 25 | $('input[placeholder]').each(function(){ 26 | 27 | var input = $(this); 28 | 29 | $(input).val(input.attr('placeholder')); 30 | 31 | $(input).focus(function(){ 32 | if (input.val() == input.attr('placeholder')) { 33 | input.val(''); 34 | } 35 | }); 36 | 37 | $(input).blur(function(){ 38 | if (input.val() == '' || input.val() == input.attr('placeholder')) { 39 | input.val(input.attr('placeholder')); 40 | } 41 | }); 42 | }); 43 | 44 | 45 | 46 | } 47 | }); -------------------------------------------------------------------------------- /src/main/webapp/js/skin/default/icon-ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/js/skin/default/icon-ext.png -------------------------------------------------------------------------------- /src/main/webapp/js/skin/default/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/js/skin/default/icon.png -------------------------------------------------------------------------------- /src/main/webapp/js/skin/default/loading-0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/js/skin/default/loading-0.gif -------------------------------------------------------------------------------- /src/main/webapp/js/skin/default/loading-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/js/skin/default/loading-1.gif -------------------------------------------------------------------------------- /src/main/webapp/js/skin/default/loading-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coder-yqj/springsecuritydemo/1892948fa775137041689c9397cd6ab40a5dbd31/src/main/webapp/js/skin/default/loading-2.gif -------------------------------------------------------------------------------- /src/main/webapp/jsp/common/common.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 3 | <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 4 | <%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%> 5 | <%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%> 6 | 7 | -------------------------------------------------------------------------------- /src/main/webapp/jsp/common/menu.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> 2 | 9 | 10 | -------------------------------------------------------------------------------- /src/main/webapp/jsp/common/top.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> 2 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 3 | 4 | 30 | 31 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/main/webapp/jsp/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> 2 | <%@include file="common/common.jsp"%> 3 | <% 4 | String path = request.getContextPath(); 5 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 6 | %> 7 | 8 | 9 | 10 | 11 | 12 | 13 | My JSP 'index.jsp' starting page 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |

首页

28 | 29 | 30 | -------------------------------------------------------------------------------- /src/main/webapp/jsp/login.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %> 2 | <%@include file="common/common.jsp"%> 3 | <% 4 | String path = request.getContextPath(); 5 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 6 | %> 7 | 8 | 9 | 10 | 11 | 12 | 13 | My JSP 'login.jsp' starting page 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 帐号或密码错误 26 | 27 | 28 | 29 | 30 |
31 | <%-- --%> 32 | 33 |

Logo

34 |
35 |
36 |
37 | 38 |
39 |
40 |
41 |
42 |
43 |
44 | 45 |
46 |
47 |
48 |
49 | Lost password? 50 | Login 51 |
52 |
53 |
54 |

Enter your e-mail address below and we will send you instructions how to recover a password.

55 | 56 |
57 |
58 | 59 |
60 |
61 | 62 |
63 | « Back to login 64 | Reecover 65 |
66 |
67 |
68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /src/main/webapp/jsp/resources/resourceList.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> 2 | <%@include file="../common/common.jsp"%> 3 | <% 4 | String path = request.getContextPath(); 5 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 6 | %> 7 | 8 | 9 | 10 | 11 | 12 | 13 | 资源管理 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 33 | 34 | 35 | 36 | <%@include file="../common/top.jsp"%> 37 | <%@include file="../common/menu.jsp"%> 38 | 39 |
40 |
41 | 42 |

Tables

43 |
44 |
45 |
46 |
47 |
48 | 49 |
50 |
51 |
资源列表
52 |
53 |
54 | 55 | 56 | 57 |
58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 |
ID资源名称资源key父资源资源链接资源类型排序操作
72 |
73 |
74 |
75 |
76 |
77 | 78 | 79 | <%--弹框--%> 80 | 99 | <%----/弹框--%> 100 | 101 | 102 | 103 | 148 | 149 | 150 | 151 | 152 | 153 |
154 | 155 |
156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 312 | 313 | 314 | 315 | -------------------------------------------------------------------------------- /src/main/webapp/jsp/role/roleList.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> 2 | <%@include file="../common/common.jsp"%> 3 | <% 4 | String path = request.getContextPath(); 5 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 6 | %> 7 | 8 | 9 | 10 | 11 | 12 | 13 | 角色管理 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 33 | 34 | 35 | 36 | <%@include file="../common/top.jsp"%> 37 | <%@include file="../common/menu.jsp"%> 38 | 39 |
40 |
41 | 42 |

Tables

43 |
44 |
45 |
46 |
47 |
48 | 49 |
50 |
51 |
角色列表
52 |
53 |
54 | 55 | 56 | 57 |
58 |
59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 |
ID角色key角色名称操作
69 |
70 |
71 |
72 |
73 |
74 |
75 | 76 | <%--弹框--%> 77 | 96 | <%----/弹框--%> 97 | 98 | 99 | 100 | 126 | 127 | 128 | 129 | 130 | 131 |
132 | 133 |
134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 317 | 318 | 319 | 320 | -------------------------------------------------------------------------------- /src/test/java/com/test/SpringTestCase.java: -------------------------------------------------------------------------------- 1 | package com.test; 2 | 3 | import org.junit.runner.RunWith; 4 | import org.springframework.test.context.ContextConfiguration; 5 | import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests; 6 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 7 | 8 | import com.study.config.RootConfig; 9 | 10 | 11 | //java类配置 12 | @ContextConfiguration(classes = {RootConfig.class}) 13 | @RunWith(SpringJUnit4ClassRunner.class) 14 | public class SpringTestCase extends AbstractJUnit4SpringContextTests { 15 | 16 | } -------------------------------------------------------------------------------- /src/test/java/com/test/TestRole.java: -------------------------------------------------------------------------------- 1 | package com.test; 2 | 3 | import org.junit.Test; 4 | import org.springframework.security.authentication.encoding.Md5PasswordEncoder; 5 | 6 | 7 | 8 | public class TestRole extends SpringTestCase { 9 | 10 | @Test 11 | public void testPassword(){ 12 | Md5PasswordEncoder md5=new Md5PasswordEncoder(); 13 | System.out.println(md5.encodePassword("admin", null)); 14 | } 15 | 16 | } 17 | --------------------------------------------------------------------------------