mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-09-19 10:08:07 +08:00
整合 jwt 临时令牌鉴权
This commit is contained in:
@@ -19,7 +19,7 @@ import cn.dev33.satoken.stp.StpInterfaceDefaultImpl;
|
||||
import cn.dev33.satoken.stp.StpLogic;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.dev33.satoken.temp.SaTempInterface;
|
||||
import cn.dev33.satoken.temp.SaTempInterfaceDefaultImpl;
|
||||
import cn.dev33.satoken.temp.SaTempDefaultImpl;
|
||||
import cn.dev33.satoken.util.SaFoxUtil;
|
||||
|
||||
/**
|
||||
@@ -146,7 +146,7 @@ public class SaManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* 临时验证模块 Bean
|
||||
* 临时令牌验证模块 Bean
|
||||
*/
|
||||
private static SaTempInterface saTemp;
|
||||
public static void setSaTemp(SaTempInterface saTemp) {
|
||||
@@ -156,7 +156,7 @@ public class SaManager {
|
||||
if (saTemp == null) {
|
||||
synchronized (SaManager.class) {
|
||||
if (saTemp == null) {
|
||||
setSaTemp(new SaTempInterfaceDefaultImpl());
|
||||
setSaTemp(new SaTempDefaultImpl());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -61,6 +61,11 @@ public class SaTokenConfig {
|
||||
/** 是否打印操作日志 */
|
||||
private Boolean isLog = false;
|
||||
|
||||
/**
|
||||
* jwt秘钥 (只有集成 sa-token-temp-jwt 模块时此参数才会生效)
|
||||
*/
|
||||
private String jwtSecretKey;
|
||||
|
||||
|
||||
/**
|
||||
* @return token名称 (同时也是cookie名称)
|
||||
@@ -315,6 +320,7 @@ public class SaTokenConfig {
|
||||
|
||||
/**
|
||||
* @param isLog 是否打印操作日志
|
||||
* @return 对象自身
|
||||
*/
|
||||
public SaTokenConfig setIsLog(Boolean isLog) {
|
||||
this.isLog = isLog;
|
||||
@@ -322,7 +328,23 @@ public class SaTokenConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* toString()
|
||||
* @return jwt秘钥 (只有集成 sa-token-temp-jwt 模块时此参数才会生效)
|
||||
*/
|
||||
public String getJwtSecretKey() {
|
||||
return jwtSecretKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param jwtSecretKey jwt秘钥 (只有集成 sa-token-temp-jwt 模块时此参数才会生效)
|
||||
* @return 对象自身
|
||||
*/
|
||||
public SaTokenConfig setJwtSecretKey(String jwtSecretKey) {
|
||||
this.jwtSecretKey = jwtSecretKey;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
@@ -331,9 +353,11 @@ public class SaTokenConfig {
|
||||
+ isReadBody + ", isReadHead=" + isReadHead + ", isReadCookie=" + isReadCookie + ", tokenStyle="
|
||||
+ tokenStyle + ", dataRefreshPeriod=" + dataRefreshPeriod + ", tokenSessionCheckLogin="
|
||||
+ tokenSessionCheckLogin + ", autoRenew=" + autoRenew + ", cookieDomain=" + cookieDomain
|
||||
+ ", tokenPrefix=" + tokenPrefix + ", isV=" + isV + ", isLog=" + isLog + "]";
|
||||
+ ", tokenPrefix=" + tokenPrefix + ", isV=" + isV + ", isLog=" + isLog + ", jwtSecretKey="
|
||||
+ jwtSecretKey + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -0,0 +1,10 @@
|
||||
package cn.dev33.satoken.temp;
|
||||
|
||||
/**
|
||||
* Sa-Token 临时令牌验证模块 默认实现类
|
||||
* @author kong
|
||||
*
|
||||
*/
|
||||
public class SaTempDefaultImpl implements SaTempInterface {
|
||||
|
||||
}
|
@@ -4,7 +4,7 @@ import cn.dev33.satoken.SaManager;
|
||||
import cn.dev33.satoken.util.SaFoxUtil;
|
||||
|
||||
/**
|
||||
* Sa-Token 临时验证模块接口
|
||||
* Sa-Token 临时令牌验证模块接口
|
||||
* @author kong
|
||||
*
|
||||
*/
|
||||
@@ -69,4 +69,11 @@ public interface SaTempInterface {
|
||||
return SaManager.getConfig().getTokenName() + ":temp-token:" + token;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return jwt秘钥 (只有集成 sa-token-temp-jwt 模块时此参数才会生效)
|
||||
*/
|
||||
public default String getJwtSecretKey() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,10 +0,0 @@
|
||||
package cn.dev33.satoken.temp;
|
||||
|
||||
/**
|
||||
* Sa-Token 临时验证模块 逻辑
|
||||
* @author kong
|
||||
*
|
||||
*/
|
||||
public class SaTempInterfaceDefaultImpl implements SaTempInterface {
|
||||
|
||||
}
|
@@ -3,7 +3,7 @@ package cn.dev33.satoken.temp;
|
||||
import cn.dev33.satoken.SaManager;
|
||||
|
||||
/**
|
||||
* Sa-Token 临时验证模块
|
||||
* Sa-Token 临时验证令牌模块
|
||||
* @author kong
|
||||
*
|
||||
*/
|
||||
|
Reference in New Issue
Block a user