Pre Merge pull request !339 from xiumu/dev

This commit is contained in:
xiumu 2025-06-02 09:23:47 +00:00 committed by Gitee
commit 05efbc053e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 21 additions and 4 deletions

View File

@ -21,6 +21,8 @@ import cn.dev33.satoken.oauth2.error.SaOAuth2ErrorCode;
import cn.dev33.satoken.oauth2.exception.SaOAuth2ClientModelException;
import cn.dev33.satoken.secure.SaSecureUtil;
import java.util.List;
/**
* Sa-Token OAuth2 数据加载器
*
@ -78,4 +80,21 @@ public interface SaOAuth2DataLoader {
return SaSecureUtil.md5(SaOAuth2Manager.getServerConfig().getUnionidDigestPrefix() + "_" + subjectId + "_" + loginId);
}
/**
* 获取高级权限列表
* @return /
*/
default List<String> getHigherScopeList() {
String higherScope = SaOAuth2Manager.getServerConfig().getHigherScope();
return SaOAuth2Manager.getDataConverter().convertScopeStringToList(higherScope);
}
/**
* 获取低级权限列表
* @return /
*/
default List<String> getLowerScopeList() {
String lowerScope = SaOAuth2Manager.getServerConfig().getLowerScope();
return SaOAuth2Manager.getDataConverter().convertScopeStringToList(lowerScope);
}
}

View File

@ -765,8 +765,7 @@ public class SaOAuth2Template {
* @return /
*/
public List<String> getHigherScopeList() {
String higherScope = SaOAuth2Manager.getServerConfig().getHigherScope();
return SaOAuth2Manager.getDataConverter().convertScopeStringToList(higherScope);
return SaOAuth2Manager.getDataLoader().getHigherScopeList();
}
/**
@ -774,8 +773,7 @@ public class SaOAuth2Template {
* @return /
*/
public List<String> getLowerScopeList() {
String lowerScope = SaOAuth2Manager.getServerConfig().getLowerScope();
return SaOAuth2Manager.getDataConverter().convertScopeStringToList(lowerScope);
return SaOAuth2Manager.getDataLoader().getLowerScopeList();
}
}