{"action":"created","issue":{"url":"https://api.github.com/repos/spring-projects/spring-security/issues/3714","repository_url":"https://api.github.com/repos/spring-projects/spring-security","labels_url":"https://api.github.com/repos/spring-projects/spring-security/issues/3714/labels{/name}","comments_url":"https://api.github.com/repos/spring-projects/spring-security/issues/3714/comments","events_url":"https://api.github.com/repos/spring-projects/spring-security/issues/3714/events","html_url":"https://github.com/spring-projects/spring-security/issues/3714","id":135983932,"number":3714,"title":"Events fired multiple times with chained ProviderManagers","user":{"login":"mdeinum","id":606761,"avatar_url":"https://avatars.githubusercontent.com/u/606761?v=3","gravatar_id":"","url":"https://api.github.com/users/mdeinum","html_url":"https://github.com/mdeinum","followers_url":"https://api.github.com/users/mdeinum/followers","following_url":"https://api.github.com/users/mdeinum/following{/other_user}","gists_url":"https://api.github.com/users/mdeinum/gists{/gist_id}","starred_url":"https://api.github.com/users/mdeinum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdeinum/subscriptions","organizations_url":"https://api.github.com/users/mdeinum/orgs","repos_url":"https://api.github.com/users/mdeinum/repos","events_url":"https://api.github.com/users/mdeinum/events{/privacy}","received_events_url":"https://api.github.com/users/mdeinum/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-24T07:38:07Z","updated_at":"2016-02-24T14:49:21Z","closed_at":null,"body":"In one of our applications we have a couple of `ApplicationListener` implementations which operate on certain events from Spring Security. One is for logging and another is for disabling the user after a number of failed login attempts. \r\n\r\nWe noticed that the `AuthenticationSuccessEvent` and `AuthenticationFailureBadCredentialsEvent` where fired multiple times. After some debugging we noticed that there where chained `ProviderManager`s, the first only contained an `AnonymousAuthenticationProvider`, the second was empty and the third contained the `DaoAuthenticationProvider`. The last one failed to authenticate the user, which resulted in a failure and all `ProviderManager`s handling that exception. \r\n\r\nWe use Spring Boot for configuration (using OAuth2) and for that we use a form to authenticate the user, this resulted in that chain. After doing some modification to our configuration we managed to reduce the chain to 2 chained `ProviderManager`s instead of 3 (we eleminated the empty one) and this appears to resolve it. \r\n\r\nHowever I wonder is this the intended behavior of should only the inner or outer most `ProviderManager` handle the exception? "},"comment":{"url":"https://api.github.com/repos/spring-projects/spring-security/issues/comments/188286087","html_url":"https://github.com/spring-projects/spring-security/issues/3714#issuecomment-188286087","issue_url":"https://api.github.com/repos/spring-projects/spring-security/issues/3714","id":188286087,"user":{"login":"rwinch","id":362503,"avatar_url":"https://avatars.githubusercontent.com/u/362503?v=3","gravatar_id":"","url":"https://api.github.com/users/rwinch","html_url":"https://github.com/rwinch","followers_url":"https://api.github.com/users/rwinch/followers","following_url":"https://api.github.com/users/rwinch/following{/other_user}","gists_url":"https://api.github.com/users/rwinch/gists{/gist_id}","starred_url":"https://api.github.com/users/rwinch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwinch/subscriptions","organizations_url":"https://api.github.com/users/rwinch/orgs","repos_url":"https://api.github.com/users/rwinch/repos","events_url":"https://api.github.com/users/rwinch/events{/privacy}","received_events_url":"https://api.github.com/users/rwinch/received_events","type":"User","site_admin":false},"created_at":"2016-02-24T14:49:21Z","updated_at":"2016-02-24T14:49:21Z","body":"@mdeinum Thanks for reporting the issue!\r\n\r\nAt first glance this appears to be a bug. We should only be firing a single event.\r\n\r\nAny chance you would be interested in figuring out a PR for this?"}}