From 84c03cacd5b140f15fdf8cd1eb15bc066684a4d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BB=96=E9=87=91=E9=BE=99?= Date: Wed, 10 Jun 2020 19:10:00 +0800 Subject: [PATCH] =?UTF-8?q?#=20warn=EF=BC=9A=20=E4=BF=AE=E6=94=B9=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6=201=E3=80=81=E4=BF=AE=E6=94=B9=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BF=A1=E6=81=AF=20=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=202=E3=80=81=E8=B0=83=E6=95=B4=E5=8E=9F?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=A0=81=20=E7=9B=B8=E5=85=B3=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E4=BF=A1=E6=81=AF=203=E3=80=81=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=A4=9A=E7=A7=8D=E9=AA=8C=E8=AF=81=E7=A0=81=20=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exception/BadConfigurationException.java | 98 ++++++++++++++++ .../config/ConfigBeanConfiguration.java | 42 +++++++ .../security/config/bean/LoginCode.java | 85 ++++++++++++++ .../security/config/bean/LoginCodeEnum.java | 43 +++++++ .../security/config/bean/LoginProperties.java | 109 ++++++++++++++++++ .../config/{ => bean}/SecurityProperties.java | 37 ++++-- .../rest/AuthorizationController.java | 22 ++-- .../security/security/TokenFilter.java | 2 +- .../security/security/TokenProvider.java | 2 +- .../security/service/OnlineUserService.java | 2 +- .../main/resources/config/application-dev.yml | 21 +++- .../resources/config/application-prod.yml | 21 +++- .../src/main/resources/config/application.yml | 21 +++- 13 files changed, 466 insertions(+), 39 deletions(-) create mode 100644 eladmin-common/src/main/java/me/zhengjie/exception/BadConfigurationException.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/security/config/ConfigBeanConfiguration.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginCode.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginCodeEnum.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginProperties.java rename eladmin-system/src/main/java/me/zhengjie/modules/security/config/{ => bean}/SecurityProperties.java (69%) diff --git a/eladmin-common/src/main/java/me/zhengjie/exception/BadConfigurationException.java b/eladmin-common/src/main/java/me/zhengjie/exception/BadConfigurationException.java new file mode 100644 index 00000000..ede3691f --- /dev/null +++ b/eladmin-common/src/main/java/me/zhengjie/exception/BadConfigurationException.java @@ -0,0 +1,98 @@ +/* + * Copyright 2019-2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package me.zhengjie.exception; + +/** + * 统一关于错误配置信息 异常 + * + * @author: liaojinlong + * @date: 2020/6/10 18:06 + */ +public class BadConfigurationException extends RuntimeException { + /** + * Constructs a new runtime exception with {@code null} as its + * detail message. The cause is not initialized, and may subsequently be + * initialized by a call to {@link #initCause}. + */ + public BadConfigurationException() { + super(); + } + + /** + * Constructs a new runtime exception with the specified detail message. + * The cause is not initialized, and may subsequently be initialized by a + * call to {@link #initCause}. + * + * @param message the detail message. The detail message is saved for + * later retrieval by the {@link #getMessage()} method. + */ + public BadConfigurationException(String message) { + super(message); + } + + /** + * Constructs a new runtime exception with the specified detail message and + * cause.

