You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an app which extends AbstractFormLoginAuthenticator for normal users login. It sends a form with user and password, gets a token, and use it to get user permissions, roles, etc...
Now I want to add api services, I tried extending JWTTokenAuthenticator and also implementing AuthenticatorInterface but I couldn't intercept the login to use my custom code to login (and save the extradata somewhere, so I could reload it in UserCheckerInterface.
My security.yaml looks has:
firewalls:
api_login:
pattern: ^/api/login
# user_checker: App\Security\MyUserChecker
stateless: true
anonymous: true
json_login: # or form_login
provider: app_user_provider #or your custom user provider
check_path: /api/login_check #same as the configured route
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure
require_previous_session: false
username_path: username
password_path: password
guard:
authenticators:
# - lexik_jwt_authentication.jwt_token_authenticator
- App\Security\ApiTokenAuthenticator
provider: app_user_provider #or your custom user provider
api:
pattern: ^/api/v1 # protected path
stateless: true
guard:
authenticators:
# - lexik_jwt_authentication.jwt_token_authenticator
- App\Security\ApiTokenAuthenticator
provider: app_user_provider #or your custom user provider
I suppose I should modify json_login; but I could find how.
I am using symfony 4.4 currently; I found #372 but it's an old entry and hasn't a solution.
This discussion was converted from issue #997 on April 19, 2022 18:53.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have an app which extends
AbstractFormLoginAuthenticator
for normal users login. It sends a form with user and password, gets a token, and use it to get user permissions, roles, etc...Now I want to add api services, I tried extending
JWTTokenAuthenticator
and also implementingAuthenticatorInterface
but I couldn't intercept the login to use my custom code to login (and save the extradata somewhere, so I could reload it inUserCheckerInterface
.My security.yaml looks has:
I suppose I should modify
json_login
; but I could find how.I am using symfony 4.4 currently; I found #372 but it's an old entry and hasn't a solution.
Beta Was this translation helpful? Give feedback.
All reactions