Skip to content
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

DefaultAuthenticationEventPublisher should allow configuring a default event #7825

Closed
jzheaux opened this issue Jan 14, 2020 · 2 comments
Closed
Assignees
Labels
in: web An issue in web modules (web, webmvc) type: enhancement A general enhancement
Milestone

Comments

@jzheaux
Copy link
Contributor

jzheaux commented Jan 14, 2020

DefaultAuthenticationEventPublisher will drop any exceptions that it doesn't have mapped. This means that an application needs to use setAdditionalExceptionMappings to provide any mappings not provided by default.

It would be nice to be able to configure a default event that gets fired for any unmapped exceptions:

DefaultAuthenticationEventPublisher publisher = new DefaultAuthenticationEventPublisher();
publisher.setDefaultAuthenticationFailureEvent(AuthenticationFailureBadCredentialsEvent.class);

With the above configuration, an AuthenticationFailureBadCredentialsEvent would be fired in the event that the published exception doesn't map to anything in DefaultAuthenticationEventPublishers mappings.

DefaultAuthenticationEventPublisher would change at around this point:

if (constructor != null) {
    try {
        event = constructor.newInstance(exception, authentication);
    } catch // ...
}

Where the event gets constructed.

@jzheaux jzheaux added in: web An issue in web modules (web, webmvc) type: enhancement A general enhancement status: first-timers-only An issue that can only be worked on by brand new contributors labels Jan 14, 2020
@jzheaux jzheaux self-assigned this Jan 14, 2020
@zeeshanadnan
Copy link
Contributor

zeeshanadnan commented Feb 1, 2020

@jzheaux if nobody is currently working on this can i work on this?

@jzheaux
Copy link
Contributor Author

jzheaux commented Feb 4, 2020

Yes, sir! It's yours.

@jzheaux jzheaux removed the status: first-timers-only An issue that can only be worked on by brand new contributors label Feb 4, 2020
zeeshanadnan added a commit to zeeshanadnan/spring-security that referenced this issue Feb 6, 2020
@jzheaux jzheaux closed this as completed in 51b9b2f Feb 6, 2020
jzheaux added a commit that referenced this issue Feb 6, 2020
Simplified the constructor selection logic.

Issue gh-7825
@jzheaux jzheaux added this to the 5.3.0 milestone Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web An issue in web modules (web, webmvc) type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants