feat: 完成 JJWT 的配置和常量字段以及基本上下文的编写

backend/dev
Spark 2 months ago
parent e2cb5afc2f
commit 216cec0dfd

@ -0,0 +1,13 @@
package cc.aspark.constant;
public class MessageConstant {
public static final String PASSWORD_ERROR = "密码错误";
public static final String ACCOUNT_NOT_FOUND = "账号不存在";
public static final String UNKNOWN_ERROR = "未知错误";
public static final String USER_NOT_LOGIN = "用户未登录";
public static final String LOGIN_FAILED = "登录失败";
public static final String DELETE_FAILED = "删除失败";
public static final String INVALID_INPUT = "输入无效";
}

@ -0,0 +1,19 @@
package cc.aspark.context;
public class BaseContext {
public static ThreadLocal<Long> threadLocal = new ThreadLocal<>();
public static void setCurrentId(Long id) {
threadLocal.set(id);
}
public static Long getCurrentId() {
return threadLocal.get();
}
public static void removeCurrentId() {
threadLocal.remove();
}
}

@ -0,0 +1,19 @@
package cc.aspark.properties;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "jwt")
@Data
public class JwtProperties {
/**
* jwt
*/
private String secretKey;
private long ttl;
private String tokenName;
}
Loading…
Cancel
Save