Version: gesdinet/jwt-refresh-token-bundle 3.0.0 · Symfony 8.1.5 · PHP 8.4/8.5
Summary
Enabling reuse_detection makes the container compilation fail:
The service "gesdinet_jwt_refresh_token.spent_refresh_token_registry" has a dependency on a non-existent service "%gesdinet_jwt_refresh_token.reuse_detection.cache%".
Cause (read in the source)
config/reuse_detection.php designates the cache pool with service((string) param('gesdinet_jwt_refresh_token.reuse_detection.cache')), i.e. a literal %…% string used as a service id. Symfony's ResolveParameterPlaceHoldersPass resolves placeholders in strings, definitions and aliases, but not inside a Reference — so the reference is looked up verbatim. The inline comment ("turned into the %name% placeholder service() takes") relies on a behaviour Symfony 8 (and, as far as we can tell, earlier versions) does not have.
Reproduction
gesdinet_jwt_refresh_token:
refresh_token_class: App\Entity\RefreshToken
single_use: true
reuse_detection:
enabled: true
cache: cache.app
php bin/console lint:container → error above.
Workaround
Redefine the service in the application with the concrete pool:
services:
gesdinet_jwt_refresh_token.spent_refresh_token_registry:
class: Gesdinet\JWTRefreshTokenBundle\...\CacheSpentRefreshTokenRegistry
autowire: false
autoconfigure: false
arguments: ['@cache.app', '%gesdinet_jwt_refresh_token.reuse_detection.ttl%']
Note for anyone applying it: the reuse_detection.* parameters only exist while reuse_detection.enabled is true (GesdinetJWTRefreshTokenExtension.php:99-111), so this override must be removed when the option is disabled, otherwise ParameterNotFoundException.
Suggested fix
Resolve the parameter in the extension and pass a proper Reference (e.g. new Reference($config['reuse_detection']['cache'])), or use an alias.
Related: #<see companion issue on hash_tokens × reuse_detection>.
Version: gesdinet/jwt-refresh-token-bundle 3.0.0 · Symfony 8.1.5 · PHP 8.4/8.5
Summary
Enabling
reuse_detectionmakes the container compilation fail:Cause (read in the source)
config/reuse_detection.phpdesignates the cache pool withservice((string) param('gesdinet_jwt_refresh_token.reuse_detection.cache')), i.e. a literal%…%string used as a service id. Symfony'sResolveParameterPlaceHoldersPassresolves placeholders in strings, definitions and aliases, but not inside aReference— so the reference is looked up verbatim. The inline comment ("turned into the%name%placeholder service() takes") relies on a behaviour Symfony 8 (and, as far as we can tell, earlier versions) does not have.Reproduction
php bin/console lint:container→ error above.Workaround
Redefine the service in the application with the concrete pool:
Note for anyone applying it: the
reuse_detection.*parameters only exist whilereuse_detection.enabledis true (GesdinetJWTRefreshTokenExtension.php:99-111), so this override must be removed when the option is disabled, otherwiseParameterNotFoundException.Suggested fix
Resolve the parameter in the extension and pass a proper
Reference(e.g.new Reference($config['reuse_detection']['cache'])), or use an alias.Related: #<see companion issue on hash_tokens × reuse_detection>.