Skip to content

Commit

Permalink
backport pre matching filter fix
Browse files Browse the repository at this point in the history
Signed-off-by: tvallin <[email protected]>
  • Loading branch information
tvallin committed Sep 27, 2023
1 parent 9fc0c93 commit afebe02
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,19 @@ public void filter(ContainerRequestContext request) {
SecurityTracing tracing = SecurityTracing.get();

// create a new security context
SecurityContext securityContext = security()
.contextBuilder(Integer.toString(CONTEXT_COUNTER.incrementAndGet(), Character.MAX_RADIX))
.tracingSpan(tracing.findParent().orElse(null))
.build();

Contexts.context().ifPresent(ctx -> ctx.register(securityContext));
SecurityContext securityContext = Contexts.context()
.flatMap(context -> context.get(SecurityContext.class))
.orElse(null);

if (securityContext == null) {
// create a new security context
securityContext = security()
.contextBuilder(Integer.toString(CONTEXT_COUNTER.incrementAndGet(), Character.MAX_RADIX))
.tracingSpan(tracing.findParent().orElse(null))
.build();
SecurityContext finalSecurityContext = securityContext;
Contexts.context().ifPresent(ctx -> ctx.register(finalSecurityContext));
}

injectionManager.<Ref<SecurityContext>>getInstance((new GenericType<Ref<SecurityContext>>() { }).getType())
.set(securityContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,4 @@ security:
abac:
roles-allowed:
user:
- admin
metrics:
permit-all: true
- admin

0 comments on commit afebe02

Please sign in to comment.