CoSec
基于 RBAC 和策略的多租户响应式安全框架
更新内容(v1.10.4) ???? ???? ????
-
特性:新增
StartsWithConditionMatcher
。 -
{ "name": "TestStartsWith", "effect": "allow", "actions": [ { "type": "all" } ], "condition": { "type": "starts_with", "part": "request.attributes.ipRegion", "pattern": "中国" } }
-
特性:新增
EndsWithConditionMatcher
。 -
{ "name": "TestEndsWith", "effect": "allow", "actions": [ { "type": "all" } ], "condition": { "type": "ends_with", "part": "request.attributes.remoteIp", "pattern": ".168.0.1" } }
认证
授权
OAuth
建模类图
安全网关服务
授权策略流程
内置策略匹配器
ActionMatcher
如何自定义 ActionMatcher
(SPI)
class CustomActionMatcherFactory : ActionMatcherFactory {
companion object {
const val TYPE = "[CustomActionType]"
}
override val type: String
get() = TYPE
override fun create(onfiguration: Configuration): ActionMatcher {
return CustomActionMatcher(onfiguration)
}
}
class CustomActionMatcher(configuration: Configuration) :
AbstractActionMatcher(CustomActionMatcherFactory.TYPE, configuration) {
override fun internalMatch(request: Request, securityContext: SecurityContext): Boolean {
//Custom matching logic
}
}