Merge pull request #20 from hiparker/development

2.0.1
pull/33/head 2.0.0
Parker 2 years ago committed by GitHub
commit dfd6260a18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4499,14 +4499,14 @@ CREATE TABLE `sys_user` (
-- Records of sys_user
-- ----------------------------
BEGIN;
INSERT INTO `sys_user` VALUES (1, 'system', 'TS{MTY1OTM2NzA0MjMzOA==}$2a$10$FtVMZrf/LeM4ikU2ZXO8XuhmRDpJmIxLVm6Fa3ZEM8jVgZ2CFhuH6', '2', '1', '', '15321010110', '112', 'http://upload.bedebug.com/20220802/1660928576913664278HC1G.jpg', '', 'meet.parker@foxmail.com', '没有自学能力的人没有未来', '', '0', '0', 0, '1', '0', 95, 1, '2020-09-25 15:03:22', 1, '2021-05-04 01:59:11', '2022-08-02 15:29:33');
INSERT INTO `sys_user` VALUES (1313694379541635074, 'demo', 'TS{MTY1ODI5ODUzMzMwOA==}$2a$10$TS0LnHPhQT87rEpFi1A60.BeTQ80vCRGGL.5CPTqb61eCzP8HzueK', '2', '1', '', '15311111111', 'test_001', 'http://upload.bedebug.com/20211013/1635589382475625280EW3N.jpg', '', 'meet.parker1@foxmail.com', NULL, NULL, '1', '0', 1, '0', '0', 6, 1, '2020-10-06 23:15:22', 1465879900211294210, '2021-12-01 16:42:13', '2022-07-27 13:49:16');
INSERT INTO `sys_user` VALUES (1315218541317750785, 'zhangsan', 'TS{MTY1ODI5ODUzMzMwOA==}$2a$10$TS0LnHPhQT87rEpFi1A60.BeTQ80vCRGGL.5CPTqb61eCzP8HzueK', '2', '1', '', NULL, '123123', NULL, '', NULL, NULL, NULL, '1', '0', 1, '0', '0', 3, 1, '2020-10-11 17:11:50', 1, '2021-06-11 17:44:11', '2022-07-20 14:30:20');
INSERT INTO `sys_user` VALUES (1315224823500120066, 'lyf', 'TS{MTY1ODI5ODUzMzMwOA==}$2a$10$TS0LnHPhQT87rEpFi1A60.BeTQ80vCRGGL.5CPTqb61eCzP8HzueK', '2', '1', '', NULL, '0101001', NULL, '', NULL, NULL, NULL, '1', '0', 1, '0', '0', 0, 1313694379541635074, '2020-10-11 17:36:48', 1313694379541635074, '2020-10-11 17:36:48', '2022-07-20 14:30:20');
INSERT INTO `sys_user` VALUES (1465171199435362305, 'admin', 'TS{MTY1OTM2NDMzMzM5Nw==}$2a$10$2GTqJeztWRLOYDoB2EStm.FoncwpHG4GGtieD7qZbND1.cwjXx34u', '2', '1', '', NULL, '01001', NULL, '', NULL, NULL, NULL, '1', '0', 0, '1', '0', 6, 1, '2021-11-29 12:10:10', 1, '2022-07-26 20:16:02', '2022-08-01 22:32:13');
INSERT INTO `sys_user` VALUES (1465879900211294210, 'tenant', 'TS{MTY1ODI5ODUzMzMwOA==}$2a$10$TS0LnHPhQT87rEpFi1A60.BeTQ80vCRGGL.5CPTqb61eCzP8HzueK', '2', '1', '', '15300000000', '123123', NULL, '', 'meet.parker2@foxmail.com', NULL, NULL, '0', '1', 1, '0', '0', 1, 1, '2021-12-01 11:06:17', 1, '2021-12-01 11:06:53', '2022-07-27 13:49:20');
INSERT INTO `sys_user` VALUES (1465886867659096066, 'dept', 'TS{MTY1ODI5ODUzMzMwOA==}$2a$10$TS0LnHPhQT87rEpFi1A60.BeTQ80vCRGGL.5CPTqb61eCzP8HzueK', '2', '1', '', NULL, '123213213', NULL, '', NULL, NULL, NULL, '1', '0', 1, '0', '0', 0, 1313694379541635074, '2021-12-01 11:33:59', 1313694379541635074, '2021-12-01 11:33:59', '2022-07-20 14:30:20');
INSERT INTO `sys_user` VALUES (1465991640378986498, 'songyi', 'TS{MTY1ODI5ODUzMzMwOA==}$2a$10$TS0LnHPhQT87rEpFi1A60.BeTQ80vCRGGL.5CPTqb61eCzP8HzueK', '2', '1', '', NULL, '432431', NULL, '', NULL, NULL, NULL, '1', '0', 1, '0', '0', 0, 1465886867659096066, '2021-12-01 18:30:19', 1465886867659096066, '2021-12-01 18:30:19', '2022-07-20 14:30:20');
INSERT INTO `sys_user`(`id`, `username`, `password`, `password_level`, `enable`, `real_name`, `mobile`, `no`, `avatar`, `login_ip`, `email`, `sign`, `remark`, `iz_exist_org`, `iz_tenant_admin`, `tenant_id`, `enable_switch_tenant`, `deleted`, `version`, `create_by`, `create_time`, `update_by`, `update_time`, `ts`) VALUES (1, 'system', 'TS{MTY1OTM2NzA0MjMzOA==}$2a$10$FtVMZrf/LeM4ikU2ZXO8XuhmRDpJmIxLVm6Fa3ZEM8jVgZ2CFhuH6', '2', '1', '', '15321010110', '112', 'http://upload.bedebug.com/20220802/1660928576913664278HC1G.jpg', '', 'meet.parker@foxmail.com', '没有自学能力的人没有未来', '', '0', '0', 0, '1', '0', 95, 1, '2020-09-25 15:03:22', 1, '2021-05-04 01:59:11', '2022-08-02 15:29:33');
INSERT INTO `sys_user`(`id`, `username`, `password`, `password_level`, `enable`, `real_name`, `mobile`, `no`, `avatar`, `login_ip`, `email`, `sign`, `remark`, `iz_exist_org`, `iz_tenant_admin`, `tenant_id`, `enable_switch_tenant`, `deleted`, `version`, `create_by`, `create_time`, `update_by`, `update_time`, `ts`) VALUES (1313694379541635074, 'demo', 'TS{MTY1ODI5ODUzMzMwOA==}$2a$10$TS0LnHPhQT87rEpFi1A60.BeTQ80vCRGGL.5CPTqb61eCzP8HzueK', '2', '1', '', '13301225424', 'test_001', 'http://upload.bedebug.com/20220809/1660188426197843638MXWG.jpg', '', 'meet.parker1@foxmail.com', NULL, NULL, '1', '0', 1, '0', '0', 6, 1, '2020-10-06 23:15:22', 1465879900211294210, '2021-12-01 16:42:13', '2022-08-09 13:55:05');
INSERT INTO `sys_user`(`id`, `username`, `password`, `password_level`, `enable`, `real_name`, `mobile`, `no`, `avatar`, `login_ip`, `email`, `sign`, `remark`, `iz_exist_org`, `iz_tenant_admin`, `tenant_id`, `enable_switch_tenant`, `deleted`, `version`, `create_by`, `create_time`, `update_by`, `update_time`, `ts`) VALUES (1315218541317750785, 'zhangsan', 'TS{MTY1ODI5ODUzMzMwOA==}$2a$10$TS0LnHPhQT87rEpFi1A60.BeTQ80vCRGGL.5CPTqb61eCzP8HzueK', '2', '1', '', '55555555555', '123123', NULL, '', 'meet.parker3@foxmail.com', NULL, NULL, '1', '0', 1, '0', '0', 3, 1, '2020-10-11 17:11:50', 1, '2021-06-11 17:44:11', '2022-08-09 14:01:18');
INSERT INTO `sys_user`(`id`, `username`, `password`, `password_level`, `enable`, `real_name`, `mobile`, `no`, `avatar`, `login_ip`, `email`, `sign`, `remark`, `iz_exist_org`, `iz_tenant_admin`, `tenant_id`, `enable_switch_tenant`, `deleted`, `version`, `create_by`, `create_time`, `update_by`, `update_time`, `ts`) VALUES (1315224823500120066, 'lyf', 'TS{MTY1ODI5ODUzMzMwOA==}$2a$10$TS0LnHPhQT87rEpFi1A60.BeTQ80vCRGGL.5CPTqb61eCzP8HzueK', '2', '1', '', '44444444444', '0101001', NULL, '', 'meet.parker4@foxmail.com', NULL, NULL, '1', '0', 1, '0', '0', 0, 1313694379541635074, '2020-10-11 17:36:48', 1313694379541635074, '2020-10-11 17:36:48', '2022-08-09 14:01:22');
INSERT INTO `sys_user`(`id`, `username`, `password`, `password_level`, `enable`, `real_name`, `mobile`, `no`, `avatar`, `login_ip`, `email`, `sign`, `remark`, `iz_exist_org`, `iz_tenant_admin`, `tenant_id`, `enable_switch_tenant`, `deleted`, `version`, `create_by`, `create_time`, `update_by`, `update_time`, `ts`) VALUES (1465171199435362305, 'admin', 'TS{MTY1OTM2NDMzMzM5Nw==}$2a$10$2GTqJeztWRLOYDoB2EStm.FoncwpHG4GGtieD7qZbND1.cwjXx34u', '2', '1', '', '33333333333', '01001', 'http://upload.bedebug.com/20220809/16605552760947393781AWR.jpg', '', 'meet.parker5@foxmail.com', NULL, NULL, '1', '0', 0, '1', '0', 6, 1, '2021-11-29 12:10:10', 1, '2022-07-26 20:16:02', '2022-08-09 14:01:26');
INSERT INTO `sys_user`(`id`, `username`, `password`, `password_level`, `enable`, `real_name`, `mobile`, `no`, `avatar`, `login_ip`, `email`, `sign`, `remark`, `iz_exist_org`, `iz_tenant_admin`, `tenant_id`, `enable_switch_tenant`, `deleted`, `version`, `create_by`, `create_time`, `update_by`, `update_time`, `ts`) VALUES (1465879900211294210, 'tenant', 'TS{MTY1ODI5ODUzMzMwOA==}$2a$10$TS0LnHPhQT87rEpFi1A60.BeTQ80vCRGGL.5CPTqb61eCzP8HzueK', '2', '1', '', '17310558930', '123123', 'http://upload.bedebug.com/20220809/166121046267039280RQ81U.jpg', '', 'meet.parker2@foxmail.com', NULL, NULL, '0', '1', 1, '0', '0', 1, 1, '2021-12-01 11:06:17', 1, '2021-12-01 11:06:53', '2022-08-09 13:55:40');
INSERT INTO `sys_user`(`id`, `username`, `password`, `password_level`, `enable`, `real_name`, `mobile`, `no`, `avatar`, `login_ip`, `email`, `sign`, `remark`, `iz_exist_org`, `iz_tenant_admin`, `tenant_id`, `enable_switch_tenant`, `deleted`, `version`, `create_by`, `create_time`, `update_by`, `update_time`, `ts`) VALUES (1465886867659096066, 'dept', 'TS{MTY1ODI5ODUzMzMwOA==}$2a$10$TS0LnHPhQT87rEpFi1A60.BeTQ80vCRGGL.5CPTqb61eCzP8HzueK', '2', '1', '', '22222222222', '123213213', 'http://upload.bedebug.com/20220809/16610489376695984679HUA.jpg', '', 'meet.parker6@foxmail.com', NULL, NULL, '1', '0', 1, '0', '0', 0, 1313694379541635074, '2021-12-01 11:33:59', 1313694379541635074, '2021-12-01 11:33:59', '2022-08-09 14:01:30');
INSERT INTO `sys_user`(`id`, `username`, `password`, `password_level`, `enable`, `real_name`, `mobile`, `no`, `avatar`, `login_ip`, `email`, `sign`, `remark`, `iz_exist_org`, `iz_tenant_admin`, `tenant_id`, `enable_switch_tenant`, `deleted`, `version`, `create_by`, `create_time`, `update_by`, `update_time`, `ts`) VALUES (1465991640378986498, 'songyi', 'TS{MTY1ODI5ODUzMzMwOA==}$2a$10$TS0LnHPhQT87rEpFi1A60.BeTQ80vCRGGL.5CPTqb61eCzP8HzueK', '2', '1', '', '11111111111', '432431', 'http://upload.bedebug.com/20220809/1661003971159749330PV6N.jpg', '', 'meet.parker7@foxmail.com', NULL, NULL, '1', '0', 1, '0', '0', 0, 1465886867659096066, '2021-12-01 18:30:19', 1465886867659096066, '2021-12-01 18:30:19', '2022-08-09 14:01:33');
COMMIT;
-- ----------------------------

@ -67,7 +67,11 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.frameOptions().disable()
.and()
// 关闭csrf token认证不需要csrf防护
.csrf().disable();
.csrf().disable()
// 关闭Session会话管理器 JWT 不需要
.sessionManagement().disable()
// 关闭记住我功能 JWT 不需要
.rememberMe().disable();
// 初始化 initAuthorizeRequests
this.initAuthorizeRequests(http);
@ -78,15 +82,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
* @param http http
*/
private void initAuthorizeRequests(HttpSecurity http) throws Exception {
// 设置URL 未登陆前可访问URL
List<String> anonymousList = authProperties.getUrlExclusion().getAnonymous();
if(null != anonymousList){
String[] urlExclusionArray = anonymousList.toArray(new String[0]);
http.authorizeRequests()
// URL 未登陆前可访问
.antMatchers(urlExclusionArray).anonymous();
}
// 设置URL白名单
List<String> permitAll = authProperties.getUrlExclusion().getPermitAll();
if(null != permitAll){
@ -105,6 +100,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
http.addFilterBefore(new JwtAuthenticationTokenFilter(uidUserDetailDetailService),
UsernamePasswordAuthenticationFilter.class);
// 异常处理
http.exceptionHandling()
.accessDeniedHandler(accessDeniedHandler)

@ -37,6 +37,7 @@ import org.opsli.modulars.system.dict.mapper.DictDetailMapper;
import org.opsli.modulars.system.dict.service.IDictDetailService;
import org.opsli.modulars.system.dict.service.IDictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -54,6 +55,8 @@ public class DictDetailServiceImpl extends CrudServiceImpl<DictDetailMapper, Sys
@Autowired(required = false)
private DictDetailMapper mapper;
@Lazy
@Autowired
private IDictService iDictService;

@ -35,7 +35,7 @@ public class LoginModel {
private String principal;
/** 密码 */
@Validator({ValidatorType.IS_NOT_NULL, ValidatorType.IS_SECURITY_PASSWORD})
@Validator({ValidatorType.IS_NOT_NULL})
@ValidatorLenMin(6)
private String password;

@ -5,6 +5,7 @@ import org.opsli.api.wrapper.system.logs.LoginLogsModel;
import org.opsli.api.wrapper.system.user.UserModel;
import org.opsli.api.wrapper.system.user.UserOrgRefModel;
import org.opsli.common.enums.DictType;
import org.opsli.common.utils.IPUtil;
import org.opsli.core.utils.UserUtil;
import org.springframework.util.ObjectUtils;
@ -27,7 +28,7 @@ public final class UserLoginLogFactory {
loginInfo.setUsername(user.getUsername());
loginInfo.setRealName(user.getRealName());
// *** 需要确保 user对象的ip信息是有值的
loginInfo.setRemoteAddr(user.getLoginIp());
loginInfo.setRemoteAddr(IPUtil.getClientAddressBySingle(request));
String header = request.getHeader("User-Agent");
loginInfo.setUserAgent(header);

@ -31,6 +31,7 @@ import org.opsli.modulars.system.role.mapper.RoleMenuRefMapper;
import org.opsli.modulars.system.role.service.IRoleMenuRefService;
import org.opsli.modulars.system.user.service.IUserRoleRefService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -48,6 +49,8 @@ public class RoleMenuRefServiceImpl extends ServiceImpl<RoleMenuRefMapper,SysRol
@Autowired(required = false)
private RoleMenuRefMapper mapper;
@Lazy
@Autowired
private IUserRoleRefService iUserRoleRefService;

@ -45,6 +45,7 @@ import org.opsli.modulars.system.user.mapper.UserOrgRefMapper;
import org.opsli.modulars.system.user.service.IUserOrgRefService;
import org.opsli.modulars.system.user.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -72,8 +73,11 @@ public class UserOrgRefServiceImpl extends ServiceImpl<UserOrgRefMapper, SysUser
@Autowired(required = false)
private UserOrgRefMapper mapper;
@Lazy
@Autowired
private IUserService iUserService;
@Lazy
@Autowired
private ISysOrgService iSysOrgService;

@ -46,6 +46,7 @@ import org.opsli.modulars.system.user.mapper.UserRoleRefMapper;
import org.opsli.modulars.system.user.service.IUserRoleRefService;
import org.opsli.modulars.system.user.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -64,12 +65,15 @@ public class UserRoleRefServiceImpl extends ServiceImpl<UserRoleRefMapper, SysUs
@Autowired(required = false)
private UserRoleRefMapper mapper;
@Lazy
@Autowired
private IRoleService iRoleService;
@Lazy
@Autowired
private IUserService iUserService;
@Lazy
@Autowired
private IMenuService iMenuService;

@ -17,12 +17,10 @@ package org.opsli.modulars.system.user.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import lombok.AllArgsConstructor;
@ -46,7 +44,6 @@ import org.opsli.core.utils.OptionsUtil;
import org.opsli.core.utils.UserUtil;
import org.opsli.core.utils.VerificationCodeUtil;
import org.opsli.modulars.system.SystemMsg;
import org.opsli.modulars.system.menu.service.IMenuService;
import org.opsli.modulars.system.role.entity.SysRole;
import org.opsli.modulars.system.role.service.IRoleService;
import org.opsli.modulars.system.user.entity.SysUser;
@ -55,7 +52,7 @@ import org.opsli.modulars.system.user.mapper.UserMapper;
import org.opsli.modulars.system.user.service.IUserRoleRefService;
import org.opsli.modulars.system.user.service.IUserService;
import org.opsli.plugins.security.utils.PasswordUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -72,6 +69,7 @@ import java.util.List;
* @date 2020-09-16 17:33
*/
@AllArgsConstructor
@Lazy
@Service
public class UserServiceImpl extends CrudServiceImpl<UserMapper, SysUser, UserModel> implements IUserService {

@ -45,9 +45,6 @@ public class AuthProperties {
@Data
public static class UrlExclusion {
/** 未登陆状态下可以访问 */
private List<String> anonymous;
/** 无限制 */
private List<String> permitAll;

@ -164,17 +164,7 @@ opsli:
credentials-expired: -1
# 排除过滤URL
url-exclusion:
# 未登陆状态下可以访问
anonymous:
- "/captcha"
- "/system/slipCount"
- "/system/login"
- "/system/login-by-code"
# 无限制
permit-all:
- "/api/*/common/public-key"
- "/api/*/common/email/create-code"
- "/api/*/common/mobile/create-code"
- "/swagger-ui.html"
- "/doc.html"
- "/swagger-resources/**"
@ -183,6 +173,13 @@ opsli:
- "/swagger/**"
- "/v2/api-docs"
- "/druid/**"
- "/captcha"
- "/system/slipCount"
- "/system/login"
- "/system/login-by-code"
- "/api/*/common/public-key"
- "/api/*/common/email/create-code"
- "/api/*/common/mobile/create-code"
# 超级管理员账号
super-admin: system

Loading…
Cancel
Save