mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-09-19 10:08:07 +08:00
新增SaRouterUtil,可优雅的路由拦截式鉴权
This commit is contained in:
@@ -146,7 +146,4 @@ public class SaTokenManager {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,33 @@
|
||||
package cn.dev33.satoken.fun;
|
||||
|
||||
/**
|
||||
* 根据boolean变量,决定是否执行一个函数
|
||||
* @author kong
|
||||
*
|
||||
*/
|
||||
public class IsRunFunction {
|
||||
|
||||
/**
|
||||
* 变量
|
||||
*/
|
||||
public Boolean isRun;
|
||||
|
||||
/**
|
||||
* 设定一个变量,如果为true,则执行exe函数
|
||||
* @param isRun 变量
|
||||
*/
|
||||
public IsRunFunction(boolean isRun) {
|
||||
this.isRun = isRun;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据变量决定是否执行此函数
|
||||
* @param function 函数
|
||||
*/
|
||||
public void exe(SaFunction function) {
|
||||
if(isRun) {
|
||||
function.run();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
package cn.dev33.satoken.stp;
|
||||
package cn.dev33.satoken.fun;
|
||||
|
||||
/**
|
||||
* 模拟身份方法的辅助类
|
@@ -19,6 +19,7 @@ import cn.dev33.satoken.dao.SaTokenDao;
|
||||
import cn.dev33.satoken.exception.NotLoginException;
|
||||
import cn.dev33.satoken.exception.NotPermissionException;
|
||||
import cn.dev33.satoken.exception.NotRoleException;
|
||||
import cn.dev33.satoken.fun.SaFunction;
|
||||
import cn.dev33.satoken.session.SaSession;
|
||||
import cn.dev33.satoken.session.TokenSign;
|
||||
import cn.dev33.satoken.util.SaTokenConsts;
|
||||
|
@@ -2,6 +2,7 @@ package cn.dev33.satoken.stp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.dev33.satoken.fun.SaFunction;
|
||||
import cn.dev33.satoken.session.SaSession;
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user