Skip to content

Commit

Permalink
feat(api tester): filter tokens for 403 preparator based on inclusion…
Browse files Browse the repository at this point in the history
… instead of exclusion
  • Loading branch information
Dzov committed Nov 13, 2024
1 parent 43ba548 commit f972240
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/Preparator/Config/Error403PreparatorConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ final class Error403PreparatorConfig extends PreparatorConfig
* @var string[]
*/
public array $excludedTokens = [];

/**
* @var string[]
*/
public array $includedTokens = [];
}
2 changes: 1 addition & 1 deletion src/Preparator/Error403Preparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected function getTestTokens(Security $security): Tokens
if ($security instanceof OAuth2Security) {
$tokens = $this->tokens
->filter(
fn (Token $x) => !\in_array($x->getName(), $this->config->excludedTokens, true)
fn (Token $x) => \in_array($x->getName(), $this->config->includedTokens, true)
&& $security
->getScopes()
->select('name')
Expand Down

0 comments on commit f972240

Please sign in to comment.