<properties>
、、、、
<jwt.version>0.9.0</jwt.version>
</properties>
<!-- Token生成与解析 -->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>${jwt.version}</version>
</dependency>
<!-- redis 缓存操作 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
#redis
redis:
# 地址
host: localhost
# 端口,默认6379
port: 6379
# 密码
password:
# 连接超时时间
connect-timeout: 10s
lettuce:
pool:
# 连接池中最小空闲连接
min-idle: 0
# 连接池中最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# 连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
# token配置
token:
# 令牌自定义标识
header: Authorization
# 令牌秘钥
# secret: abcdefghijklmnopqrstuvwxyz
secret: (FRIDAY:)_$^11244^%$_(IS:)_@@++--(COOL:)_++++_.sds_(GUY:)
# 令牌有效期(默认30分钟)
expireTime: 60
package edu.friday.common.exception.user;
import edu.friday.common.exception.BaseException;
/**
* 用户信息异常类
* */
public class UserException extends BaseException {
private static final long serialVersionUID = 1L;
public UserException(String code,Object[] args){
super("user",code,args,null);
}
}
package edu.friday.common.exception.user;
/**
* 用户密码不正确或不符合规范异常类
* */
public class UserPasswordNotMatchException extends UserException {
private static final long serialVersionUID = 1L;
public UserPasswordNotMatchException(){
super("user.password.not.match",null);
}
}
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号