Skip to content

Commit

Permalink
Merge pull request #39 from sci3ma/patch-2
Browse files Browse the repository at this point in the history
Exclude multiple route prefixes from token checks
  • Loading branch information
mainick authored Dec 26, 2024
2 parents 16ed952 + 790bf0a commit 0307678
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/EventSubscriber/TokenAuthListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
'app.swagger_ui',
];

private const EXCLUDED_ROUTES_PREFIX = 'mainick_keycloak_security_auth_';
private const EXCLUDED_ROUTES_PREFIX = [
'mainick_keycloak_security_auth_',
'_wdt',
'_profiler',
];

public function __construct(
private LoggerInterface $keycloakClientLogger,
Expand Down Expand Up @@ -75,7 +79,7 @@ private function shouldSkipRouteValidation(?string $route): bool
}

return in_array($route, self::EXCLUDED_ROUTES, true) ||
str_starts_with($route, self::EXCLUDED_ROUTES_PREFIX);
!empty(array_filter(self::EXCLUDED_ROUTES_PREFIX, static fn (string $prefix): bool => str_starts_with($route, $prefix)));
}

private function shouldSkipControllerValidation(mixed $controller): bool
Expand Down

0 comments on commit 0307678

Please sign in to comment.