Skip to content

Commit

Permalink
第二十一章
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangkaitao committed Mar 1, 2014
1 parent da7089c commit 3e9b249
Show file tree
Hide file tree
Showing 45 changed files with 126 additions and 117 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.zhangkaitao.shiro.chapter20;
package com.github.zhangkaitao.shiro.chapter21;

/**
* <p>User: Zhang Kaitao
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.zhangkaitao.shiro.chapter20.credentials;
package com.github.zhangkaitao.shiro.chapter21.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.chapter20.dao;
package com.github.zhangkaitao.shiro.chapter21.dao;

import com.github.zhangkaitao.shiro.chapter20.entity.Organization;
import com.github.zhangkaitao.shiro.chapter21.entity.Organization;

import java.util.List;

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

import com.github.zhangkaitao.shiro.chapter20.entity.Organization;
import com.github.zhangkaitao.shiro.chapter21.entity.Organization;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter20.dao;
package com.github.zhangkaitao.shiro.chapter21.dao;

import com.github.zhangkaitao.shiro.chapter20.entity.Resource;
import com.github.zhangkaitao.shiro.chapter21.entity.Resource;

import java.util.List;

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

import com.github.zhangkaitao.shiro.chapter20.entity.Resource;
import com.github.zhangkaitao.shiro.chapter21.entity.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter20.dao;
package com.github.zhangkaitao.shiro.chapter21.dao;

import com.github.zhangkaitao.shiro.chapter20.entity.Role;
import com.github.zhangkaitao.shiro.chapter21.entity.Role;

import java.util.List;

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

import com.github.zhangkaitao.shiro.chapter20.entity.Role;
import com.github.zhangkaitao.shiro.chapter21.entity.Role;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter20.dao;
package com.github.zhangkaitao.shiro.chapter21.dao;

import com.github.zhangkaitao.shiro.chapter20.entity.User;
import com.github.zhangkaitao.shiro.chapter21.entity.User;

import java.util.List;

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

import com.github.zhangkaitao.shiro.chapter20.entity.User;
import com.github.zhangkaitao.shiro.chapter21.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.zhangkaitao.shiro.chapter20.dao;
package com.github.zhangkaitao.shiro.chapter21.dao;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.zhangkaitao.shiro.chapter20.dao;
package com.github.zhangkaitao.shiro.chapter21.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.zhangkaitao.shiro.chapter20.entity;
package com.github.zhangkaitao.shiro.chapter21.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.chapter20.entity;
package com.github.zhangkaitao.shiro.chapter21.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.chapter20.entity;
package com.github.zhangkaitao.shiro.chapter21.entity;

import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.zhangkaitao.shiro.chapter20.entity;
package com.github.zhangkaitao.shiro.chapter21.entity;

import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.zhangkaitao.shiro.chapter20.entity;
package com.github.zhangkaitao.shiro.chapter21.entity;

import java.io.Serializable;

Expand All @@ -8,8 +8,8 @@
* <p>Version: 1.0
*/
public class UserRunAs implements Serializable {
private Long fromUserId;
private Long toUserId;
private Long fromUserId;//授予身份帐号
private Long toUserId;//被授予身份帐号

public Long getFromUserId() {
return fromUserId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.github.zhangkaitao.shiro.chapter20.realm;
package com.github.zhangkaitao.shiro.chapter21.realm;

import com.github.zhangkaitao.shiro.chapter20.entity.User;
import com.github.zhangkaitao.shiro.chapter20.service.UserService;
import com.github.zhangkaitao.shiro.chapter21.entity.User;
import com.github.zhangkaitao.shiro.chapter21.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.chapter20.service;
package com.github.zhangkaitao.shiro.chapter21.service;

import com.github.zhangkaitao.shiro.chapter20.entity.Organization;
import com.github.zhangkaitao.shiro.chapter21.entity.Organization;

import java.util.List;

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

import com.github.zhangkaitao.shiro.chapter20.entity.Organization;
import com.github.zhangkaitao.shiro.chapter21.entity.Organization;
import com.github.zhangkaitao.shiro.chapter21.dao.OrganizationDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

Expand All @@ -14,7 +15,7 @@
@Service
public class OrganizationServiceImpl implements OrganizationService {
@Autowired
private com.github.zhangkaitao.shiro.chapter20.dao.OrganizationDao organizationDao;
private OrganizationDao organizationDao;

@Override
public Organization createOrganization(Organization organization) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter20.service;
package com.github.zhangkaitao.shiro.chapter21.service;

import com.github.zhangkaitao.shiro.chapter20.entity.User;
import com.github.zhangkaitao.shiro.chapter21.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.chapter20.service;
package com.github.zhangkaitao.shiro.chapter21.service;

import com.github.zhangkaitao.shiro.chapter20.entity.Resource;
import com.github.zhangkaitao.shiro.chapter21.entity.Resource;

import java.util.List;
import java.util.Set;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.zhangkaitao.shiro.chapter20.service;
package com.github.zhangkaitao.shiro.chapter21.service;

import com.github.zhangkaitao.shiro.chapter20.entity.Resource;
import com.github.zhangkaitao.shiro.chapter21.dao.ResourceDao;
import com.github.zhangkaitao.shiro.chapter21.entity.Resource;
import org.apache.shiro.authz.permission.WildcardPermission;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
Expand All @@ -21,7 +22,7 @@
public class ResourceServiceImpl implements ResourceService {

@Autowired
private com.github.zhangkaitao.shiro.chapter20.dao.ResourceDao resourceDao;
private ResourceDao resourceDao;

@Override
public Resource createResource(Resource resource) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter20.service;
package com.github.zhangkaitao.shiro.chapter21.service;

import com.github.zhangkaitao.shiro.chapter20.entity.Role;
import com.github.zhangkaitao.shiro.chapter21.entity.Role;

import java.util.List;
import java.util.Set;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.zhangkaitao.shiro.chapter20.service;
package com.github.zhangkaitao.shiro.chapter21.service;

import com.github.zhangkaitao.shiro.chapter20.entity.Role;
import com.github.zhangkaitao.shiro.chapter21.entity.Role;
import com.github.zhangkaitao.shiro.chapter21.dao.RoleDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

Expand All @@ -18,7 +19,7 @@
public class RoleServiceImpl implements RoleService {

@Autowired
private com.github.zhangkaitao.shiro.chapter20.dao.RoleDao roleDao;
private RoleDao roleDao;
@Autowired
private ResourceService resourceService;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.zhangkaitao.shiro.chapter20.service;
package com.github.zhangkaitao.shiro.chapter21.service;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter20.service;
package com.github.zhangkaitao.shiro.chapter21.service;

import com.github.zhangkaitao.shiro.chapter20.dao.UserRunAsDao;
import com.github.zhangkaitao.shiro.chapter21.dao.UserRunAsDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter20.service;
package com.github.zhangkaitao.shiro.chapter21.service;

import com.github.zhangkaitao.shiro.chapter20.entity.User;
import com.github.zhangkaitao.shiro.chapter21.entity.User;

import java.util.List;
import java.util.Set;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.zhangkaitao.shiro.chapter20.service;
package com.github.zhangkaitao.shiro.chapter21.service;

import com.github.zhangkaitao.shiro.chapter20.entity.User;
import com.github.zhangkaitao.shiro.chapter21.entity.User;
import com.github.zhangkaitao.shiro.chapter21.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

Expand All @@ -16,7 +17,7 @@
public class UserServiceImpl implements UserService {

@Autowired
private com.github.zhangkaitao.shiro.chapter20.dao.UserDao userDao;
private UserDao userDao;
@Autowired
private PasswordHelper passwordHelper;
@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package com.github.zhangkaitao.shiro.chapter20.web.bind.annotation;
package com.github.zhangkaitao.shiro.chapter21.web.bind.annotation;

import com.github.zhangkaitao.shiro.chapter20.Constants;
import com.github.zhangkaitao.shiro.chapter21.Constants;

import java.lang.annotation.*;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.zhangkaitao.shiro.chapter20.web.bind.method;
package com.github.zhangkaitao.shiro.chapter21.web.bind.method;

import com.github.zhangkaitao.shiro.chapter20.web.bind.annotation.CurrentUser;
import com.github.zhangkaitao.shiro.chapter21.web.bind.annotation.CurrentUser;
import org.springframework.core.MethodParameter;
import org.springframework.web.bind.support.WebDataBinderFactory;
import org.springframework.web.context.request.NativeWebRequest;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.github.zhangkaitao.shiro.chapter20.web.controller;
package com.github.zhangkaitao.shiro.chapter21.web.controller;

import com.github.zhangkaitao.shiro.chapter20.entity.Resource;
import com.github.zhangkaitao.shiro.chapter20.entity.User;
import com.github.zhangkaitao.shiro.chapter20.web.bind.annotation.CurrentUser;
import com.github.zhangkaitao.shiro.chapter21.entity.Resource;
import com.github.zhangkaitao.shiro.chapter21.entity.User;
import com.github.zhangkaitao.shiro.chapter21.web.bind.annotation.CurrentUser;
import com.github.zhangkaitao.shiro.chapter21.service.ResourceService;
import com.github.zhangkaitao.shiro.chapter21.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
Expand All @@ -20,9 +22,9 @@
public class IndexController {

@Autowired
private com.github.zhangkaitao.shiro.chapter20.service.ResourceService resourceService;
private ResourceService resourceService;
@Autowired
private com.github.zhangkaitao.shiro.chapter20.service.UserService userService;
private UserService userService;

@RequestMapping("/")
public String index(@CurrentUser User loginUser, Model model) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.zhangkaitao.shiro.chapter20.web.controller;
package com.github.zhangkaitao.shiro.chapter21.web.controller;

import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.UnknownAccountException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.zhangkaitao.shiro.chapter20.web.controller;
package com.github.zhangkaitao.shiro.chapter21.web.controller;

import com.github.zhangkaitao.shiro.chapter20.entity.Organization;
import com.github.zhangkaitao.shiro.chapter21.entity.Organization;
import com.github.zhangkaitao.shiro.chapter21.service.OrganizationService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
Expand All @@ -21,7 +22,7 @@
public class OrganizationController {

@Autowired
private com.github.zhangkaitao.shiro.chapter20.service.OrganizationService organizationService;
private OrganizationService organizationService;

@RequiresPermissions("organization:view")
@RequestMapping(method = RequestMethod.GET)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.zhangkaitao.shiro.chapter20.web.controller;
package com.github.zhangkaitao.shiro.chapter21.web.controller;

import com.github.zhangkaitao.shiro.chapter20.entity.Resource;
import com.github.zhangkaitao.shiro.chapter21.entity.Resource;
import com.github.zhangkaitao.shiro.chapter21.service.ResourceService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
Expand All @@ -21,7 +22,7 @@
public class ResourceController {

@Autowired
private com.github.zhangkaitao.shiro.chapter20.service.ResourceService resourceService;
private ResourceService resourceService;

@ModelAttribute("types")
public Resource.ResourceType[] resourceTypes() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.github.zhangkaitao.shiro.chapter20.web.controller;
package com.github.zhangkaitao.shiro.chapter21.web.controller;

import com.github.zhangkaitao.shiro.chapter20.entity.Role;
import com.github.zhangkaitao.shiro.chapter20.service.ResourceService;
import com.github.zhangkaitao.shiro.chapter20.service.RoleService;
import com.github.zhangkaitao.shiro.chapter21.entity.Role;
import com.github.zhangkaitao.shiro.chapter21.service.ResourceService;
import com.github.zhangkaitao.shiro.chapter21.service.RoleService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
Expand Down
Loading

0 comments on commit 3e9b249

Please sign in to comment.