Skip to content

Commit

Permalink
handle path prefix in paths
Browse files Browse the repository at this point in the history
  • Loading branch information
kozjan committed Nov 26, 2024
1 parent b239154 commit 377c505
Showing 1 changed file with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,20 @@ class JwtFilterFactory(
methods: Set<String>,
providers: MutableSet<String>
): RequirementRule {
val pathMatching = RouteMatch.newBuilder().setPathMatchPolicy(
TypedExtensionConfig.newBuilder()
.setName("envoy.path.match.uri_template.uri_template_matcher")
.setTypedConfig(
Any.pack(
UriTemplateMatchConfig.newBuilder()
.setPathTemplate(pathGlobPattern)
.build()
)
).build()
)

val pathMatching =
if (pathGlobPattern.matches(Regex("^[^*]*[^*/]\\*$"))) RouteMatch.newBuilder().setPrefix(pathGlobPattern)
else RouteMatch.newBuilder().setPathMatchPolicy(
TypedExtensionConfig.newBuilder()
.setName("envoy.path.match.uri_template.uri_template_matcher")
.setTypedConfig(
Any.pack(
UriTemplateMatchConfig.newBuilder()
.setPathTemplate(pathGlobPattern)
.build()
)
).build()
)
if (methods.isNotEmpty()) {
pathMatching.addHeaders(createHeaderMatcherBuilder(methods))
}
Expand Down

0 comments on commit 377c505

Please sign in to comment.