更改 sa-token-oauth2 实体类相关包位置

This commit is contained in:
click33 2024-08-14 13:27:35 +08:00
parent 890da5d934
commit 47cf8939cb
14 changed files with 202 additions and 187 deletions

View File

@ -96,7 +96,7 @@ public class SaSession implements SaSetValueInterface, Serializable {
/** /**
* 所有挂载数据 * 所有挂载数据
*/ */
private final Map<String, Object> dataMap = new ConcurrentHashMap<>(); private Map<String, Object> dataMap = new ConcurrentHashMap<>();
// ----------------------- 构建相关 // ----------------------- 构建相关
@ -522,14 +522,26 @@ public class SaSession implements SaSetValueInterface, Serializable {
return dataMap; return dataMap;
} }
/**
* 设置数据挂载集合 (改变底层对象引用 dataMap 整个对象替换)
* @param dataMap 数据集合
*
* @return 对象自身
*/
public SaSession setDataMap(Map<String, Object> dataMap) {
this.dataMap = dataMap;
return this;
}
/** /**
* 写入数据集合 (不改变底层对象引用只将此 dataMap 所有数据进行替换) * 写入数据集合 (不改变底层对象引用只将此 dataMap 所有数据进行替换)
* @param dataMap 数据集合 * @param dataMap 数据集合
*/ */
public void refreshDataMap(Map<String, Object> dataMap) { public SaSession refreshDataMap(Map<String, Object> dataMap) {
this.dataMap.clear(); this.dataMap.clear();
this.dataMap.putAll(dataMap); this.dataMap.putAll(dataMap);
this.update(); this.update();
return this;
} }
// //

View File

@ -1,7 +1,8 @@
package com.pj.oauth2; package com.pj.oauth2;
import cn.dev33.satoken.oauth2.data.loader.SaOAuth2DataLoader; import cn.dev33.satoken.oauth2.data.loader.SaOAuth2DataLoader;
import cn.dev33.satoken.oauth2.model.SaClientModel; import cn.dev33.satoken.oauth2.data.model.SaClientModel;
import cn.dev33.satoken.secure.SaSecureUtil;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
@ -31,7 +32,9 @@ public class SaOAuth2DataLoaderImpl implements SaOAuth2DataLoader {
@Override @Override
public String getOpenid(String clientId, Object loginId) { public String getOpenid(String clientId, Object loginId) {
// 此为模拟数据真实环境需要从数据库查询 // 此为模拟数据真实环境需要从数据库查询
return "gr_SwoIN0MC1ewxHX_vfCW3BothWDZMMtx__"; // return "gr_SwoIN0MC1ewxHX_vfCW3BothWDZMMtx__";
String prefix = "grSwoIN0MC1ewxHXvfCW3BothWDZMMtx";
return SaSecureUtil.md5(prefix + "_" + clientId + "_" + loginId);
} }
} }

View File

@ -15,7 +15,7 @@
*/ */
package cn.dev33.satoken.oauth2.data.loader; package cn.dev33.satoken.oauth2.data.loader;
import cn.dev33.satoken.oauth2.model.SaClientModel; import cn.dev33.satoken.oauth2.data.model.SaClientModel;
/** /**
* Sa-Token OAuth2 数据加载器 * Sa-Token OAuth2 数据加载器

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package cn.dev33.satoken.oauth2.model; package cn.dev33.satoken.oauth2.data.model;
import java.io.Serializable; import java.io.Serializable;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package cn.dev33.satoken.oauth2.model; package cn.dev33.satoken.oauth2.data.model;
import java.io.Serializable; import java.io.Serializable;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package cn.dev33.satoken.oauth2.model; package cn.dev33.satoken.oauth2.data.model;
import java.io.Serializable; import java.io.Serializable;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package cn.dev33.satoken.oauth2.model; package cn.dev33.satoken.oauth2.data.model;
import java.io.Serializable; import java.io.Serializable;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package cn.dev33.satoken.oauth2.model; package cn.dev33.satoken.oauth2.data.model;
import java.io.Serializable; import java.io.Serializable;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package cn.dev33.satoken.oauth2.model; package cn.dev33.satoken.oauth2.data.model;
import java.io.Serializable; import java.io.Serializable;

View File

@ -15,8 +15,8 @@
*/ */
package cn.dev33.satoken.oauth2.data.resolver; package cn.dev33.satoken.oauth2.data.resolver;
import cn.dev33.satoken.oauth2.model.AccessTokenModel; import cn.dev33.satoken.oauth2.data.model.AccessTokenModel;
import cn.dev33.satoken.oauth2.model.ClientTokenModel; import cn.dev33.satoken.oauth2.data.model.ClientTokenModel;
import cn.dev33.satoken.util.SaResult; import cn.dev33.satoken.util.SaResult;
import java.util.Map; import java.util.Map;

View File

@ -16,8 +16,8 @@
package cn.dev33.satoken.oauth2.data.resolver; package cn.dev33.satoken.oauth2.data.resolver;
import cn.dev33.satoken.oauth2.consts.SaOAuth2Consts.TokenType; import cn.dev33.satoken.oauth2.consts.SaOAuth2Consts.TokenType;
import cn.dev33.satoken.oauth2.model.AccessTokenModel; import cn.dev33.satoken.oauth2.data.model.AccessTokenModel;
import cn.dev33.satoken.oauth2.model.ClientTokenModel; import cn.dev33.satoken.oauth2.data.model.ClientTokenModel;
import cn.dev33.satoken.util.SaResult; import cn.dev33.satoken.util.SaResult;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;

View File

@ -26,9 +26,9 @@ import cn.dev33.satoken.oauth2.consts.SaOAuth2Consts.Api;
import cn.dev33.satoken.oauth2.consts.SaOAuth2Consts.GrantType; import cn.dev33.satoken.oauth2.consts.SaOAuth2Consts.GrantType;
import cn.dev33.satoken.oauth2.consts.SaOAuth2Consts.Param; import cn.dev33.satoken.oauth2.consts.SaOAuth2Consts.Param;
import cn.dev33.satoken.oauth2.consts.SaOAuth2Consts.ResponseType; import cn.dev33.satoken.oauth2.consts.SaOAuth2Consts.ResponseType;
import cn.dev33.satoken.oauth2.data.model.*;
import cn.dev33.satoken.oauth2.error.SaOAuth2ErrorCode; import cn.dev33.satoken.oauth2.error.SaOAuth2ErrorCode;
import cn.dev33.satoken.oauth2.exception.SaOAuth2Exception; import cn.dev33.satoken.oauth2.exception.SaOAuth2Exception;
import cn.dev33.satoken.oauth2.model.*;
import cn.dev33.satoken.oauth2.template.SaOAuth2Template; import cn.dev33.satoken.oauth2.template.SaOAuth2Template;
import cn.dev33.satoken.stp.StpLogic; import cn.dev33.satoken.stp.StpLogic;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;

View File

@ -19,9 +19,9 @@ import cn.dev33.satoken.SaManager;
import cn.dev33.satoken.context.model.SaRequest; import cn.dev33.satoken.context.model.SaRequest;
import cn.dev33.satoken.oauth2.SaOAuth2Manager; import cn.dev33.satoken.oauth2.SaOAuth2Manager;
import cn.dev33.satoken.oauth2.consts.SaOAuth2Consts.Param; import cn.dev33.satoken.oauth2.consts.SaOAuth2Consts.Param;
import cn.dev33.satoken.oauth2.data.model.*;
import cn.dev33.satoken.oauth2.error.SaOAuth2ErrorCode; import cn.dev33.satoken.oauth2.error.SaOAuth2ErrorCode;
import cn.dev33.satoken.oauth2.exception.SaOAuth2Exception; import cn.dev33.satoken.oauth2.exception.SaOAuth2Exception;
import cn.dev33.satoken.oauth2.model.*;
import cn.dev33.satoken.strategy.SaStrategy; import cn.dev33.satoken.strategy.SaStrategy;
import cn.dev33.satoken.util.SaFoxUtil; import cn.dev33.satoken.util.SaFoxUtil;

View File

@ -16,7 +16,7 @@
package cn.dev33.satoken.oauth2.template; package cn.dev33.satoken.oauth2.template;
import cn.dev33.satoken.context.model.SaRequest; import cn.dev33.satoken.context.model.SaRequest;
import cn.dev33.satoken.oauth2.model.*; import cn.dev33.satoken.oauth2.data.model.*;
import cn.dev33.satoken.oauth2.processor.SaOAuth2ServerProcessor; import cn.dev33.satoken.oauth2.processor.SaOAuth2ServerProcessor;
/** /**