mirror of https://github.com/elunez/eladmin
Merge branch 'master' of https://gitee.com/elunez/eladmin
commit
34024a2502
|
@ -28,6 +28,7 @@ import org.springframework.context.annotation.Configuration;
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class ConfigBeanConfiguration {
|
public class ConfigBeanConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConfigurationProperties(prefix = "login", ignoreUnknownFields = true)
|
@ConfigurationProperties(prefix = "login", ignoreUnknownFields = true)
|
||||||
public LoginProperties loginProperties() {
|
public LoginProperties loginProperties() {
|
||||||
|
|
|
@ -15,13 +15,17 @@
|
||||||
*/
|
*/
|
||||||
package me.zhengjie.modules.security.config.bean;
|
package me.zhengjie.modules.security.config.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录验证码配置信息
|
* 登录验证码配置信息
|
||||||
*
|
*
|
||||||
* @author: liaojinlong
|
* @author: liaojinlong
|
||||||
* @date: 2020/6/10 18:53
|
* @date: 2020/6/10 18:53
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class LoginCode {
|
public class LoginCode {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证码配置
|
* 验证码配置
|
||||||
*/
|
*/
|
||||||
|
@ -42,44 +46,16 @@ public class LoginCode {
|
||||||
* 验证码高度
|
* 验证码高度
|
||||||
*/
|
*/
|
||||||
private int height = 36;
|
private int height = 36;
|
||||||
|
/**
|
||||||
|
* 验证码字体
|
||||||
|
*/
|
||||||
|
private String fontName;
|
||||||
|
/**
|
||||||
|
* 字体大小
|
||||||
|
*/
|
||||||
|
private int fontSize = 25;
|
||||||
|
|
||||||
public LoginCodeEnum getCodeType() {
|
public LoginCodeEnum getCodeType() {
|
||||||
return codeType;
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,13 @@
|
||||||
*/
|
*/
|
||||||
package me.zhengjie.modules.security.config.bean;
|
package me.zhengjie.modules.security.config.bean;
|
||||||
|
|
||||||
|
|
||||||
import com.wf.captcha.*;
|
import com.wf.captcha.*;
|
||||||
import com.wf.captcha.base.Captcha;
|
import com.wf.captcha.base.Captcha;
|
||||||
|
import lombok.Data;
|
||||||
import me.zhengjie.exception.BadConfigurationException;
|
import me.zhengjie.exception.BadConfigurationException;
|
||||||
|
import me.zhengjie.utils.StringUtils;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,6 +30,7 @@ import java.util.Objects;
|
||||||
* @author liaojinlong
|
* @author liaojinlong
|
||||||
* @date loginCode.length0loginCode.length0/6/10 17:loginCode.length6
|
* @date loginCode.length0loginCode.length0/6/10 17:loginCode.length6
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class LoginProperties {
|
public class LoginProperties {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,26 +48,10 @@ public class LoginProperties {
|
||||||
return singleLogin;
|
return singleLogin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSingleLogin(boolean singleLogin) {
|
|
||||||
this.singleLogin = singleLogin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LoginCode getLoginCode() {
|
|
||||||
return loginCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLoginCode(LoginCode loginCode) {
|
|
||||||
this.loginCode = loginCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCacheEnable() {
|
public boolean isCacheEnable() {
|
||||||
return cacheEnable;
|
return cacheEnable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCacheEnable(boolean cacheEnable) {
|
|
||||||
this.cacheEnable = cacheEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取验证码生产类
|
* 获取验证码生产类
|
||||||
*
|
*
|
||||||
|
@ -113,9 +100,12 @@ public class LoginProperties {
|
||||||
captcha.setLen(loginCode.getLength());
|
captcha.setLen(loginCode.getLength());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new BadConfigurationException("验证码配置信息错误!!!正确配置查看 me.zhengjie.modules.security.config.bean.LoginCodeEnum ");
|
throw new BadConfigurationException("验证码配置信息错误!正确配置查看 LoginCodeEnum ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(StringUtils.isNotBlank(loginCode.getFontName())){
|
||||||
|
captcha.setFont(new Font(loginCode.getFontName(), Font.PLAIN, loginCode.getFontSize()));
|
||||||
|
}
|
||||||
return captcha;
|
return captcha;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,10 @@ login:
|
||||||
heigth: 36
|
heigth: 36
|
||||||
# 内容长度
|
# 内容长度
|
||||||
length: 2
|
length: 2
|
||||||
|
# 字体名称,为空则使用默认字体
|
||||||
|
font-name:
|
||||||
|
# 字体大小
|
||||||
|
font-size: 25
|
||||||
|
|
||||||
#jwt
|
#jwt
|
||||||
jwt:
|
jwt:
|
||||||
|
|
|
@ -55,7 +55,7 @@ login:
|
||||||
# 验证码
|
# 验证码
|
||||||
login-code:
|
login-code:
|
||||||
# 验证码类型配置 查看 LoginProperties 类
|
# 验证码类型配置 查看 LoginProperties 类
|
||||||
code-type: chinese_gif
|
code-type: arithmetic
|
||||||
# 登录图形验证码有效时间/分钟
|
# 登录图形验证码有效时间/分钟
|
||||||
expiration: 2
|
expiration: 2
|
||||||
# 验证码高度
|
# 验证码高度
|
||||||
|
@ -64,6 +64,10 @@ login:
|
||||||
heigth: 36
|
heigth: 36
|
||||||
# 内容长度
|
# 内容长度
|
||||||
length: 2
|
length: 2
|
||||||
|
# 字体名称,为空则使用默认字体,如遇到线上乱码,设置其他字体即可
|
||||||
|
font-name:
|
||||||
|
# 字体大小
|
||||||
|
font-size: 25
|
||||||
|
|
||||||
#jwt
|
#jwt
|
||||||
jwt:
|
jwt:
|
||||||
|
|
Loading…
Reference in New Issue