|
@@ -0,0 +1,47 @@
|
|
|
+/*
|
|
|
+ * Copyright (c) 2025 GaoKunW
|
|
|
+ *
|
|
|
+ */
|
|
|
+
|
|
|
+package org.eco.vip.auth.service.auth;
|
|
|
+
|
|
|
+
|
|
|
+import org.eco.vip.auth.domain.auth.vo.AuthParam;
|
|
|
+import org.eco.vip.auth.domain.auth.vo.AuthResponse;
|
|
|
+import org.eco.vip.orm.exception.BusinessException;
|
|
|
+import org.eco.vip.orm.utils.SpringUtils;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @description IAuthStrategy 授权类型
|
|
|
+ *
|
|
|
+ * @author GaoKunW
|
|
|
+ * @date 2025/7/1 17:34
|
|
|
+ */
|
|
|
+public interface IAuthStrategy {
|
|
|
+ String BASE_NAME = "AuthStrategy";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 登录
|
|
|
+ *
|
|
|
+ * @param authParam 登录对象
|
|
|
+ * @param grantType 授权类型
|
|
|
+ * @return 登录验证信息
|
|
|
+ */
|
|
|
+ static AuthResponse login(AuthParam authParam, String grantType) {
|
|
|
+ // 授权类型和客户端id
|
|
|
+ String beanName = grantType + BASE_NAME;
|
|
|
+ if (!SpringUtils.containsBean(beanName)) {
|
|
|
+ throw new BusinessException("授权类型不正确!");
|
|
|
+ }
|
|
|
+ IAuthStrategy instance = SpringUtils.getBean(beanName);
|
|
|
+ return instance.login(authParam);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 登录
|
|
|
+ *
|
|
|
+ * @param authParam 登录对象
|
|
|
+ * @return 登录验证信息
|
|
|
+ */
|
|
|
+ AuthResponse login(AuthParam authParam);
|
|
|
+}
|