mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-10-07 15:14:23 +08:00
feat: 新增 TOTP 实现
This commit is contained in:
@@ -32,6 +32,7 @@ import cn.dev33.satoken.log.SaLog;
|
||||
import cn.dev33.satoken.plugin.SaTokenPlugin;
|
||||
import cn.dev33.satoken.plugin.SaTokenPluginHolder;
|
||||
import cn.dev33.satoken.same.SaSameTemplate;
|
||||
import cn.dev33.satoken.secure.totp.SaTotpTemplate;
|
||||
import cn.dev33.satoken.serializer.SaSerializerTemplate;
|
||||
import cn.dev33.satoken.sign.SaSignTemplate;
|
||||
import cn.dev33.satoken.stp.StpInterface;
|
||||
@@ -228,6 +229,17 @@ public class SaBeanInject {
|
||||
SaManager.setSaSignTemplate(saSignTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注入自定义的 TOTP 算法 Bean
|
||||
*
|
||||
* @param totpTemplate TOTP 算法类
|
||||
*/
|
||||
@Condition(onBean = SaTotpTemplate.class)
|
||||
@Bean
|
||||
public void setSaTotpTemplate(SaTotpTemplate totpTemplate) {
|
||||
SaManager.setSaTotpTemplate(totpTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注入自定义的 StpLogic
|
||||
*
|
||||
|
@@ -32,6 +32,7 @@ import cn.dev33.satoken.log.SaLog;
|
||||
import cn.dev33.satoken.plugin.SaTokenPlugin;
|
||||
import cn.dev33.satoken.plugin.SaTokenPluginHolder;
|
||||
import cn.dev33.satoken.same.SaSameTemplate;
|
||||
import cn.dev33.satoken.secure.totp.SaTotpTemplate;
|
||||
import cn.dev33.satoken.serializer.SaSerializerTemplate;
|
||||
import cn.dev33.satoken.sign.SaSignTemplate;
|
||||
import cn.dev33.satoken.spring.pathmatch.SaPathMatcherHolder;
|
||||
@@ -214,6 +215,16 @@ public class SaBeanInject {
|
||||
SaManager.setSaSignTemplate(saSignTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注入自定义的 TOTP 算法 Bean
|
||||
*
|
||||
* @param totpTemplate TOTP 算法类
|
||||
*/
|
||||
@Autowired(required = false)
|
||||
public void setSaTotpTemplate(SaTotpTemplate totpTemplate) {
|
||||
SaManager.setSaTotpTemplate(totpTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注入自定义的 StpLogic
|
||||
* @param stpLogic /
|
||||
|
Reference in New Issue
Block a user