正在显示
15 个修改的文件
包含
190 行增加
和
16 行删除
| @@ -7,7 +7,6 @@ | @@ -7,7 +7,6 @@ | ||
| 7 | <groupId>com.zhonglai.luhui</groupId> | 7 | <groupId>com.zhonglai.luhui</groupId> |
| 8 | <artifactId>lh-common</artifactId> | 8 | <artifactId>lh-common</artifactId> |
| 9 | <version>1.0-SNAPSHOT</version> | 9 | <version>1.0-SNAPSHOT</version> |
| 10 | - <relativePath>../../pom.xml</relativePath> | ||
| 11 | </parent> | 10 | </parent> |
| 12 | 11 | ||
| 13 | <artifactId>lh-common-firewall</artifactId> | 12 | <artifactId>lh-common-firewall</artifactId> |
| @@ -7,7 +7,6 @@ | @@ -7,7 +7,6 @@ | ||
| 7 | <groupId>com.zhonglai.luhui</groupId> | 7 | <groupId>com.zhonglai.luhui</groupId> |
| 8 | <artifactId>lh-common</artifactId> | 8 | <artifactId>lh-common</artifactId> |
| 9 | <version>1.0-SNAPSHOT</version> | 9 | <version>1.0-SNAPSHOT</version> |
| 10 | - <relativePath>../../pom.xml</relativePath> | ||
| 11 | </parent> | 10 | </parent> |
| 12 | 11 | ||
| 13 | <artifactId>lh-common-swagger</artifactId> | 12 | <artifactId>lh-common-swagger</artifactId> |
| @@ -7,7 +7,6 @@ | @@ -7,7 +7,6 @@ | ||
| 7 | <groupId>com.zhonglai.luhui</groupId> | 7 | <groupId>com.zhonglai.luhui</groupId> |
| 8 | <artifactId>lh-jar</artifactId> | 8 | <artifactId>lh-jar</artifactId> |
| 9 | <version>1.0-SNAPSHOT</version> | 9 | <version>1.0-SNAPSHOT</version> |
| 10 | - <relativePath>../../pom.xml</relativePath> | ||
| 11 | </parent> | 10 | </parent> |
| 12 | 11 | ||
| 13 | <artifactId>lh-jar-action</artifactId> | 12 | <artifactId>lh-jar-action</artifactId> |
| @@ -7,7 +7,6 @@ | @@ -7,7 +7,6 @@ | ||
| 7 | <groupId>com.zhonglai.luhui</groupId> | 7 | <groupId>com.zhonglai.luhui</groupId> |
| 8 | <artifactId>lh-jar</artifactId> | 8 | <artifactId>lh-jar</artifactId> |
| 9 | <version>1.0-SNAPSHOT</version> | 9 | <version>1.0-SNAPSHOT</version> |
| 10 | - <relativePath>../../pom.xml</relativePath> | ||
| 11 | </parent> | 10 | </parent> |
| 12 | 11 | ||
| 13 | <artifactId>lh-jar-chatgpt</artifactId> | 12 | <artifactId>lh-jar-chatgpt</artifactId> |
| @@ -7,7 +7,6 @@ | @@ -7,7 +7,6 @@ | ||
| 7 | <groupId>com.zhonglai.luhui</groupId> | 7 | <groupId>com.zhonglai.luhui</groupId> |
| 8 | <artifactId>lh-jar</artifactId> | 8 | <artifactId>lh-jar</artifactId> |
| 9 | <version>1.0-SNAPSHOT</version> | 9 | <version>1.0-SNAPSHOT</version> |
| 10 | - <relativePath>../../pom.xml</relativePath> | ||
| 11 | </parent> | 10 | </parent> |
| 12 | 11 | ||
| 13 | <artifactId>lh-jar-rocketmq</artifactId> | 12 | <artifactId>lh-jar-rocketmq</artifactId> |
| @@ -105,6 +105,10 @@ | @@ -105,6 +105,10 @@ | ||
| 105 | <groupId>com.zhonglai.luhui</groupId> | 105 | <groupId>com.zhonglai.luhui</groupId> |
| 106 | <artifactId>lh-jar-device-service</artifactId> | 106 | <artifactId>lh-jar-device-service</artifactId> |
| 107 | </dependency> | 107 | </dependency> |
| 108 | + <dependency> | ||
| 109 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 110 | + <artifactId>lh-login</artifactId> | ||
| 111 | + </dependency> | ||
| 108 | </dependencies> | 112 | </dependencies> |
| 109 | 113 | ||
| 110 | <build> | 114 | <build> |
| @@ -11,8 +11,12 @@ import org.springframework.context.annotation.ComponentScan; | @@ -11,8 +11,12 @@ import org.springframework.context.annotation.ComponentScan; | ||
| 11 | "com.ruoyi.framework", | 11 | "com.ruoyi.framework", |
| 12 | "com.zhonglai.luhui.datasource", | 12 | "com.zhonglai.luhui.datasource", |
| 13 | "com.zhonglai.luhui.dao", | 13 | "com.zhonglai.luhui.dao", |
| 14 | + "com.zhonglai.luhui.sys", | ||
| 15 | + "com.zhonglai.luhui.device", | ||
| 14 | "com.zhonglai.luhui.redis", | 16 | "com.zhonglai.luhui.redis", |
| 17 | + "com.zhonglai.luhui.rocketmq", | ||
| 15 | "com.zhonglai.luhui.security", | 18 | "com.zhonglai.luhui.security", |
| 19 | + "com.zhonglai.luhui.login.service", | ||
| 16 | "com.zhonglai.luhui.api", | 20 | "com.zhonglai.luhui.api", |
| 17 | }) | 21 | }) |
| 18 | @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) | 22 | @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) |
| 1 | +package com.zhonglai.luhui.api.config; | ||
| 2 | + | ||
| 3 | +import com.ruoyi.common.tool.SysLogininforType; | ||
| 4 | +import com.ruoyi.common.utils.spring.SpringUtils; | ||
| 5 | +import com.zhonglai.luhui.api.service.ApiUserDetailsServiceImpl; | ||
| 6 | +import com.zhonglai.luhui.security.config.DefaultSecurityConfig; | ||
| 7 | +import com.zhonglai.luhui.security.service.SecurityConfigService; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.context.annotation.Configuration; | ||
| 10 | +import org.springframework.core.annotation.Order; | ||
| 11 | +import org.springframework.security.config.annotation.web.builders.HttpSecurity; | ||
| 12 | +import org.springframework.security.core.userdetails.UserDetailsService; | ||
| 13 | +import org.springframework.security.crypto.password.PasswordEncoder; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * app接口安全策略. 没有{@link Order}注解优先级比上面低 | ||
| 17 | + */ | ||
| 18 | +@Configuration | ||
| 19 | +public class ApiConfigurerAdapter extends DefaultSecurityConfig { | ||
| 20 | + @Autowired | ||
| 21 | + private ApiUserDetailsServiceImpl apiUserDetailsServiceImpl; | ||
| 22 | + | ||
| 23 | + @Autowired | ||
| 24 | + private SecurityConfigService securityConfigService; | ||
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + public UserDetailsService getUserDetailsService() { | ||
| 28 | + return apiUserDetailsServiceImpl; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + @Override | ||
| 32 | + public void configHttpSecurity(HttpSecurity httpSecurity) throws Exception { | ||
| 33 | + securityConfigService.configHttpSecurity(httpSecurity); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + @Override | ||
| 37 | + public PasswordEncoder bCryptPasswordEncoder() { | ||
| 38 | + return SpringUtils.getBean("bCryptPasswordEncoder"); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + @Override | ||
| 42 | + public SysLogininforType sysLogininforType() { | ||
| 43 | + return SysLogininforType.lhAdmin; | ||
| 44 | + } | ||
| 45 | +} |
| @@ -3,7 +3,7 @@ package com.zhonglai.luhui.api.controller.iot; | @@ -3,7 +3,7 @@ package com.zhonglai.luhui.api.controller.iot; | ||
| 3 | import com.ruoyi.common.annotation.Log; | 3 | import com.ruoyi.common.annotation.Log; |
| 4 | import com.ruoyi.common.core.domain.Message; | 4 | import com.ruoyi.common.core.domain.Message; |
| 5 | import com.ruoyi.common.enums.BusinessType; | 5 | import com.ruoyi.common.enums.BusinessType; |
| 6 | -import com.ruoyi.system.service.DeviceControlService; | 6 | +import com.zhonglai.luhui.device.service.DeviceControlService; |
| 7 | import io.swagger.annotations.Api; | 7 | import io.swagger.annotations.Api; |
| 8 | import io.swagger.annotations.ApiImplicitParam; | 8 | import io.swagger.annotations.ApiImplicitParam; |
| 9 | import io.swagger.annotations.ApiImplicitParams; | 9 | import io.swagger.annotations.ApiImplicitParams; |
lh-modules/lh-api/src/main/java/com/zhonglai/luhui/api/controller/login/ApiLoginController.java
0 → 100644
| 1 | +package com.zhonglai.luhui.api.controller.login; | ||
| 2 | + | ||
| 3 | +import com.ruoyi.common.constant.Constants; | ||
| 4 | +import com.ruoyi.common.core.domain.AjaxResult; | ||
| 5 | +import com.ruoyi.common.utils.StringUtils; | ||
| 6 | +import com.zhonglai.luhui.action.BaseController; | ||
| 7 | +import com.zhonglai.luhui.login.service.LoginService; | ||
| 8 | +import io.swagger.annotations.Api; | ||
| 9 | +import io.swagger.annotations.ApiImplicitParam; | ||
| 10 | +import io.swagger.annotations.ApiImplicitParams; | ||
| 11 | +import io.swagger.annotations.ApiOperation; | ||
| 12 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 13 | +import org.springframework.web.bind.annotation.PostMapping; | ||
| 14 | +import org.springframework.web.bind.annotation.RequestHeader; | ||
| 15 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 16 | +import org.springframework.web.bind.annotation.RestController; | ||
| 17 | + | ||
| 18 | +@Api(tags = "api登陆") | ||
| 19 | +@RestController | ||
| 20 | +@RequestMapping("/login/ApiLogin") | ||
| 21 | +public class ApiLoginController extends BaseController { | ||
| 22 | + public static String YU2LE_LOGIN_TOKEN_KEY = "loginToken"; //登录令牌键值 | ||
| 23 | + @Autowired | ||
| 24 | + private LoginService loginService; | ||
| 25 | + | ||
| 26 | + @ApiOperation("账号密码登陆") | ||
| 27 | + @ApiImplicitParams({ | ||
| 28 | + @ApiImplicitParam(value = "账号",name = "user"), | ||
| 29 | + @ApiImplicitParam(value = "密码",name = "pass"), | ||
| 30 | + }) | ||
| 31 | + @PostMapping("/userpassLogin") | ||
| 32 | + public AjaxResult userpassLogin(String user,String pass) | ||
| 33 | + { | ||
| 34 | + AjaxResult ajax = AjaxResult.success(); | ||
| 35 | + //生成令牌 | ||
| 36 | + String token = loginService.apiLoginByPass(user,pass); | ||
| 37 | + ajax.put(Constants.TOKEN, token); | ||
| 38 | + return ajax; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + @ApiOperation("鱼儿乐token登陆") | ||
| 42 | + @ApiImplicitParam(value = "鱼儿乐token",name = "loginToken") | ||
| 43 | + @PostMapping("/yu2leTokenLogin") | ||
| 44 | + public AjaxResult yu2leTokenLogin(@RequestHeader String loginToken) | ||
| 45 | + { | ||
| 46 | + if(StringUtils.isEmpty(loginToken)) | ||
| 47 | + { | ||
| 48 | + return AjaxResult.error("请输入鱼儿乐令牌"); | ||
| 49 | + } | ||
| 50 | + AjaxResult ajax = AjaxResult.success(); | ||
| 51 | + //生成令牌 | ||
| 52 | + String token = loginService.yu2leTokenLogin(loginToken); | ||
| 53 | + ajax.put(Constants.TOKEN, token); | ||
| 54 | + return ajax; | ||
| 55 | + } | ||
| 56 | +} |
| @@ -9,6 +9,7 @@ import com.ruoyi.common.utils.StringUtils; | @@ -9,6 +9,7 @@ import com.ruoyi.common.utils.StringUtils; | ||
| 9 | import com.ruoyi.common.utils.bean.BeanUtils; | 9 | import com.ruoyi.common.utils.bean.BeanUtils; |
| 10 | import com.zhonglai.luhui.action.BaseController; | 10 | import com.zhonglai.luhui.action.BaseController; |
| 11 | import com.zhonglai.luhui.dao.service.PublicService; | 11 | import com.zhonglai.luhui.dao.service.PublicService; |
| 12 | +import com.zhonglai.luhui.device.service.IUserTerminalGroupRelationService; | ||
| 12 | import com.zhonglai.luhui.security.utils.SecurityUtils; | 13 | import com.zhonglai.luhui.security.utils.SecurityUtils; |
| 13 | import com.zhonglai.luhui.sys.utils.ExcelUtil; | 14 | import com.zhonglai.luhui.sys.utils.ExcelUtil; |
| 14 | import io.swagger.annotations.Api; | 15 | import io.swagger.annotations.Api; |
| @@ -26,7 +27,6 @@ import com.ruoyi.common.annotation.Log; | @@ -26,7 +27,6 @@ import com.ruoyi.common.annotation.Log; | ||
| 26 | import com.ruoyi.common.core.domain.AjaxResult; | 27 | import com.ruoyi.common.core.domain.AjaxResult; |
| 27 | import com.ruoyi.common.enums.BusinessType; | 28 | import com.ruoyi.common.enums.BusinessType; |
| 28 | import com.ruoyi.system.domain.user.UserTerminalGroupRelation; | 29 | import com.ruoyi.system.domain.user.UserTerminalGroupRelation; |
| 29 | -import com.ruoyi.system.service.user.IUserTerminalGroupRelationService; | ||
| 30 | import com.ruoyi.common.core.page.TableDataInfo; | 30 | import com.ruoyi.common.core.page.TableDataInfo; |
| 31 | 31 | ||
| 32 | /** | 32 | /** |
| @@ -79,7 +79,7 @@ public class UserTerminalGroupRelationController extends BaseController | @@ -79,7 +79,7 @@ public class UserTerminalGroupRelationController extends BaseController | ||
| 79 | { | 79 | { |
| 80 | stringBuffer.append(" AND b.product_id="+product_id); | 80 | stringBuffer.append(" AND b.product_id="+product_id); |
| 81 | } | 81 | } |
| 82 | - List<Map<String,Object>> list = publicService.getObjectListBySQL("SELECT b.* FROM `user_terminal_group_relation` a LEFT JOIN `iot_terminal` b ON a.`iot_terminal_id`=b.`id` WHERE a.user_info_id="+SecurityUtils.getUserId().intValue()+stringBuffer); | 82 | + List<Map<String,Object>> list = publicService.getObjectListBySQL("SELECT b.*,a.id group_id FROM `user_terminal_group_relation` a LEFT JOIN `iot_terminal` b ON a.`iot_terminal_id`=b.`id` WHERE a.user_info_id="+SecurityUtils.getUserId().intValue()+stringBuffer); |
| 83 | return AjaxResult.success(list); | 83 | return AjaxResult.success(list); |
| 84 | } | 84 | } |
| 85 | 85 |
| 1 | -# 项目相关配置 jhlt: # 名称 name: zhonglai # 版本 version: 3.8.2 # 版权年份 copyrightYear: 2022 # 实例演示开关 demoEnabled: true # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) profile: D:/ruoyi/uploadPath # 获取ip地址开关 addressEnabled: false # 验证码类型 math 数组计算 char 字符验证 captchaType: math # 开发环境配置 server: # 服务器的HTTP端口,默认为8080 port: 18080 servlet: # 应用的访问路径 context-path: / tomcat: # tomcat的URI编码 uri-encoding: UTF-8 # 连接数满后的排队数,默认为100 accept-count: 1000 threads: # tomcat最大线程数,默认为200 max: 800 # Tomcat启动初始化的线程数,默认值10 min-spare: 100 # 日志配置 logging: level: com.ruoyi: debug org.springframework: warn # Spring配置 spring: # 资源信息 messages: # 国际化资源文件路径 basename: i18n/messages profiles: active: druid # 文件上传 servlet: multipart: # 单个文件大小 max-file-size: 10MB # 设置总上传的文件大小 max-request-size: 20MB # 服务模块 devtools: restart: # 热部署开关 enabled: true # redis 配置 redis: # 地址 host: 47.112.163.61 # 端口,默认为6379 port: 9527 # 数据库索引 database: 1 # 密码 password: Luhui586 # 连接超时时间 timeout: 10s lettuce: pool: # 连接池中的最小空闲连接 min-idle: 0 # 连接池中的最大空闲连接 max-idle: 8 # 连接池的最大数据库连接数 max-active: 8 # #连接池最大阻塞等待时间(使用负值表示没有限制) max-wait: -1ms # token配置 token: # 令牌自定义标识 header: Authorization # 令牌密钥 secret: abcdefghijklmnopqrstuvwxyz # 令牌有效期(默认30分钟) expireTime: 1440 rediskey: lh-api # MyBatis配置 mybatis: # 搜索指定包别名 typeAliasesPackage: com.ruoyi.**.domain # 配置mapper的扫描,找到所有的mapper.xml映射文件 mapperLocations: classpath*:mapper/**/*Mapper.xml # 加载全局的配置文件 configLocation: classpath:mybatis/mybatis-config.xml # PageHelper分页插件 pagehelper: helperDialect: mysql supportMethodsArguments: true params: count=countSql # Swagger配置 swagger: # 是否开启swagger enabled: true # 请求前缀 pathMapping: /dev-api # 防止XSS攻击 xss: # 过滤开关 enabled: true # 排除链接(多个用逗号分隔) excludes: /system/notice # 匹配链接 urlPatterns: /system/*,/monitor/*,/tool/* mqtt: client: device_life: 180 sys: ## // 对于登录login 注册register 验证码captchaImage 允许匿名访问 antMatchers: /login/ApiLogin/* # NameServer地址 rocketmq: name-server: 47.115.144.179:9876 # 默认的消息组 producer: group: deviceCommand send-message-timeout: 30000 send-topic: lh-api-test send-tags: 1 | ||
| 1 | +# 项目相关配置 jhlt: # 名称 name: zhonglai # 版本 version: 3.8.2 # 版权年份 copyrightYear: 2022 # 实例演示开关 demoEnabled: true # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) profile: D:/ruoyi/uploadPath # 获取ip地址开关 addressEnabled: false # 验证码类型 math 数组计算 char 字符验证 captchaType: math # 开发环境配置 server: # 服务器的HTTP端口,默认为8080 port: 18080 servlet: # 应用的访问路径 context-path: / tomcat: # tomcat的URI编码 uri-encoding: UTF-8 # 连接数满后的排队数,默认为100 accept-count: 1000 threads: # tomcat最大线程数,默认为200 max: 800 # Tomcat启动初始化的线程数,默认值10 min-spare: 100 # 日志配置 logging: level: com.ruoyi: debug org.springframework: warn # Spring配置 spring: # 资源信息 messages: # 国际化资源文件路径 basename: i18n/messages profiles: active: druid # 文件上传 servlet: multipart: # 单个文件大小 max-file-size: 10MB # 设置总上传的文件大小 max-request-size: 20MB # 服务模块 devtools: restart: # 热部署开关 enabled: true # redis 配置 redis: # 地址 host: 47.112.163.61 # 端口,默认为6379 port: 9527 # 数据库索引 database: 1 # 密码 password: Luhui586 # 连接超时时间 timeout: 10s lettuce: pool: # 连接池中的最小空闲连接 min-idle: 0 # 连接池中的最大空闲连接 max-idle: 8 # 连接池的最大数据库连接数 max-active: 8 # #连接池最大阻塞等待时间(使用负值表示没有限制) max-wait: -1ms # token配置 token: # 令牌自定义标识 header: Authorization # 令牌密钥 secret: abcdefghijklmnopqrstuvwxyz # 令牌有效期(默认30分钟) expireTime: 1440 rediskey: lh-api # MyBatis配置 mybatis: # 搜索指定包别名 typeAliasesPackage: com.ruoyi.**.domain,com.zhonglai.**.domain # 配置mapper的扫描,找到所有的mapper.xml映射文件 mapperLocations: classpath*:mapper/**/*Mapper.xml # 加载全局的配置文件 configLocation: classpath:mybatis/mybatis-config.xml # PageHelper分页插件 pagehelper: helperDialect: mysql supportMethodsArguments: true params: count=countSql # Swagger配置 swagger: # 是否开启swagger enabled: true # 请求前缀 pathMapping: /dev-api # 防止XSS攻击 xss: # 过滤开关 enabled: true # 排除链接(多个用逗号分隔) excludes: /system/notice # 匹配链接 urlPatterns: /system/*,/monitor/*,/tool/* mqtt: client: device_life: 180 sys: ## // 对于登录login 注册register 验证码captchaImage 允许匿名访问 antMatchers: /login/ApiLogin/* # NameServer地址 rocketmq: name-server: 47.115.144.179:9876 # 默认的消息组 producer: group: deviceCommand send-message-timeout: 30000 send-topic: lh-mqtt-service-deviceCommand-test send-tags: 1 |
| @@ -85,6 +85,10 @@ | @@ -85,6 +85,10 @@ | ||
| 85 | <groupId>org.aspectj</groupId> | 85 | <groupId>org.aspectj</groupId> |
| 86 | <artifactId>aspectjrt</artifactId> | 86 | <artifactId>aspectjrt</artifactId> |
| 87 | </dependency> | 87 | </dependency> |
| 88 | + <dependency> | ||
| 89 | + <groupId>com.zhonglai.luhui</groupId> | ||
| 90 | + <artifactId>lh-public-dao</artifactId> | ||
| 91 | + </dependency> | ||
| 88 | 92 | ||
| 89 | </dependencies> | 93 | </dependencies> |
| 90 | 94 |
| @@ -7,6 +7,7 @@ import com.ruoyi.common.exception.user.CaptchaExpireException; | @@ -7,6 +7,7 @@ import com.ruoyi.common.exception.user.CaptchaExpireException; | ||
| 7 | import com.ruoyi.common.exception.user.UserPasswordNotMatchException; | 7 | import com.ruoyi.common.exception.user.UserPasswordNotMatchException; |
| 8 | import com.ruoyi.common.utils.*; | 8 | import com.ruoyi.common.utils.*; |
| 9 | import com.ruoyi.common.utils.ip.IpUtils; | 9 | import com.ruoyi.common.utils.ip.IpUtils; |
| 10 | +import com.ruoyi.common.utils.spring.SpringUtils; | ||
| 10 | import com.ruoyi.system.domain.entity.SysUser; | 11 | import com.ruoyi.system.domain.entity.SysUser; |
| 11 | import com.ruoyi.common.tool.SysLogininforType; | 12 | import com.ruoyi.common.tool.SysLogininforType; |
| 12 | import com.zhonglai.luhui.dao.service.PublicService; | 13 | import com.zhonglai.luhui.dao.service.PublicService; |
| @@ -42,10 +43,6 @@ public class LoginService { | @@ -42,10 +43,6 @@ public class LoginService { | ||
| 42 | @Autowired | 43 | @Autowired |
| 43 | private ISysUserService sysUserService; | 44 | private ISysUserService sysUserService; |
| 44 | 45 | ||
| 45 | - @Autowired | ||
| 46 | - private AdminConfigurerAdapter adminConfigurerAdapter; | ||
| 47 | - @Autowired | ||
| 48 | - private ApiConfigurerAdapter apiConfigurerAdapter; | ||
| 49 | 46 | ||
| 50 | /** | 47 | /** |
| 51 | * 管理员用户名密码登录验证 | 48 | * 管理员用户名密码登录验证 |
| @@ -59,7 +56,7 @@ public class LoginService { | @@ -59,7 +56,7 @@ public class LoginService { | ||
| 59 | public String sysUserLogin(String username, String password, String code, String uuid) | 56 | public String sysUserLogin(String username, String password, String code, String uuid) |
| 60 | { | 57 | { |
| 61 | // 用户验证 | 58 | // 用户验证 |
| 62 | - Authentication authentication = userPasswordVerification(username,password,adminConfigurerAdapter); | 59 | + Authentication authentication = userPasswordVerification(username,password, SpringUtils.getBean("adminConfigurerAdapter")); |
| 63 | AsyncManager.me().execute(AsyncFactory.recordLogininfor(username,SysLogininforType.lhAdmin, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); | 60 | AsyncManager.me().execute(AsyncFactory.recordLogininfor(username,SysLogininforType.lhAdmin, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); |
| 64 | SysLoginUser loginUser = (SysLoginUser) authentication.getPrincipal(); | 61 | SysLoginUser loginUser = (SysLoginUser) authentication.getPrincipal(); |
| 65 | loginUser.setSysLogininforType(SysLogininforType.lhAdmin); | 62 | loginUser.setSysLogininforType(SysLogininforType.lhAdmin); |
| @@ -76,7 +73,7 @@ public class LoginService { | @@ -76,7 +73,7 @@ public class LoginService { | ||
| 76 | */ | 73 | */ |
| 77 | public String apiLoginByPass(String user,String pass) { | 74 | public String apiLoginByPass(String user,String pass) { |
| 78 | // 用户验证 | 75 | // 用户验证 |
| 79 | - Authentication authentication = userPasswordVerification(user,pass,apiConfigurerAdapter); | 76 | + Authentication authentication = userPasswordVerification(user,pass,SpringUtils.getBean("apiConfigurerAdapter")); |
| 80 | AsyncManager.me().execute(AsyncFactory.recordLogininfor(user, SysLogininforType.lhApi, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); | 77 | AsyncManager.me().execute(AsyncFactory.recordLogininfor(user, SysLogininforType.lhApi, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); |
| 81 | ApiLoginUser loginUser = (ApiLoginUser) authentication.getPrincipal(); | 78 | ApiLoginUser loginUser = (ApiLoginUser) authentication.getPrincipal(); |
| 82 | loginUser.setSysLogininforType(SysLogininforType.lhApi); | 79 | loginUser.setSysLogininforType(SysLogininforType.lhApi); |
| @@ -90,7 +87,7 @@ public class LoginService { | @@ -90,7 +87,7 @@ public class LoginService { | ||
| 90 | 87 | ||
| 91 | public String openaiLoginByPass(String user,String pass) { | 88 | public String openaiLoginByPass(String user,String pass) { |
| 92 | // 用户验证 | 89 | // 用户验证 |
| 93 | - Authentication authentication = userPasswordVerification(user,pass,apiConfigurerAdapter); | 90 | + Authentication authentication = userPasswordVerification(user,pass,SpringUtils.getBean("apiConfigurerAdapter")); |
| 94 | AsyncManager.me().execute(AsyncFactory.recordLogininfor(user, SysLogininforType.openAi, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); | 91 | AsyncManager.me().execute(AsyncFactory.recordLogininfor(user, SysLogininforType.openAi, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); |
| 95 | OpenAiLoginUser loginUser = (OpenAiLoginUser) authentication.getPrincipal(); | 92 | OpenAiLoginUser loginUser = (OpenAiLoginUser) authentication.getPrincipal(); |
| 96 | loginUser.setSysLogininforType(SysLogininforType.openAi); | 93 | loginUser.setSysLogininforType(SysLogininforType.openAi); |
| 1 | +import cn.hutool.crypto.digest.DigestAlgorithm; | ||
| 2 | +import cn.hutool.crypto.digest.Digester; | ||
| 3 | +import org.apache.commons.io.input.ReversedLinesFileReader; | ||
| 4 | + | ||
| 5 | +import java.io.*; | ||
| 6 | +import java.security.MessageDigest; | ||
| 7 | +import java.security.NoSuchAlgorithmException; | ||
| 8 | +import java.util.concurrent.ExecutorService; | ||
| 9 | +import java.util.concurrent.Executors; | ||
| 10 | + | ||
| 11 | +public class TestMain { | ||
| 12 | + private static final String SALT = "gU.Rm9YI"; | ||
| 13 | + private static final String ALPHABET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; | ||
| 14 | + private static final int PASSWORD_LENGTH = 6; // 设置密码长度 | ||
| 15 | + | ||
| 16 | + private static final int BUFFER_SIZE = 8192; // 缓冲区大小 | ||
| 17 | + private static final int NUM_THREADS = 100; // 线程数 | ||
| 18 | + | ||
| 19 | + public static void main(String[] args) { | ||
| 20 | +// String filePath = "E:/工作/28GB超大密码字典_28GBwordlist.txt"; | ||
| 21 | +// | ||
| 22 | +// try { | ||
| 23 | +// readFromFile(filePath); | ||
| 24 | +// } catch (IOException e) { | ||
| 25 | +// e.printStackTrace(); | ||
| 26 | +// } | ||
| 27 | + Digester md5 = new Digester(DigestAlgorithm.SHA512); | ||
| 28 | + md5.setSalt("gU.Rm9YI".getBytes()); | ||
| 29 | + String digestHex = md5.digestHex("Luhui586"); | ||
| 30 | + System.out.println(digestHex); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + private static void readFromFile(String filePath) throws IOException { | ||
| 34 | + ExecutorService executorService = Executors.newFixedThreadPool(NUM_THREADS); | ||
| 35 | + | ||
| 36 | + try (FileReader fileReader = new FileReader(filePath); | ||
| 37 | + BufferedReader bufferedReader = new BufferedReader(fileReader, BUFFER_SIZE)) { | ||
| 38 | + | ||
| 39 | + String line; | ||
| 40 | + long lineNumber = 0; | ||
| 41 | + | ||
| 42 | + while ((line = bufferedReader.readLine()) != null) { | ||
| 43 | + lineNumber++; | ||
| 44 | + | ||
| 45 | + // 并行处理每一行数据 | ||
| 46 | + final String currentLine = line; | ||
| 47 | + final long currentLineNumber = lineNumber; | ||
| 48 | + executorService.submit(() -> processLine(currentLine, currentLineNumber)); | ||
| 49 | + } | ||
| 50 | + } finally { | ||
| 51 | + executorService.shutdown(); | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + private static void processLine(String line, long lineNumber) { | ||
| 56 | + // 在这里处理每一行数据的逻辑 | ||
| 57 | + String text = line; | ||
| 58 | + // 第一种:创建Digester对象,执行加密 | ||
| 59 | + Digester md5 = new Digester(DigestAlgorithm.SHA512); | ||
| 60 | + md5.setSalt("gU.Rm9YI".getBytes()); | ||
| 61 | + String digestHex = md5.digestHex(text); | ||
| 62 | +// System.out.println(digestHex); | ||
| 63 | + if("bFKi1LTbejFr5zng5hrJtnTcmalZn8L3H7YMahtTWIqQYFW6CmvRg7yv8aeb8CUygje0dqpC6lEZ8Xx9GFR9g".equals(digestHex)) | ||
| 64 | + { | ||
| 65 | + System.out.println("Line " + lineNumber + ": " + line); | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | +} |
-
请 注册 或 登录 后发表评论