Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Convert InsufficientAuthenticationException to HttpException with 401 status code#28801
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
dunglas left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
👍 when tests will be added
Koc commentedOct 11, 2018
seems like this PR also fixes#8467, but not sure |
nicolas-grekas commentedOct 17, 2018
@Koc I'm linking your issue as being fixed by this PR. I'll let you reopen an issue if that's not the case. |
fabpot commentedOct 17, 2018
Thank you@vincentchalamon. |
…on with 401 status code (vincentchalamon)This PR was merged into the 2.8 branch.Discussion----------Convert InsufficientAuthenticationException to HttpException with 401 status code| Q | A| ------------- | ---| Branch? | 2.8| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed ticket |#8467| License | MITI was trying to implement the `json_login` authentication and test it with an API Platform project. When I call a secured endpoint without authentication, an InsufficientAuthenticationException is thrown with a 500 status code instead of a 401.After some researches with@dunglas, there is no default `entrypoint` on the security firewall. As one already exists for `form_login` in the FormLoginFactory, this component might need a default one to convert this 500 exception to a correct 401 HTTP error.Thisfixes#25806 (comment).Commits-------4503ac8 Convert InsufficientAuthenticationException to HttpException
Rebolon commentedOct 18, 2018
The problem also exist in 4+ branch, does the fix solve the issue in recent version of Sf ? |
dunglas commentedOct 18, 2018
@Rebolon I think so, old branches are merged in the newer ones on a regular basis. |
gitnik commentedNov 22, 2018
Hey guys, this actually broke some of our code as we caught this specific exception and converted it to a 401 ourselves. With this change it turned into a 500 essentially reversing our scenario. |
ganoch commentedMar 14, 2019
@gitnik nice, your case was bound to happen as this issue has been present for quite some time now. I must say your original fix is now the root of your problem. Do you mind telling how you fixed your new issue? |
gitnik commentedMar 14, 2019
Now we just catch the generic |
Rebolon commentedAug 8, 2019
There is the same kind of missing feature with this Symfony Exception: I opened an issue in ApiPlatformhttps://github.com/api-platform/api-platform/issues/1213 |
Uh oh!
There was an error while loading.Please reload this page.
I was trying to implement the
json_loginauthentication and test it with an API Platform project. When I call a secured endpoint without authentication, an InsufficientAuthenticationException is thrown with a 500 status code instead of a 401.After some researches with@dunglas, there is no default
entrypointon the security firewall. As one already exists forform_loginin the FormLoginFactory, this component might need a default one to convert this 500 exception to a correct 401 HTTP error.Thisfixes#25806 (comment).