8000 [Security] AuthenticationException not implementing ExceptionInterface · Issue #25770 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Security] AuthenticationException not implementing ExceptionInterface #25770

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
paq85 opened this issue Jan 11, 2018 · 6 comments
Closed

[Security] AuthenticationException not implementing ExceptionInterface #25770

paq85 opened this issue Jan 11, 2018 · 6 comments
Labels

Comments

@paq85
Copy link
paq85 commented Jan 11, 2018

Is there any reason why \Symfony\Component\Security\Core\Exception\AuthenticationException does not implement \Symfony\Component\Security\Core\Exception\ExceptionInterface?

I would like to be able to catch all kind of Security related exceptions simply by using

} catch (\Symfony\Component\Security\Core\Exception\ExceptionInterface $sex) {

and I'm not able to catch for example \Symfony\Component\Security\Core\Exception\BadCredentialsException using that catch

Cheers.

@sroze
Copy link
Contributor
sroze commented Jan 11, 2018

Oups, that's a good point. I think this should be fixed as it's this way for the other components.

@sroze
< 8000 details-menu class="dropdown-menu dropdown-menu-sw show-more-popover color-fg-default" style="width:185px" src="" preload > Copy link
Contributor
sroze commented Jan 11, 2018

See #25772

@unkind
Copy link
Contributor
unkind commented Jan 12, 2018

I would like to be able to catch all kind of Security related exceptions

@paq85 I'm curious, what's the use case?

@paq85
Copy link
Author
paq85 commented Jan 12, 2018

@unkind I have a controller where I'm authenticating user.
That requires a couple of things. Among them I'm using \Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager and I would like to know in case of a failure if that was the Security component that failed or was it for example an issue with the database or some other service.

@unkind
Copy link
Contributor
unkind commented Jan 12, 2018

@paq85 you show user that it's his fault or something? Because this exception is from the Security component?

@paq85
Copy link
Author
paq85 commented Jan 12, 2018

@unkind it's usefull for me to handle the error the way I want (log properly, take some "rescue" action) and to decide what message should I show the client/user

@fabpot fabpot closed this as completed Feb 7, 2018
fabpot added a commit that referenced this issue Feb 7, 2018
…ts Security's ExceptionInterface (sroze)

This PR was merged into the 4.1-dev branch.

Discussion
----------

[Security] The AuthenticationException should implements Security's ExceptionInterface

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #25770
| License       | MIT
| Doc PR        | ø

Dunno why this is the case right now but this probably should not. Was reported by @paq85.

Commits
-------

0ee4cf1 The Security Component's exceptions should implements Security's ExceptionInterface
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants
0