Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6ed2b8037 | ||
|
|
02c2ccc0ff |
18
pom.xml
18
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.3</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>springboot-parent</name>
|
<name>springboot-parent</name>
|
||||||
<description>杭州铁晟科技有限公司基础依赖</description>
|
<description>杭州铁晟科技有限公司基础依赖</description>
|
||||||
@@ -58,49 +58,49 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-database</artifactId>
|
<artifactId>springboot-database</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-login</artifactId>
|
<artifactId>springboot-login</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-web</artifactId>
|
<artifactId>springboot-web</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-platform</artifactId>
|
<artifactId>springboot-platform</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-message</artifactId>
|
<artifactId>springboot-message</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-role</artifactId>
|
<artifactId>springboot-role</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-annotation</artifactId>
|
<artifactId>springboot-annotation</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-ademo</artifactId>
|
<artifactId>springboot-ademo</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.3</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.tiesheng.demo.controller;
|
package com.tiesheng.demo.controller;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.date.TimeInterval;
|
import cn.hutool.core.date.TimeInterval;
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
@@ -30,11 +29,13 @@ import com.tiesheng.web.service.CoreLogService;
|
|||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,7 +73,9 @@ public class TestController {
|
|||||||
@RequestMapping("/redirect")
|
@RequestMapping("/redirect")
|
||||||
@TokenIgnore
|
@TokenIgnore
|
||||||
@RoleAuthority("redirect")
|
@RoleAuthority("redirect")
|
||||||
public ApiResp<JsonTest> redirect(@RequestBody JsonTest dto, HttpServletResponse response) {
|
public ApiResp<JsonTest> redirect(HttpServletResponse response) {
|
||||||
|
|
||||||
|
encryptConfig.passwdCreate("111111@Zz", "");
|
||||||
|
|
||||||
JsonTest jsonTest = new JsonTest();
|
JsonTest jsonTest = new JsonTest();
|
||||||
jsonTest.setNow(DateUtil.date());
|
jsonTest.setNow(DateUtil.date());
|
||||||
@@ -81,8 +84,6 @@ public class TestController {
|
|||||||
String jsonString = JSON.toJSONString(jsonTest);
|
String jsonString = JSON.toJSONString(jsonTest);
|
||||||
LogFactory.get().info(jsonString);
|
LogFactory.get().info(jsonString);
|
||||||
|
|
||||||
LogFactory.get().info(JSON.toJSONString(dto));
|
|
||||||
|
|
||||||
// ArrayList<String> strings = CollUtil.newArrayList("11111", "22222");
|
// ArrayList<String> strings = CollUtil.newArrayList("11111", "22222");
|
||||||
// coreLogService.addProcess("fdfd", strings, new ProcessImportConsumer<String>() {
|
// coreLogService.addProcess("fdfd", strings, new ProcessImportConsumer<String>() {
|
||||||
// @Override
|
// @Override
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-annotation</artifactId>
|
<artifactId>springboot-annotation</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-database</artifactId>
|
<artifactId>springboot-database</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-login</artifactId>
|
<artifactId>springboot-login</artifactId>
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import com.tiesheng.util.service.TsCacheService;
|
|||||||
import com.tiesheng.util.service.TsServiceBase;
|
import com.tiesheng.util.service.TsServiceBase;
|
||||||
import com.tiesheng.util.service.role.TsAuthorityHandler;
|
import com.tiesheng.util.service.role.TsAuthorityHandler;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@@ -36,7 +35,12 @@ public class CorePlatformUniqueService extends TsServiceBase<CorePlatformUniqueM
|
|||||||
TsLoginConfigurer tsLoginConfigurer;
|
TsLoginConfigurer tsLoginConfigurer;
|
||||||
|
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
/**
|
||||||
|
* 登录操作
|
||||||
|
*
|
||||||
|
* @param loginInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public TokenBean login(DoLoginInfo loginInfo) {
|
public TokenBean login(DoLoginInfo loginInfo) {
|
||||||
|
|
||||||
int loginErrorTimes = coreLogLoginMapper.getLoginErrorTimes(loginInfo.getLoginIp());
|
int loginErrorTimes = coreLogLoginMapper.getLoginErrorTimes(loginInfo.getLoginIp());
|
||||||
@@ -70,8 +74,7 @@ public class CorePlatformUniqueService extends TsServiceBase<CorePlatformUniqueM
|
|||||||
|
|
||||||
// 更新唯一值
|
// 更新唯一值
|
||||||
String oldUserId = platformUnique.getUserId();
|
String oldUserId = platformUnique.getUserId();
|
||||||
if (!StrUtil.isEmpty(tokenBean.getId()) &&
|
if (!Objects.equals(oldUserId, tokenBean.getId())) {
|
||||||
!Objects.equals(oldUserId, tokenBean.getId())) {
|
|
||||||
platformUnique.setUserId(tokenBean.getId());
|
platformUnique.setUserId(tokenBean.getId());
|
||||||
saveOrUpdate(platformUnique);
|
saveOrUpdate(platformUnique);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,11 @@
|
|||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="getLoginErrorTimes" resultType="int">
|
<select id="getLoginErrorTimes" resultType="int">
|
||||||
select count(1)
|
select count(1)
|
||||||
from core_log_login
|
from core_log_login
|
||||||
where ip = #{ip}
|
where ip = #{ip}
|
||||||
and create_time > date_add(now(), interval -10 minute)
|
and result = 0
|
||||||
|
and create_time > date_add(now(), interval -10 minute)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-message</artifactId>
|
<artifactId>springboot-message</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-platform</artifactId>
|
<artifactId>springboot-platform</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-role</artifactId>
|
<artifactId>springboot-role</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public class EncryptConfig {
|
|||||||
private String key = "WmdUzPJXbngVNiaSsQrihg==";
|
private String key = "WmdUzPJXbngVNiaSsQrihg==";
|
||||||
private Integer saltSize = 8;
|
private Integer saltSize = 8;
|
||||||
private boolean body = false;
|
private boolean body = false;
|
||||||
|
private String pwdPatten = "^(?![A-Za-z0-9]+$)(?![a-z0-9\\W]+$)(?![A-Za-z\\W]+$)(?![A-Z0-9\\W]+$)[a-zA-Z0-9\\W]{8,}$";
|
||||||
|
|
||||||
public EncryptConfig() {
|
public EncryptConfig() {
|
||||||
sm4 = SmUtil.sm4(Base64.decode(getKey()));
|
sm4 = SmUtil.sm4(Base64.decode(getKey()));
|
||||||
@@ -73,25 +74,13 @@ public class EncryptConfig {
|
|||||||
if (StrUtil.isEmpty(salt) || StrUtil.length(salt) != getSaltSize()) {
|
if (StrUtil.isEmpty(salt) || StrUtil.length(salt) != getSaltSize()) {
|
||||||
salt = RandomUtil.randomString(saltSize);
|
salt = RandomUtil.randomString(saltSize);
|
||||||
}
|
}
|
||||||
if (!passwdComplexity(inputPasswd)) {
|
if (!inputPasswd.matches(getPwdPatten())) {
|
||||||
throw new ApiException("需要包含数字、大小写字母、特殊符号,且长度不低于8位");
|
throw new ApiException("密码复杂度不够,请重新设置");
|
||||||
}
|
}
|
||||||
return encrypt(salt + SecureUtil.sha1(salt + inputPasswd));
|
return encrypt(salt + SecureUtil.sha1(salt + inputPasswd));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 复杂度校验
|
|
||||||
*
|
|
||||||
* @param inputPasswd
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean passwdComplexity(String inputPasswd) {
|
|
||||||
String password = "^(?![A-Za-z0-9]+$)(?![a-z0-9\\W]+$)(?![A-Za-z\\W]+$)(?![A-Z0-9\\W]+$)[a-zA-Z0-9\\W]{8,}$";
|
|
||||||
return inputPasswd.matches(password);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 密码校验
|
* 密码校验
|
||||||
*
|
*
|
||||||
@@ -133,4 +122,12 @@ public class EncryptConfig {
|
|||||||
public void setBody(boolean body) {
|
public void setBody(boolean body) {
|
||||||
this.body = body;
|
this.body = body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPwdPatten() {
|
||||||
|
return pwdPatten;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPwdPatten(String pwdPatten) {
|
||||||
|
this.pwdPatten = pwdPatten;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-web</artifactId>
|
<artifactId>springboot-web</artifactId>
|
||||||
|
|||||||
Reference in New Issue
Block a user