Skip to content

Commit

Permalink
[ISSUE #754] feat: 修复XDS正则表达式不生效问题 (#755)
Browse files Browse the repository at this point in the history
* fix issue #629 (#693)

* docs:优化错误信息描述

* Update zh.toml

* fix:修复eureka心跳协议错误码不兼容问题

* fix:修复eureka心跳协议错误码不兼容问题

* unit:添加单元测试

* test:调整测试配置文件位置

* fix:issue #692

* fix:issue #692

* fix:issue #692

* fix:issue #692

* docs:add error code desc

* feat: 修复正则表达式不生效问题 (#754)

* fix:修复xds修复正则表达式不生效问题

* fix:修复无法创建自用户

Co-authored-by: andrew shan <45474304+andrewshan@users.noreply.github.com>
  • Loading branch information
chuntaojun and andrewshan committed Oct 18, 2022
1 parent 1b067e9 commit 83c810b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
10 changes: 8 additions & 2 deletions apiserver/xdsserverv3/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,10 @@ func makeRoutes(serviceInfo *ServiceInfo) []*route.Route {
headerMatch = &route.HeaderMatcher{
Name: headerSubName,
HeaderMatchSpecifier: &route.HeaderMatcher_StringMatch{
StringMatch: &v32.StringMatcher{MatchPattern: &v32.StringMatcher_SafeRegex{SafeRegex: &v32.RegexMatcher{Regex: matchString.GetValue().GetValue()}}},
StringMatch: &v32.StringMatcher{MatchPattern: &v32.StringMatcher_SafeRegex{
SafeRegex: &v32.RegexMatcher{
EngineType: &v32.RegexMatcher_GoogleRe2{GoogleRe2: &v32.RegexMatcher_GoogleRE2{}},
Regex: matchString.GetValue().GetValue()}}},
},
}
}
Expand All @@ -520,7 +523,10 @@ func makeRoutes(serviceInfo *ServiceInfo) []*route.Route {
queryMatcher = &route.QueryParameterMatcher{
Name: querySubName,
QueryParameterMatchSpecifier: &route.QueryParameterMatcher_StringMatch{
StringMatch: &v32.StringMatcher{MatchPattern: &v32.StringMatcher_SafeRegex{SafeRegex: &v32.RegexMatcher{Regex: matchString.GetValue().GetValue()}}},
StringMatch: &v32.StringMatcher{MatchPattern: &v32.StringMatcher_SafeRegex{SafeRegex: &v32.RegexMatcher{
EngineType: &v32.RegexMatcher_GoogleRe2{GoogleRe2: &v32.RegexMatcher_GoogleRE2{}},
Regex: matchString.GetValue().GetValue(),
}}},
},
}
}
Expand Down
7 changes: 7 additions & 0 deletions store/sqldb/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,13 @@ func createDefaultStrategy(tx *BaseTx, role model.PrincipalType, id, name, owner
Comment: "Default Strategy",
}

// 需要清理过期的 auth_strategy
cleanInvalidRule := "DELETE FROM auth_strategy WHERE name = ? AND owner = ? AND flag = 1 AND `default` = ?"
if _, err := tx.Exec(cleanInvalidRule, []interface{}{strategy.Name, strategy.Owner,
strategy.Default}...); err != nil {
return err
}

// Save policy master information
saveMainSql := "INSERT INTO auth_strategy(`id`, `name`, `action`, `owner`, `comment`, `flag`, " +
" `default`, `revision`) VALUES (?,?,?,?,?,?,?,?)"
Expand Down

0 comments on commit 83c810b

Please sign in to comment.