Note that the detail message associated with + * {@code cause} is not automatically incorporated in + * this runtime exception's detail message. + * + * @param message the detail message (which is saved for later retrieval + * by the {@link #getMessage()} method). + * @param cause the cause (which is saved for later retrieval by the + * {@link #getCause()} method). (A {@code null} value is + * permitted, and indicates that the cause is nonexistent or + * unknown.) + * @since 1.4 + */ + public BadConfigurationException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Constructs a new runtime exception with the specified cause and a + * detail message of {@code (cause==null ? null : cause.toString())} + * (which typically contains the class and detail message of + * {@code cause}). This constructor is useful for runtime exceptions + * that are little more than wrappers for other throwables. + * + * @param cause the cause (which is saved for later retrieval by the + * {@link #getCause()} method). (A {@code null} value is + * permitted, and indicates that the cause is nonexistent or + * unknown.) + * @since 1.4 + */ + public BadConfigurationException(Throwable cause) { + super(cause); + } + + /** + * Constructs a new runtime exception with the specified detail + * message, cause, suppression enabled or disabled, and writable + * stack trace enabled or disabled. + * + * @param message the detail message. + * @param cause the cause. (A {@code null} value is permitted, + * and indicates that the cause is nonexistent or unknown.) + * @param enableSuppression whether or not suppression is enabled + * or disabled + * @param writableStackTrace whether or not the stack trace should + * be writable + * @since 1.7 + */ + protected BadConfigurationException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/security/config/ConfigBeanConfiguration.java b/eladmin-system/src/main/java/me/zhengjie/modules/security/config/ConfigBeanConfiguration.java new file mode 100644 index 00000000..78a1bd20 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/security/config/ConfigBeanConfiguration.java @@ -0,0 +1,42 @@ +/* + * Copyright 2019-2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package me.zhengjie.modules.security.config; + +import me.zhengjie.modules.security.config.bean.LoginProperties; +import me.zhengjie.modules.security.config.bean.SecurityProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @apiNote 配置文件转换Pojo类的 统一配置 类 + * @author: liaojinlong + * @date: 2020/6/10 19:04 + */ +@Configuration +public class ConfigBeanConfiguration { + @Bean + @ConfigurationProperties(prefix = "login", ignoreUnknownFields = true) + public LoginProperties loginProperties() { + return new LoginProperties(); + } + + @Bean + @ConfigurationProperties(prefix = "jwt", ignoreUnknownFields = true) + public SecurityProperties securityProperties() { + return new SecurityProperties(); + } +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginCode.java b/eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginCode.java new file mode 100644 index 00000000..a27fe710 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginCode.java @@ -0,0 +1,85 @@ +/* + * Copyright 2019-2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package me.zhengjie.modules.security.config.bean; + +/** + * 登录验证码配置信息 + * + * @author: liaojinlong + * @date: 2020/6/10 18:53 + */ +public class LoginCode { + /** + * 验证码配置 + */ + private LoginCodeEnum codeType; + /** + * 验证码有效期 分钟 + */ + private Long expiration = 2L; + /** + * 验证码内容长度 + */ + private int length = 2; + /** + * 验证码宽度 + */ + private int width = 111; + /** + * 验证码高度 + */ + private int height = 36; + + public LoginCodeEnum getCodeType() { + return codeType; + } + + public void setCodeType(LoginCodeEnum codeType) { + this.codeType = codeType; + } + + public Long getExpiration() { + return expiration; + } + + public void setExpiration(Long expiration) { + this.expiration = expiration; + } + + public int getLength() { + return length; + } + + public void setLength(int length) { + this.length = length; + } + + public int getWidth() { + return width; + } + + public void setWidth(int width) { + this.width = width; + } + + public int getHeight() { + return height; + } + + public void setHeight(int height) { + this.height = height; + } +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginCodeEnum.java b/eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginCodeEnum.java new file mode 100644 index 00000000..9ff398f2 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginCodeEnum.java @@ -0,0 +1,43 @@ +/* + * Copyright 2019-2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package me.zhengjie.modules.security.config.bean; + +/** + * 验证码配置枚举 + * + * @author: liaojinlong + * @date: 2020/6/10 17:40 + */ + +public enum LoginCodeEnum { + /** + * 算数 + */ + arithmetic, + /** + * 中文 + */ + chinese, + /** + * 中文闪图 + */ + chinese_gif, + /** + * 闪图 + */ + gif, + spec +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginProperties.java b/eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginProperties.java new file mode 100644 index 00000000..48f05ad0 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/LoginProperties.java @@ -0,0 +1,109 @@ +/* + * Copyright 2019-2020 the original author or authors. + * + * Licensed under the Apache License, Version loginCode.length.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-loginCode.length.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package me.zhengjie.modules.security.config.bean; + + +import com.wf.captcha.*; +import com.wf.captcha.base.Captcha; +import me.zhengjie.exception.BadConfigurationException; + +import java.util.Objects; + +/** + * 配置文件读取 + * + * @author: liaojinlong + * @date: loginCode.length0loginCode.length0/6/10 17:loginCode.length6 + */ +public class LoginProperties { + + /** + * 账号单用户 登录 + */ + private boolean singleLogin = false; + + private LoginCode loginCode; + + public boolean isSingleLogin() { + return singleLogin; + } + + public void setSingleLogin(boolean singleLogin) { + this.singleLogin = singleLogin; + } + + public LoginCode getLoginCode() { + return loginCode; + } + + public void setLoginCode(LoginCode loginCode) { + this.loginCode = loginCode; + } + + /** + * 获取验证码生产类 + * + * @return / + */ + public Captcha getCaptcha() { + if (Objects.isNull(loginCode)) { + loginCode = new LoginCode(); + if (Objects.isNull(loginCode.getCodeType())) { + loginCode.setCodeType(LoginCodeEnum.arithmetic); + } + } + Captcha captcha = switchCaptcha(loginCode); + return captcha; + } + + /** + * 依据配置信息生产验证码 + * + * @param loginCode 验证码配置信息 + * @return / + */ + private Captcha switchCaptcha(LoginCode loginCode) { + Captcha captcha; + synchronized (this) { + switch (loginCode.getCodeType()) { + case arithmetic: + // 算术类型 https://gitee.com/whvse/EasyCaptcha + captcha = new ArithmeticCaptcha(loginCode.getWidth(), loginCode.getHeight()); + // 几位数运算,默认是两位 + captcha.setLen(loginCode.getLength()); + break; + case chinese: + captcha = new ChineseCaptcha(loginCode.getWidth(), loginCode.getHeight()); + captcha.setLen(loginCode.getLength()); + break; + case chinese_gif: + captcha = new ChineseGifCaptcha(loginCode.getWidth(), loginCode.getHeight()); + captcha.setLen(loginCode.getLength()); + break; + case gif: + captcha = new GifCaptcha(loginCode.getWidth(), loginCode.getHeight()); + captcha.setLen(loginCode.getLength()); + break; + case spec: + captcha = new SpecCaptcha(loginCode.getWidth(), loginCode.getHeight()); + captcha.setLen(loginCode.getLength()); + default: + throw new BadConfigurationException("验证码配置信息错误!!!正确配置查看 me.zhengjie.modules.security.config.bean.LoginCodeEnum "); + } + } + return captcha; + } +} diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/security/config/SecurityProperties.java b/eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/SecurityProperties.java similarity index 69% rename from eladmin-system/src/main/java/me/zhengjie/modules/security/config/SecurityProperties.java rename to eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/SecurityProperties.java index 501b7a19..3b7655bb 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/security/config/SecurityProperties.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/security/config/bean/SecurityProperties.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package me.zhengjie.modules.security.config; +package me.zhengjie.modules.security.config.bean; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -21,36 +21,51 @@ import org.springframework.context.annotation.Configuration; /** * Jwt参数配置 + * * @author Zheng Jie * @date 2019年11月28日 */ @Data -@Configuration -@ConfigurationProperties(prefix = "jwt") public class SecurityProperties { - /** Request Headers : Authorization */ + /** + * Request Headers : Authorization + */ private String header; - /** 令牌前缀,最后留个空格 Bearer */ + /** + * 令牌前缀,最后留个空格 Bearer + */ private String tokenStartWith; - /** 必须使用最少88位的Base64对该令牌进行编码 */ + /** + * 必须使用最少88位的Base64对该令牌进行编码 + */ private String base64Secret; - /** 令牌过期时间 此处单位/毫秒 */ + /** + * 令牌过期时间 此处单位/毫秒 + */ private Long tokenValidityInSeconds; - /** 在线用户 key,根据 key 查询 redis 中在线用户的数据 */ + /** + * 在线用户 key,根据 key 查询 redis 中在线用户的数据 + */ private String onlineKey; - /** 验证码 key */ + /** + * 验证码 key + */ private String codeKey; - /** token 续期检查 */ + /** + * token 续期检查 + */ private Long detect; - /** 续期时间 */ + /** + * 续期时间 + */ private Long renew; public String getTokenStartWith() { diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/security/rest/AuthorizationController.java b/eladmin-system/src/main/java/me/zhengjie/modules/security/rest/AuthorizationController.java index 8f4c39cd..77c84783 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/security/rest/AuthorizationController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/security/rest/AuthorizationController.java @@ -17,6 +17,7 @@ package me.zhengjie.modules.security.rest; import cn.hutool.core.util.IdUtil; import com.wf.captcha.ArithmeticCaptcha; +import com.wf.captcha.base.Captcha; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -27,7 +28,8 @@ import me.zhengjie.annotation.rest.AnonymousGetMapping; import me.zhengjie.annotation.rest.AnonymousPostMapping; import me.zhengjie.config.RsaProperties; import me.zhengjie.exception.BadRequestException; -import me.zhengjie.modules.security.config.SecurityProperties; +import me.zhengjie.modules.security.config.bean.LoginProperties; +import me.zhengjie.modules.security.config.bean.SecurityProperties; import me.zhengjie.modules.security.security.TokenProvider; import me.zhengjie.modules.security.service.dto.AuthUserDto; import me.zhengjie.modules.security.service.dto.JwtUserDto; @@ -46,6 +48,7 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.util.HashMap; import java.util.Map; @@ -62,16 +65,13 @@ import java.util.concurrent.TimeUnit; @RequiredArgsConstructor @Api(tags = "系统:系统授权接口") public class AuthorizationController { - - @Value("${loginCode.expiration}") - private Long expiration; - @Value("${single.login}") - private Boolean singleLogin; private final SecurityProperties properties; private final RedisUtils redisUtils; private final OnlineUserService onlineUserService; private final TokenProvider tokenProvider; private final AuthenticationManagerBuilder authenticationManagerBuilder; + @Resource + private LoginProperties loginProperties; @Log("用户登录") @ApiOperation("登录授权") @@ -104,7 +104,7 @@ public class AuthorizationController { put("token", properties.getTokenStartWith() + token); put("user", jwtUserDto); }}; - if (singleLogin) { + if (loginProperties.isSingleLogin()) { //踢掉之前已经登录的token onlineUserService.checkLoginOnUser(authUser.getUsername(), token); } @@ -120,15 +120,11 @@ public class AuthorizationController { @ApiOperation("获取验证码") @AnonymousGetMapping(value = "/code") public ResponseEntity getCode() { - // 算术类型 https://gitee.com/whvse/EasyCaptcha - ArithmeticCaptcha captcha = new ArithmeticCaptcha(111, 36); - // 几位数运算,默认是两位 - captcha.setLen(2); // 获取运算的结果 - String result = captcha.text(); + Captcha captcha = loginProperties.getCaptcha(); String uuid = properties.getCodeKey() + IdUtil.simpleUUID(); // 保存 - redisUtils.set(uuid, result, expiration, TimeUnit.MINUTES); + redisUtils.set(uuid, captcha.text(), loginProperties.getLoginCode().getExpiration(), TimeUnit.MINUTES); // 验证码信息 Map imgResult = new HashMap(2) {{ put("img", captcha.toBase64()); diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/security/security/TokenFilter.java b/eladmin-system/src/main/java/me/zhengjie/modules/security/security/TokenFilter.java index d24c3e12..84723b7d 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/security/security/TokenFilter.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/security/security/TokenFilter.java @@ -19,7 +19,7 @@ import cn.hutool.core.util.StrUtil; import io.jsonwebtoken.ExpiredJwtException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import me.zhengjie.modules.security.config.SecurityProperties; +import me.zhengjie.modules.security.config.bean.SecurityProperties; import me.zhengjie.modules.security.service.dto.OnlineUserDto; import me.zhengjie.modules.security.service.OnlineUserService; import me.zhengjie.utils.SpringContextHolder; diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/security/security/TokenProvider.java b/eladmin-system/src/main/java/me/zhengjie/modules/security/security/TokenProvider.java index 1c2e7267..91439056 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/security/security/TokenProvider.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/security/security/TokenProvider.java @@ -24,7 +24,7 @@ import io.jsonwebtoken.io.Decoders; import io.jsonwebtoken.security.Keys; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import me.zhengjie.modules.security.config.SecurityProperties; +import me.zhengjie.modules.security.config.bean.SecurityProperties; import me.zhengjie.utils.RedisUtils; import org.springframework.beans.factory.InitializingBean; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/security/service/OnlineUserService.java b/eladmin-system/src/main/java/me/zhengjie/modules/security/service/OnlineUserService.java index 6ccf99fe..c1fd9c5a 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/security/service/OnlineUserService.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/security/service/OnlineUserService.java @@ -16,7 +16,7 @@ package me.zhengjie.modules.security.service; import lombok.extern.slf4j.Slf4j; -import me.zhengjie.modules.security.config.SecurityProperties; +import me.zhengjie.modules.security.config.bean.SecurityProperties; import me.zhengjie.modules.security.service.dto.JwtUserDto; import me.zhengjie.modules.security.service.dto.OnlineUserDto; import me.zhengjie.utils.*; diff --git a/eladmin-system/src/main/resources/config/application-dev.yml b/eladmin-system/src/main/resources/config/application-dev.yml index b31b45f1..12cf5bcc 100644 --- a/eladmin-system/src/main/resources/config/application-dev.yml +++ b/eladmin-system/src/main/resources/config/application-dev.yml @@ -6,7 +6,7 @@ spring: driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy url: jdbc:log4jdbc:mysql://localhost:3306/eladmin?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false username: root - password: 59421 + password: 123456 # 初始连接数 initial-size: 5 # 最小连接数 @@ -44,9 +44,22 @@ spring: config: multi-statement-allow: true -# 是否限制单用户登录 -single: - login: false +# 登录相关配置 +login: + # 是否限制单用户登录 + single: false + # 验证码 + login-code: + # 验证码类型配置 + code-type: chinese_gif + # 登录图形验证码有效时间/分钟 + expiration: 2 + # 验证码高度 + width: 111 + # 验证码宽度 + heigth: 36 + # 内容长度 + length: 3 #jwt jwt: diff --git a/eladmin-system/src/main/resources/config/application-prod.yml b/eladmin-system/src/main/resources/config/application-prod.yml index 5889e8e2..1c16b5a8 100644 --- a/eladmin-system/src/main/resources/config/application-prod.yml +++ b/eladmin-system/src/main/resources/config/application-prod.yml @@ -46,9 +46,22 @@ spring: config: multi-statement-allow: true -# 是否限制单用户登录 -single: - login: false +# 登录相关配置 +login: + # 是否限制单用户登录 + single: false + # 验证码 + login-code: + # 验证码类型配置 + code-type: chinese_gif + # 登录图形验证码有效时间/分钟 + expiration: 2 + # 验证码高度 + width: 111 + # 验证码宽度 + heigth: 36 + # 内容长度 + length: 3 #jwt jwt: @@ -100,4 +113,4 @@ file: avatar: C:\eladmin\avatar\ # 文件大小 /M maxSize: 100 - avatarMaxSize: 5 \ No newline at end of file + avatarMaxSize: 5 diff --git a/eladmin-system/src/main/resources/config/application.yml b/eladmin-system/src/main/resources/config/application.yml index 271051ce..ee547363 100644 --- a/eladmin-system/src/main/resources/config/application.yml +++ b/eladmin-system/src/main/resources/config/application.yml @@ -50,9 +50,22 @@ qiniu: code: expiration: 300 -#登录图形验证码有效时间/分钟 -loginCode: - expiration: 2 +# 登录相关配置 +login: + # 是否限制单用户登录 + single: false + # 验证码 + login-code: + # 验证码类型配置 + code-type: chinese_gif + # 登录图形验证码有效时间/分钟 + expiration: 2 + # 验证码高度 + width: 111 + # 验证码宽度 + heigth: 36 + # 内容长度 + length: 3 #密码加密传输,前端公钥加密,后端私钥解密 rsa: @@ -60,4 +73,4 @@ rsa: # sm.ms 图床的 token smms: - token: 1oOP3ykFDI0K6ifmtvU7c8Y1eTWZSlyl \ No newline at end of file + token: 1oOP3ykFDI0K6ifmtvU7c8Y1eTWZSlyl