shiro环境搭建
1 pom文件中引入依赖
1 <dependency> 2 <groupId>org.apache.shiro</groupId> 3 <artifactId>shiro-core</artifactId> 4 <version>1.4.1</version> 5 </dependency>
2 JdbcRealm数据库表结构(固定)
1 CREATE TABLE users( 2 id INT PRIMARY KEY AUTO_INCREMENT, 3 username VARCHAR(60) NOT NULL UNIQUE, 4 PASSWORD VARCHAR(20) NOT NULL, 5 password_salt VARCHAR(20) 6 ); 7 8 9 10 CREATE TABLE user_roles( 11 id INT PRIMARY KEY AUTO_INCREMENT, 12 username VARCHAR(60) NOT NULL, 13 role_name VARCHAR(100) NOT NULL 14 ); 15 16 17 CREATE TABLE roles_permissions( 18 id INT PRIMARY KEY AUTO_INCREMENT, 19 role_name VARCHAR(100) NOT NULL, 20 permission VARCHAR(100) NOT NULL 21 )