diff --git a/src/main/java/com/wang/config/shiro/jwt/JwtFilter.java b/src/main/java/com/wang/config/shiro/jwt/JwtFilter.java index 18398fc..85ccbcf 100644 --- a/src/main/java/com/wang/config/shiro/jwt/JwtFilter.java +++ b/src/main/java/com/wang/config/shiro/jwt/JwtFilter.java @@ -56,7 +56,6 @@ protected boolean isAccessAllowed(ServletRequest request, ServletResponse respon Throwable throwable = e.getCause(); if(throwable != null && throwable instanceof SignatureVerificationException ){ // 该异常为JWT的AccessToken认证失败(Token或者密钥不正确) - // throw (SignatureVerificationException) throwable; msg = "Token或者密钥不正确(" + throwable.getMessage() + ")"; } else if(throwable != null && throwable instanceof TokenExpiredException){ // 该异常为JWT的AccessToken已过期,判断RefreshToken未过期就进行AccessToken刷新 diff --git a/src/main/java/com/wang/controller/UserController.java b/src/main/java/com/wang/controller/UserController.java index 12ffb0c..4328bbe 100644 --- a/src/main/java/com/wang/controller/UserController.java +++ b/src/main/java/com/wang/controller/UserController.java @@ -210,7 +210,7 @@ public ResponseBean add(@Validated(UserEditValidGroup.class) @RequestBody UserDt } userDto.setRegTime(new Date()); // 密码以帐号+密码的形式进行AES加密 - if(userDto.getPassword().length() > 8){ + if(userDto.getPassword().length() > Constant.PASSWORD_MAX_LEN){ throw new CustomException("密码最多8位(Password up to 8 bits.)"); } String key = AesCipherUtil.enCrypto(userDto.getAccount() + userDto.getPassword()); @@ -244,7 +244,7 @@ public ResponseBean update(@Validated(UserEditValidGroup.class) @RequestBody Use // FIXME: 如果不一样就说明用户修改了密码,重新加密密码(这个处理不太好,但是没有想到好的处理方式) if(!userDtoTemp.getPassword().equals(userDto.getPassword())){ // 密码以帐号+密码的形式进行AES加密 - if(userDto.getPassword().length() > 8){ + if(userDto.getPassword().length() > Constant.PASSWORD_MAX_LEN){ throw new CustomException("密码最多8位(Password up to 8 bits.)"); } String key = AesCipherUtil.enCrypto(userDto.getAccount() + userDto.getPassword()); diff --git a/src/main/java/com/wang/model/common/Constant.java b/src/main/java/com/wang/model/common/Constant.java index 6e5cd75..0f18f5c 100644 --- a/src/main/java/com/wang/model/common/Constant.java +++ b/src/main/java/com/wang/model/common/Constant.java @@ -6,15 +6,6 @@ * @date 2018/9/3 16:03 */ public class Constant { - /** - * 1 - */ - public static final Integer INTEGER_1 = 1; - - /** - * 2 - */ - public static final Integer INTEGER_2 = 2; /** * redis-OK @@ -61,4 +52,9 @@ public class Constant { */ public final static String CURRENT_TIME_MILLIS = "currentTimeMillis"; + /** + * PASSWORD_MAX_LEN + */ + public static final Integer PASSWORD_MAX_LEN = 8; + } diff --git a/src/main/java/com/wang/util/JwtUtil.java b/src/main/java/com/wang/util/JwtUtil.java index 756adc6..1f922f0 100644 --- a/src/main/java/com/wang/util/JwtUtil.java +++ b/src/main/java/com/wang/util/JwtUtil.java @@ -26,7 +26,6 @@ public class JwtUtil { * 过期时间改为从配置文件获取 */ private static String accessTokenExpireTime; - // private static final long EXPIRE_TIME = 5 * 60 * 1000; /** * JWT认证加密私钥(Base64加密) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 590ce58..125a417 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -25,7 +25,6 @@ spring: maxOpenPreparedStatements: 20 mybatis: - config-location: classpath:mybatis-config.xml mapper-locations: classpath:mapper/*.xml type-aliases-package: com.wang.model.entity @@ -37,9 +36,6 @@ pagehelper: mapper: not-empty: true -# mappers: -# - tk.mybatis.mapper.common.Mapper -# - tk.mybatis.mapper.common.Mapper2 logging: level.com.wang.mapper: debug \ No newline at end of file diff --git a/src/main/resources/mybatis-config.xml b/src/main/resources/mybatis-config.xml deleted file mode 100644 index a41c93f..0000000 --- a/src/main/resources/mybatis-config.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/sql/MySQL.sql b/src/main/resources/sql/MySQL.sql index 106b141..05e7c40 100644 --- a/src/main/resources/sql/MySQL.sql +++ b/src/main/resources/sql/MySQL.sql @@ -15,17 +15,13 @@ reg_time datetime not null COMMENT "注册时间" CREATE TABLE role ( id int primary key auto_increment COMMENT "ID", name varchar(128) not null unique COMMENT "角色名称" -/*available int COMMENT '是否可用 1-可用 0-不可用'*/ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT "角色表"; CREATE TABLE permission ( id int primary key auto_increment COMMENT "ID", name varchar(128) COMMENT '资源名称', -/*type varchar(32) COMMENT '资源类型:menu,permission,button', -url varchar(128) COMMENT '访问url地址',*/ per_code varchar(128) not null unique COMMENT '权限代码字符串' -/*available int COMMENT '是否可用 1-可用 0-不可用'*/ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT "资源表"; CREATE TABLE user_role (