I’m trying to setup security based on LDAP and JWT. Everything seems to be working well excepted I have to override the success handler from LexikBundle to feat with the custom JWT provider I’m using https://github.com/lexik/LexikJWTAuthenticationBundle/blob/2.x/Security/Http/Authentication/AuthenticationSuccessHandler.php
Here security.yaml:
security:
enable_authenticator_manager: true
role_hierarchy:
ROLE_READER: ROLE_USER
ROLE_ADMIN: ROLE_READER
providers:
users:
id: AppSecurityUserProvider
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js|docs)/
security: false
login:
pattern: ^/login
provider: users
stateless: true
entry_point: json_login_ldap
json_login_ldap:
service: SymfonyComponentLdapLdap
check_path: login_check
dn_string: 'uid={username},%env(LDAP_USER_DN)%'
success_handler: app.security.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure
require_previous_session: false
status:
pattern: ^/status
provider: ~
stateless: true
main:
pattern: ^/
provider: custom_jwt
stateless: true
entry_point: jwt
jwt: ~
refresh_jwt:
check_path: /login_refresh
This is working well to connect with the generated token. Otherwise I would need to override the refresh token success handler as well (I’m using Gesdinet https://packagist.org/packages/gesdinet/jwt-refresh-token-bundle).
How to achieve that?? I would need to override the success handler from Lexik everywhere it’s called. I believed this would work in service.yaml
but it does not:
LexikBundleJWTAuthenticationBundleSecurityHttpAuthenticationAuthenticationSuccessHandler:
class: AppSecurityHandlerAuthenticationSuccessHandler