Merge branch 'develop' of https://github.com/dibo-software/diboot-v2 into develop

This commit is contained in:
wuy 2019-06-06 20:01:47 +08:00
commit 0dba5f960e
30 changed files with 95 additions and 112 deletions

View File

@ -1,37 +0,0 @@
package com.diboot.example.test;
import com.diboot.core.util.V;
import com.diboot.example.ApplicationTest;
import com.diboot.shiro.service.AuthWayService;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
import java.util.Map;
@Component
public class BeansTest extends ApplicationTest {
@Autowired
private ApplicationContext applicationContext;
@Autowired
Map<String, AuthWayService> classMap;
@Test
public void testGetImplMap() throws Exception{
Map<String, AuthWayService> authWayServiceMap = applicationContext.getBeansOfType(AuthWayService.class);
Assert.assertTrue(V.notEmpty(authWayServiceMap));
}
@Test
public void testAuthwiredImplMap() throws Exception{
Assert.assertTrue(V.notEmpty(classMap));
for (Map.Entry<String, AuthWayService> entry : classMap.entrySet()){
}
}
}

View File

@ -21,9 +21,9 @@ import java.io.PrintWriter;
/**
* JWT 认证过滤器
* @author Mazc@dibo.ltd
* @version 2018/1/6
*
* @author Yangzhao
* @version v2.0
* @date 2019/6/6
*/
public class BaseJwtAuthenticationFilter extends BasicHttpAuthenticationFilter {
private static final Logger logger = LoggerFactory.getLogger(BaseJwtAuthenticationFilter.class);

View File

@ -12,9 +12,9 @@ import org.springframework.stereotype.Component;
import java.util.Map;
/**
* @author Yangz@dibo.ltd
* @version 2018/1/6
*
* @author Yangzhao
* @version v2.0
* @date 2019/6/6
*/
@Component
public class BaseJwtAuthenticationToken implements AuthenticationToken {

View File

@ -1,9 +1,7 @@
package com.diboot.shiro;
import com.baomidou.mybatisplus.core.conditions.query.Query;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.diboot.core.entity.BaseEntity;
import com.diboot.core.util.BeanUtils;
import com.diboot.core.util.V;
import com.diboot.shiro.entity.Permission;
import com.diboot.shiro.entity.Role;
@ -23,6 +21,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author Yangzhao
* @version v2.0
* @date 2019/6/6
*/
public class BaseJwtRealm extends AuthorizingRealm {
@Autowired

View File

@ -2,6 +2,12 @@ package com.diboot.shiro.config;
import lombok.Data;
/***
* 认证方式
* @author Yangzhao
* @version v2.0
* @date 2019/6/6
*/
public enum AuthType {
USERNAME_PASSWORD(1, true, "账号密码"),

View File

@ -20,6 +20,12 @@ import javax.servlet.Filter;
import java.util.LinkedHashMap;
import java.util.Map;
/***
*
* @author Yangzhao
* @version v2.0
* @date 2019/6/6
*/
@Configuration
public class ShiroConfig {
private static final Logger logger = LoggerFactory.getLogger(ShiroConfig.class);

View File

@ -5,7 +5,7 @@ import com.diboot.core.entity.BaseEntity;
import lombok.Data;
/**
* @author Yangz
* @author Yangzhao
* @version v2.0
* @date 2019/6/6
*/

View File

@ -7,7 +7,7 @@ import lombok.Data;
import java.util.List;
/**
* @author Yangz
* @author Yangzhao
* @version v2.0
* @date 2019/6/6
*/

View File

@ -5,7 +5,7 @@ import com.diboot.core.entity.BaseEntity;
import lombok.Data;
/**
* @author Yangz
* @author Yangzhao
* @version v2.0
* @date 2019/6/6
*/

View File

@ -7,7 +7,7 @@ import lombok.Data;
import java.util.List;
/**
* @author Yangz
* @author Yangzhao
* @version v2.0
* @date 2019/6/6
*/

View File

@ -5,7 +5,7 @@ import com.diboot.core.entity.BaseEntity;
import lombok.Data;
/**
* @author Yangz
* @author Yangzhao
* @version v2.0
* @date 2019/6/6
*/

View File

@ -4,10 +4,10 @@ import com.diboot.core.mapper.BaseCrudMapper;
import com.diboot.shiro.entity.Permission;
/**
* 员工Mapper
* @author Mazhicheng
* @version 2018/12/22
* Copyright © www.dibo.ltd
* 授权Mapper
* @author Yangzhao
* @version v2.0
* @date 2019/6/6
*/
public interface PermissionMapper extends BaseCrudMapper<Permission> {

View File

@ -4,10 +4,10 @@ import com.diboot.core.mapper.BaseCrudMapper;
import com.diboot.shiro.entity.Role;
/**
* 员工Mapper
* @author Mazhicheng
* @version 2018/12/22
* Copyright © www.dibo.ltd
* 角色Mapper
* @author Yangzhao
* @version v2.0
* @date 2019/6/6
*/
public interface RoleMapper extends BaseCrudMapper<Role> {

View File

@ -4,10 +4,10 @@ import com.diboot.core.mapper.BaseCrudMapper;
import com.diboot.shiro.entity.RolePermission;
/**
* 员工Mapper
* @author Mazhicheng
* @version 2018/12/22
* Copyright © www.dibo.ltd
* 角色授权Mapper
* @author Yangzhao
* @version v2.0
* @date 2019/6/6
*/
public interface RolePermissionMapper extends BaseCrudMapper<RolePermission> {

View File

@ -4,10 +4,10 @@ import com.diboot.core.mapper.BaseCrudMapper;
import com.diboot.shiro.entity.SysUser;
/**
* 员工Mapper
* @author Mazhicheng
* @version 2018/12/22
* Copyright © www.dibo.ltd
* 用户Mapper
* @author Yangzhao
* @version v2.0
* @date 2019/6/6
*/
public interface SysUserMapper extends BaseCrudMapper<SysUser> {

View File

@ -4,10 +4,10 @@ import com.diboot.core.mapper.BaseCrudMapper;
import com.diboot.shiro.entity.UserRole;
/**
* 员工Mapper
* @author Mazhicheng
* @version 2018/12/22
* Copyright © www.dibo.ltd
* 用户角色Mapper
* @author Yangzhao
* @version v2.0
* @date 2019/6/6
*/
public interface UserRoleMapper extends BaseCrudMapper<UserRole> {

View File

@ -4,6 +4,12 @@ import com.diboot.core.entity.BaseEntity;
import com.diboot.shiro.BaseJwtAuthenticationToken;
import com.diboot.shiro.config.AuthType;
/***
* 认证方式接口
* @author Yangzhao
* @version v2.0
* @date 2019/6/6
*/
public interface AuthWayService {
/***

View File

@ -4,10 +4,10 @@ import com.diboot.core.service.BaseService;
import com.diboot.shiro.entity.Permission;
/**
* 员工相关Service
* @author Mazhicheng
* 许可授权相关Service
* @author Yangzhao
* @version v2.0
* @date 2019/1/5
* @date 2019/6/6
*/
public interface PermissionService extends BaseService<Permission> {

View File

@ -4,10 +4,10 @@ import com.diboot.core.service.BaseService;
import com.diboot.shiro.entity.RolePermission;
/**
* 员工相关Service
* @author Mazhicheng
* 角色授权相关Service
* @author Yangzhao
* @version v2.0
* @date 2019/1/5
* @date 2019/6/6
*/
public interface RolePermissionService extends BaseService<RolePermission> {

View File

@ -4,10 +4,10 @@ import com.diboot.core.service.BaseService;
import com.diboot.shiro.entity.Role;
/**
* 员工相关Service
* @author Mazhicheng
* 角色相关Service
* @author Yangzhao
* @version v2.0
* @date 2019/1/5
* @date 2019/6/6
*/
public interface RoleService extends BaseService<Role> {

View File

@ -4,10 +4,10 @@ import com.diboot.core.service.BaseService;
import com.diboot.shiro.entity.SysUser;
/**
* 员工相关Service
* @author Mazhicheng
* 用户相关Service
* @author Yangzhao
* @version v2.0
* @date 2019/1/5
* @date 2019/6/6
*/
public interface SysUserService extends BaseService<SysUser> {

View File

@ -4,10 +4,10 @@ import com.diboot.core.service.BaseService;
import com.diboot.shiro.entity.UserRole;
/**
* 员工相关Service
* @author Mazhicheng
* 用户角色Service
* @author Yangzhao
* @version v2.0
* @date 2019/1/5
* @date 2019/6/6
*/
public interface UserRoleService extends BaseService<UserRole> {

View File

@ -9,7 +9,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* 员工相关Service
* 许可授权相关Service
* @author Mazhicheng
* @version 2018/12/23
* Copyright © www.dibo.ltd

View File

@ -8,10 +8,10 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* 员工相关Service
* @author Mazhicheng
* @version 2018/12/23
* Copyright © www.dibo.ltd
* 角色授权相关Service
* @author Yangzhao
* @version v2.0
* @date 2019/6/6
*/
@Service
@Slf4j

View File

@ -8,10 +8,10 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* 员工相关Service
* @author Mazhicheng
* @version 2018/12/23
* Copyright © www.dibo.ltd
* 角色相关Service
* @author Yangzhao
* @version v2.0
* @date 2019/6/6
*/
@Service
@Slf4j

View File

@ -8,10 +8,10 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* 员工相关Service
* @author Mazhicheng
* @version 2018/12/23
* Copyright © www.dibo.ltd
* 用户相关Service
* @author Yangzhao
* @version v2.0
* @date 2019/6/6
*/
@Service
@Slf4j

View File

@ -9,10 +9,10 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* 员工相关Service
* @author Mazhicheng
* @version 2018/12/23
* Copyright © www.dibo.ltd
* 用户角色相关Service
* @author Yangzhao
* @version v2.0
* @date 2019/6/6
*/
@Service
@Slf4j

View File

@ -14,6 +14,12 @@ import org.springframework.stereotype.Service;
import java.util.List;
/***
* 用户名密码认证实现
* @author Yangzhao
* @version v2.0
* @date 2019/6/6
*/
@Service
public class UsernamePasswordAuthWayServiceImpl implements AuthWayService {

View File

@ -13,9 +13,9 @@ import java.util.Date;
/**
* Token相关操作类
* @author Mazc@dibo.ltd
* @version 2017/9/2
*
* @author Yangzhao
* @version v2.0
* @date 2019/6/6
*/
public class JwtHelper {
private static final Logger logger = LoggerFactory.getLogger(JwtHelper.class);

View File

@ -1,7 +0,0 @@
package com.diboot.shiro;
public class BeansTest {
public static void main(String[] args) {
}
}