Skip to content

Commit

Permalink
shiro教程-第十七章
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangkaitao committed Feb 14, 2014
1 parent 8a953f7 commit 15765f9
Show file tree
Hide file tree
Showing 86 changed files with 2,467 additions and 102 deletions.
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<module>shiro-example-chapter14</module>
<module>shiro-example-chapter15-server</module>
<module>shiro-example-chapter15-client</module>
<module>shiro-example-chapter17</module>
</modules>


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.zhangkaitao.shiro.chapter13.credentials;
package com.github.zhangkaitao.shiro.chapter14.credentials;

import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter13.dao;
package com.github.zhangkaitao.shiro.chapter14.dao;

import com.github.zhangkaitao.shiro.chapter13.entity.Permission;
import com.github.zhangkaitao.shiro.chapter14.entity.Permission;

/**
* <p>User: Zhang Kaitao
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter13.dao;
package com.github.zhangkaitao.shiro.chapter14.dao;

import com.github.zhangkaitao.shiro.chapter13.entity.Permission;
import com.github.zhangkaitao.shiro.chapter14.entity.Permission;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.jdbc.core.support.JdbcDaoSupport;
import org.springframework.jdbc.support.GeneratedKeyHolder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter13.dao;
package com.github.zhangkaitao.shiro.chapter14.dao;

import com.github.zhangkaitao.shiro.chapter13.entity.Role;
import com.github.zhangkaitao.shiro.chapter14.entity.Role;

/**
* <p>User: Zhang Kaitao
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter13.dao;
package com.github.zhangkaitao.shiro.chapter14.dao;

import com.github.zhangkaitao.shiro.chapter13.entity.Role;
import com.github.zhangkaitao.shiro.chapter14.entity.Role;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.jdbc.core.support.JdbcDaoSupport;
import org.springframework.jdbc.support.GeneratedKeyHolder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter13.dao;
package com.github.zhangkaitao.shiro.chapter14.dao;

import com.github.zhangkaitao.shiro.chapter13.entity.User;
import com.github.zhangkaitao.shiro.chapter14.entity.User;

import java.util.Set;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter13.dao;
package com.github.zhangkaitao.shiro.chapter14.dao;

import com.github.zhangkaitao.shiro.chapter13.entity.User;
import com.github.zhangkaitao.shiro.chapter14.entity.User;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.jdbc.core.support.JdbcDaoSupport;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.zhangkaitao.shiro.chapter13.entity;
package com.github.zhangkaitao.shiro.chapter14.entity;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.zhangkaitao.shiro.chapter13.entity;
package com.github.zhangkaitao.shiro.chapter14.entity;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.zhangkaitao.shiro.chapter13.entity;
package com.github.zhangkaitao.shiro.chapter14.entity;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.zhangkaitao.shiro.chapter13.entity;
package com.github.zhangkaitao.shiro.chapter14.entity;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.zhangkaitao.shiro.chapter13.entity;
package com.github.zhangkaitao.shiro.chapter14.entity;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.zhangkaitao.shiro.chapter13.realm;
package com.github.zhangkaitao.shiro.chapter14.realm;

import com.github.zhangkaitao.shiro.chapter13.entity.User;
import com.github.zhangkaitao.shiro.chapter13.service.UserService;
import com.github.zhangkaitao.shiro.chapter14.entity.User;
import com.github.zhangkaitao.shiro.chapter14.service.UserService;
import org.apache.shiro.authc.*;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter13.service;
package com.github.zhangkaitao.shiro.chapter14.service;

import com.github.zhangkaitao.shiro.chapter13.entity.User;
import com.github.zhangkaitao.shiro.chapter14.entity.User;
import org.apache.shiro.crypto.RandomNumberGenerator;
import org.apache.shiro.crypto.SecureRandomNumberGenerator;
import org.apache.shiro.crypto.hash.SimpleHash;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter13.service;
package com.github.zhangkaitao.shiro.chapter14.service;

import com.github.zhangkaitao.shiro.chapter13.entity.Permission;
import com.github.zhangkaitao.shiro.chapter14.entity.Permission;

/**
* <p>User: Zhang Kaitao
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.zhangkaitao.shiro.chapter13.service;
package com.github.zhangkaitao.shiro.chapter14.service;

import com.github.zhangkaitao.shiro.chapter13.dao.PermissionDao;
import com.github.zhangkaitao.shiro.chapter13.entity.Permission;
import com.github.zhangkaitao.shiro.chapter14.dao.PermissionDao;
import com.github.zhangkaitao.shiro.chapter14.entity.Permission;

/**
* <p>User: Zhang Kaitao
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter13.service;
package com.github.zhangkaitao.shiro.chapter14.service;

import com.github.zhangkaitao.shiro.chapter13.entity.Role;
import com.github.zhangkaitao.shiro.chapter14.entity.Role;

/**
* <p>User: Zhang Kaitao
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.zhangkaitao.shiro.chapter13.service;
package com.github.zhangkaitao.shiro.chapter14.service;

import com.github.zhangkaitao.shiro.chapter13.dao.RoleDao;
import com.github.zhangkaitao.shiro.chapter13.entity.Role;
import com.github.zhangkaitao.shiro.chapter14.dao.RoleDao;
import com.github.zhangkaitao.shiro.chapter14.entity.Role;

/**
* <p>User: Zhang Kaitao
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter13.service;
package com.github.zhangkaitao.shiro.chapter14.service;

import com.github.zhangkaitao.shiro.chapter13.entity.User;
import com.github.zhangkaitao.shiro.chapter14.entity.User;

import java.util.Set;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.zhangkaitao.shiro.chapter13.service;
package com.github.zhangkaitao.shiro.chapter14.service;

import com.github.zhangkaitao.shiro.chapter13.dao.UserDao;
import com.github.zhangkaitao.shiro.chapter13.entity.User;
import com.github.zhangkaitao.shiro.chapter14.dao.UserDao;
import com.github.zhangkaitao.shiro.chapter14.entity.User;

import java.util.Set;

Expand Down
14 changes: 7 additions & 7 deletions shiro-example-chapter14/src/main/resources/spring-beans.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@
</bean>

<!-- DAO -->
<bean id="permissionDao" class="com.github.zhangkaitao.shiro.chapter13.dao.PermissionDaoImpl" parent="baseDao"/>
<bean id="roleDao" class="com.github.zhangkaitao.shiro.chapter13.dao.RoleDaoImpl" parent="baseDao"/>
<bean id="userDao" class="com.github.zhangkaitao.shiro.chapter13.dao.UserDaoImpl" parent="baseDao"/>
<bean id="permissionDao" class="com.github.zhangkaitao.shiro.chapter14.dao.PermissionDaoImpl" parent="baseDao"/>
<bean id="roleDao" class="com.github.zhangkaitao.shiro.chapter14.dao.RoleDaoImpl" parent="baseDao"/>
<bean id="userDao" class="com.github.zhangkaitao.shiro.chapter14.dao.UserDaoImpl" parent="baseDao"/>

<!-- Service -->
<bean id="permissionService" class="com.github.zhangkaitao.shiro.chapter13.service.PermissionServiceImpl">
<bean id="permissionService" class="com.github.zhangkaitao.shiro.chapter14.service.PermissionServiceImpl">
<property name="permissionDao" ref="permissionDao"/>
</bean>

<bean id="roleService" class="com.github.zhangkaitao.shiro.chapter13.service.RoleServiceImpl">
<bean id="roleService" class="com.github.zhangkaitao.shiro.chapter14.service.RoleServiceImpl">
<property name="roleDao" ref="roleDao"/>
</bean>

<bean id="passwordHelper" class="com.github.zhangkaitao.shiro.chapter13.service.PasswordHelper">
<bean id="passwordHelper" class="com.github.zhangkaitao.shiro.chapter14.service.PasswordHelper">
<property name="algorithmName" value="md5"/>
<property name="hashIterations" value="2"/>
</bean>

<bean id="userService" class="com.github.zhangkaitao.shiro.chapter13.service.UserServiceImpl">
<bean id="userService" class="com.github.zhangkaitao.shiro.chapter14.service.UserServiceImpl">
<property name="userDao" ref="userDao"/>
<property name="passwordHelper" ref="passwordHelper"/>
</bean>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
</bean>

<!-- 凭证匹配器 -->
<bean id="credentialsMatcher" class="com.github.zhangkaitao.shiro.chapter13.credentials.RetryLimitHashedCredentialsMatcher">
<bean id="credentialsMatcher" class="com.github.zhangkaitao.shiro.chapter14.credentials.RetryLimitHashedCredentialsMatcher">
<constructor-arg ref="cacheManager"/>
<property name="hashAlgorithmName" value="md5"/>
<property name="hashIterations" value="2"/>
<property name="storedCredentialsHexEncoded" value="true"/>
</bean>

<!-- Realm实现 -->
<bean id="userRealm" class="com.github.zhangkaitao.shiro.chapter13.realm.UserRealm">
<bean id="userRealm" class="com.github.zhangkaitao.shiro.chapter14.realm.UserRealm">
<property name="userService" ref="userService"/>
<property name="credentialsMatcher" ref="credentialsMatcher"/>
<property name="cachingEnabled" value="true"/>
Expand Down
6 changes: 3 additions & 3 deletions shiro-example-chapter15-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>shiro-example-chapter14-client</artifactId>
<artifactId>shiro-example-chapter15-client</artifactId>
<packaging>war</packaging>
<name>shiro-example-chapter14-client</name>
<name>shiro-example-chapter15-client</name>
<url>http://maven.apache.org</url>

<dependencies>
Expand Down Expand Up @@ -148,7 +148,7 @@
</dependencies>

<build>
<finalName>chapter14-client</finalName>
<finalName>chapter15-client</finalName>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.zhangkaitao.shiro.chapter13.credentials;
package com.github.zhangkaitao.shiro.chapter15.credentials;

import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter13.dao;
package com.github.zhangkaitao.shiro.chapter15.dao;

import com.github.zhangkaitao.shiro.chapter13.entity.Permission;
import com.github.zhangkaitao.shiro.chapter15.entity.Permission;

/**
* <p>User: Zhang Kaitao
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter13.dao;
package com.github.zhangkaitao.shiro.chapter15.dao;

import com.github.zhangkaitao.shiro.chapter13.entity.Permission;
import com.github.zhangkaitao.shiro.chapter15.entity.Permission;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.jdbc.core.support.JdbcDaoSupport;
import org.springframework.jdbc.support.GeneratedKeyHolder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter13.dao;
package com.github.zhangkaitao.shiro.chapter15.dao;

import com.github.zhangkaitao.shiro.chapter13.entity.Role;
import com.github.zhangkaitao.shiro.chapter15.entity.Role;

/**
* <p>User: Zhang Kaitao
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter13.dao;
package com.github.zhangkaitao.shiro.chapter15.dao;

import com.github.zhangkaitao.shiro.chapter13.entity.Role;
import com.github.zhangkaitao.shiro.chapter15.entity.Role;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.jdbc.core.support.JdbcDaoSupport;
import org.springframework.jdbc.support.GeneratedKeyHolder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter13.dao;
package com.github.zhangkaitao.shiro.chapter15.dao;

import com.github.zhangkaitao.shiro.chapter13.entity.User;
import com.github.zhangkaitao.shiro.chapter15.entity.User;

import java.util.Set;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter13.dao;
package com.github.zhangkaitao.shiro.chapter15.dao;

import com.github.zhangkaitao.shiro.chapter13.entity.User;
import com.github.zhangkaitao.shiro.chapter15.entity.User;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.jdbc.core.support.JdbcDaoSupport;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.zhangkaitao.shiro.chapter13.entity;
package com.github.zhangkaitao.shiro.chapter15.entity;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.zhangkaitao.shiro.chapter13.entity;
package com.github.zhangkaitao.shiro.chapter15.entity;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.zhangkaitao.shiro.chapter13.entity;
package com.github.zhangkaitao.shiro.chapter15.entity;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.zhangkaitao.shiro.chapter13.entity;
package com.github.zhangkaitao.shiro.chapter15.entity;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.zhangkaitao.shiro.chapter13.entity;
package com.github.zhangkaitao.shiro.chapter15.entity;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter13.realm;
package com.github.zhangkaitao.shiro.chapter15.realm;

import com.github.zhangkaitao.shiro.chapter13.service.UserService;
import com.github.zhangkaitao.shiro.chapter15.service.UserService;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.cas.CasRealm;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.zhangkaitao.shiro.chapter13.realm;
package com.github.zhangkaitao.shiro.chapter15.realm;

import com.github.zhangkaitao.shiro.chapter13.entity.User;
import com.github.zhangkaitao.shiro.chapter13.service.UserService;
import com.github.zhangkaitao.shiro.chapter15.entity.User;
import com.github.zhangkaitao.shiro.chapter15.service.UserService;
import org.apache.shiro.authc.*;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter13.service;
package com.github.zhangkaitao.shiro.chapter15.service;

import com.github.zhangkaitao.shiro.chapter13.entity.User;
import com.github.zhangkaitao.shiro.chapter15.entity.User;
import org.apache.shiro.crypto.RandomNumberGenerator;
import org.apache.shiro.crypto.SecureRandomNumberGenerator;
import org.apache.shiro.crypto.hash.SimpleHash;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter13.service;
package com.github.zhangkaitao.shiro.chapter15.service;

import com.github.zhangkaitao.shiro.chapter13.entity.Permission;
import com.github.zhangkaitao.shiro.chapter15.entity.Permission;

/**
* <p>User: Zhang Kaitao
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.zhangkaitao.shiro.chapter13.service;
package com.github.zhangkaitao.shiro.chapter15.service;

import com.github.zhangkaitao.shiro.chapter13.dao.PermissionDao;
import com.github.zhangkaitao.shiro.chapter13.entity.Permission;
import com.github.zhangkaitao.shiro.chapter15.dao.PermissionDao;
import com.github.zhangkaitao.shiro.chapter15.entity.Permission;

/**
* <p>User: Zhang Kaitao
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter13.service;
package com.github.zhangkaitao.shiro.chapter15.service;

import com.github.zhangkaitao.shiro.chapter13.entity.Role;
import com.github.zhangkaitao.shiro.chapter15.entity.Role;

/**
* <p>User: Zhang Kaitao
Expand Down
Loading

0 comments on commit 15765f9

Please sign in to comment.