-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. 优化服务本地权限存储逻辑,解决权限属性数据重复存储,不会替换问题。 2. 重新梳理Spring Security OAuth2 方法级表达式动态权限鉴权逻辑,摒弃无用的权限验证Voter逻辑,使用统一逻辑实现@PreAuthorize注解权限的全面动态可配置化。统一平台接口白名单,IP地址白名单,以及Scope绑定URL的管理。 3. 重构UserDetails用户信息组织逻辑,使用Spring Security标准代码,替换自定义逻辑代码,降低代码冗余,与自研方法级动态权限完美融合。 4. 优化平台权限从Controller扫描、汇总存储至服务器以及动态修改后最终回传同步至服务的整理逻辑以及事件流。完美支持单体式架构、UPMS自身应用需求、分布式架构以及分布式各服务多实例等各种应用场景。 5. 修复部分已知BUG,将部分代码中日志由@slf4j改回传统日志编写方式,一方面提高编译效率,另一方面解决源代码包查看时Idea提醒代码不一致问题。 6. 清理系统无用代码。 7. 增加方法级动态权限演示动图,更新Readme
- Loading branch information
1 parent
61be16c
commit 3d3b640
Showing
51 changed files
with
443 additions
and
905 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
...e-cloud-constant/src/main/java/cn/herodotus/eurynome/constant/enums/OAuth2Expression.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/* | ||
* Copyright (c) 2019-2021 Gengwei Zheng ([email protected]) | ||
* | ||
* 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. | ||
* | ||
* Project Name: eurynome-cloud | ||
* Module Name: eurynome-cloud-constant | ||
* File Name: OAuth2Expression.java | ||
* Author: gengwei.zheng | ||
* Date: 2021/08/14 06:50:14 | ||
*/ | ||
|
||
package cn.herodotus.eurynome.constant.enums; | ||
|
||
import com.google.common.collect.ImmutableMap; | ||
import io.swagger.annotations.ApiModelProperty; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* <p>Description: 安全表达式 </p> | ||
* | ||
* @author : gengwei.zheng | ||
* @date : 2021/8/14 6:50 | ||
*/ | ||
public enum OAuth2Expression { | ||
|
||
PERMIT_ALL(0, "permitAll"), | ||
ANONYMOUS(1, "anonymous"), | ||
REMEMBER_ME(2, "rememberMe"), | ||
DENY_ALL(3, "denyAll"), | ||
AUTHENTICATED(4, "authenticated"), | ||
FULLY_AUTHENTICATED(5, "fullyAuthenticated"), | ||
NOT_PERMIT_ALL(6, "!permitAll"), | ||
NOT_ANONYMOUS(7, "!anonymous"), | ||
NOT_REMEMBER_ME(8, "!rememberMe"), | ||
NOT_DENY_ALL(9, "!denyAll"), | ||
NOT_AUTHENTICATED(10, "!authenticated"), | ||
NOT_FULLY_AUTHENTICATED(11, "!fullyAuthenticated"), | ||
HAS_ROLE(12, "hasRole"), | ||
HAS_ANY_ROLE(13, "hasAnyRole"), | ||
HAS_AUTHORITY(14, "hasAuthority"), | ||
HAS_ANY_AUTHORITY(15, "hasAnyAuthority"), | ||
HAS_IP_ADDRESS(16, "hasIpAddress"), | ||
CLIENT_HAS_ROLE(17, "#oauth2.clientHasRole"), | ||
CLIENT_HAS_ANY_ROLE(18, "#oauth2.clientHasAnyRole"), | ||
HAS_SCOPE(19, "#oauth2.hasScope"), | ||
HAS_ANY_SCOPE(20, "#oauth2.hasAnyScope"), | ||
HAS_SCOPE_MATCHING(21, "#oauth2.hasScopeMatching"), | ||
HAS_ANY_SCOPE_MATCHING(22, "#oauth2.hasAnyScopeMatching"), | ||
DENY_OAUTH_CLIENT(23, "#oauth2.denyOAuthClient()"), | ||
IS_OAUTH(24, "#oauth2.isOAuth()"), | ||
IS_USER(25, "#oauth2.isUser()"), | ||
IS_CLIENT(26, "#oauth2.isClient()"); | ||
|
||
private static final Map<String, OAuth2Expression> INDEX_MAP = new HashMap<>(); | ||
private static final List<Map<String, Object>> TO_JSON_STRUCT = new ArrayList<>(); | ||
|
||
@ApiModelProperty(value = "索引") | ||
private final int index; | ||
@ApiModelProperty(value = "文字") | ||
private final String content; | ||
|
||
static { | ||
for (OAuth2Expression OAuth2Expression : OAuth2Expression.values()) { | ||
INDEX_MAP.put(OAuth2Expression.name(), OAuth2Expression); | ||
TO_JSON_STRUCT.add(OAuth2Expression.ordinal(), | ||
ImmutableMap.<String, Object>builder() | ||
.put("value", OAuth2Expression.name()) | ||
.put("key", OAuth2Expression.name()) | ||
.put("text", OAuth2Expression.getContent()) | ||
.build()); | ||
} | ||
} | ||
|
||
OAuth2Expression(int index, String content) { | ||
this.index = index; | ||
this.content = content; | ||
} | ||
|
||
public int getIndex() { | ||
return index; | ||
} | ||
|
||
public String getContent() { | ||
return content; | ||
} | ||
|
||
public static OAuth2Expression getSecurityExpressions(int index) { | ||
return INDEX_MAP.get(index); | ||
} | ||
|
||
public static List<Map<String, Object>> getToJsonStruct() { | ||
return TO_JSON_STRUCT; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 0 additions & 98 deletions
98
...rity/src/main/java/cn/herodotus/eurynome/security/definition/core/HerodotusAuthority.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.