整合 jwt 临时令牌鉴权

This commit is contained in:
click33
2021-06-11 01:05:33 +08:00
parent a514ccf5f3
commit a5b65fb30e
19 changed files with 304 additions and 24 deletions
@@ -14,6 +14,7 @@ import cn.dev33.satoken.context.SaTokenContext;
import cn.dev33.satoken.dao.SaTokenDao;
import cn.dev33.satoken.listener.SaTokenListener;
import cn.dev33.satoken.stp.StpInterface;
import cn.dev33.satoken.temp.SaTempInterface;
/**
* 利用spring的自动装配来加载开发者重写的Bean
@@ -105,6 +106,16 @@ public class SaTokenSpringAutowired {
SaManager.setSaTokenListener(saTokenListener);
}
/**
* 注入临时令牌验证模块 Bean
*
* @param saTemp saTemp对象
*/
@Autowired(required = false)
public void setSaTemp(SaTempInterface saTemp) {
SaManager.setSaTemp(saTemp);
}
/**
* 利用自动注入特性,获取Spring框架内部使用的路由匹配器
*
@@ -177,7 +177,6 @@ public class SaTokenSpringBootStarterTest {
// 解析token
String value = SaTempUtil.parseToken(token, String.class);
System.out.println(value);
Assert.assertEquals(value, "group-1014");
// 过期时间