From 15027bbe095234aa23f9dd867cb1ac618b275adb Mon Sep 17 00:00:00 2001
From: click33 <2393584716@qq.com>
Date: Wed, 7 Jun 2023 14:16:52 +0800
Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E6=89=80=E6=9C=89=E7=AD=96=E7=95=A5?=
=?UTF-8?q?=E5=A3=B0=E6=98=8E=E6=8A=BD=E7=A6=BB=E4=B8=BA=E5=8D=95=E7=8B=AC?=
=?UTF-8?q?=E7=9A=84=E5=87=BD=E6=95=B0=E5=BC=8F=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../SaCheckElementAnnotationFunction.java | 33 +++++
.../SaCheckMethodAnnotationFunction.java | 33 +++++
.../strategy/SaCheckOrAnnotationFunction.java | 34 +++++
.../fun/strategy/SaCreateSessionFunction.java | 34 +++++
.../strategy/SaCreateStpLogicFunction.java | 34 +++++
.../fun/strategy/SaCreateTokenFunction.java | 32 +++++
.../SaGenerateUniqueTokenFunction.java | 7 +-
.../fun/strategy/SaGetAnnotationFunction.java | 34 +++++
.../fun/strategy/SaHasElementFunction.java | 33 +++++
.../SaIsAnnotationPresentFunction.java | 34 +++++
.../cn/dev33/satoken/strategy/SaStrategy.java | 136 ++++++++----------
.../main/java/com/pj/SaTokenApplication.java | 8 ++
sa-token-doc/fun/plugin-dev.md | 2 +-
sa-token-doc/up/many-account.md | 2 +-
sa-token-doc/up/token-style.md | 2 +-
15 files changed, 376 insertions(+), 82 deletions(-)
create mode 100644 sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCheckElementAnnotationFunction.java
create mode 100644 sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCheckMethodAnnotationFunction.java
create mode 100644 sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCheckOrAnnotationFunction.java
create mode 100644 sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCreateSessionFunction.java
create mode 100644 sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCreateStpLogicFunction.java
create mode 100644 sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCreateTokenFunction.java
rename sa-token-core/src/main/java/cn/dev33/satoken/fun/{ => strategy}/SaGenerateUniqueTokenFunction.java (88%)
create mode 100644 sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaGetAnnotationFunction.java
create mode 100644 sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaHasElementFunction.java
create mode 100644 sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaIsAnnotationPresentFunction.java
diff --git a/sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCheckElementAnnotationFunction.java b/sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCheckElementAnnotationFunction.java
new file mode 100644
index 00000000..97a67c2e
--- /dev/null
+++ b/sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCheckElementAnnotationFunction.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2020-2099 sa-token.cc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.dev33.satoken.fun.strategy;
+
+import java.lang.reflect.AnnotatedElement;
+import java.util.function.Consumer;
+
+/**
+ * 函数式接口:对一个 [元素] 对象进行注解校验 (注解鉴权内部实现)
+ *
+ *
参数:element元素
+ *
返回:无
+ *
+ * @author click33
+ * @since 1.35.0
+ */
+@FunctionalInterface
+public interface SaCheckElementAnnotationFunction extends Consumer {
+
+}
\ No newline at end of file
diff --git a/sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCheckMethodAnnotationFunction.java b/sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCheckMethodAnnotationFunction.java
new file mode 100644
index 00000000..8bcd4318
--- /dev/null
+++ b/sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCheckMethodAnnotationFunction.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2020-2099 sa-token.cc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.dev33.satoken.fun.strategy;
+
+import java.lang.reflect.Method;
+import java.util.function.Consumer;
+
+/**
+ * 函数式接口:对一个 [Method] 对象进行注解校验 (注解鉴权内部实现)
+ *
+ *
参数:Method句柄
+ *
返回:无
+ *
+ * @author click33
+ * @since 1.35.0
+ */
+@FunctionalInterface
+public interface SaCheckMethodAnnotationFunction extends Consumer {
+
+}
\ No newline at end of file
diff --git a/sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCheckOrAnnotationFunction.java b/sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCheckOrAnnotationFunction.java
new file mode 100644
index 00000000..c6f6ad54
--- /dev/null
+++ b/sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCheckOrAnnotationFunction.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2020-2099 sa-token.cc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.dev33.satoken.fun.strategy;
+
+import cn.dev33.satoken.annotation.SaCheckOr;
+
+import java.util.function.Consumer;
+
+/**
+ * 函数式接口:对一个 @SaCheckOr 进行注解校验
+ *
+ *
参数:SaCheckOr 注解的实例
+ *
返回:无
+ *
+ * @author click33
+ * @since 1.35.0
+ */
+@FunctionalInterface
+public interface SaCheckOrAnnotationFunction extends Consumer {
+
+}
\ No newline at end of file
diff --git a/sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCreateSessionFunction.java b/sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCreateSessionFunction.java
new file mode 100644
index 00000000..0963edff
--- /dev/null
+++ b/sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCreateSessionFunction.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2020-2099 sa-token.cc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.dev33.satoken.fun.strategy;
+
+import cn.dev33.satoken.session.SaSession;
+
+import java.util.function.Function;
+
+/**
+ * 函数式接口:创建 SaSession 的策略
+ *
+ *
参数:SessionId
+ *
返回:SaSession对象
+ *
+ * @author click33
+ * @since 1.35.0
+ */
+@FunctionalInterface
+public interface SaCreateSessionFunction extends Function {
+
+}
\ No newline at end of file
diff --git a/sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCreateStpLogicFunction.java b/sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCreateStpLogicFunction.java
new file mode 100644
index 00000000..2c3c75d6
--- /dev/null
+++ b/sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCreateStpLogicFunction.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2020-2099 sa-token.cc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.dev33.satoken.fun.strategy;
+
+import cn.dev33.satoken.stp.StpLogic;
+
+import java.util.function.Function;
+
+/**
+ * 函数式接口:创建 StpLogic 的算法
+ *
+ *
参数:账号体系标识
+ *
返回:创建好的 StpLogic 对象
+ *
+ * @author click33
+ * @since 1.35.0
+ */
+@FunctionalInterface
+public interface SaCreateStpLogicFunction extends Function {
+
+}
\ No newline at end of file
diff --git a/sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCreateTokenFunction.java b/sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCreateTokenFunction.java
new file mode 100644
index 00000000..f85c40bb
--- /dev/null
+++ b/sa-token-core/src/main/java/cn/dev33/satoken/fun/strategy/SaCreateTokenFunction.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2020-2099 sa-token.cc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.dev33.satoken.fun.strategy;
+
+import java.util.function.BiFunction;
+
+/**
+ * 函数式接口:创建 token 的策略
+ *
+ *