Skip to content

AuthenticationSuccessEvent not published for oauth2Login()Β #6009

Closed

Description

@mbhave

On running the OAuth2 Sample, there was no AuthenticationSuccessEvent since the ProviderManager seems to be using a NullEventPublisher.

Activity

  1. philwebb commented on Oct 22, 2018

    @philwebb
    Member
  2. ismarslomic commented on Oct 22, 2018

    @ismarslomic

    *FailureEvents are published though. So the issue is related to *SuccessEvents only

  3. jgrandja commented on Oct 22, 2018

    @jgrandja
    Collaborator

    An AuthenticationManagerBuilder @Bean is registered via AuthenticationConfiguration.authenticationManagerBuilder(). It's also associated with the AuthenticationEventPublisher registered in the context using AuthenticationManagerBuilder.authenticationEventPublisher().

    However, WebSecurityConfigurerAdapter.setApplicationContext() initializes 2 instances of AuthenticationManagerBuilder, but does not associate it with the AuthenticationEventPublisher registered in the context.

    We need to ensure that the initialization and association of the AuthenticationEventPublisher (registered in the context) is consistent between AuthenticationConfiguration and WebSecurityConfigurerAdapter.

  4. self-assigned this
    on Oct 22, 2018
  5. ismarslomic commented on Oct 22, 2018

    @ismarslomic

    @jgrandja thanks! I will gladly retest and report back, when you have a fix. Any idea on how complex and time consuming it will be? Just so I know if I should wait for a fix, or go ahead and use something else for Audit logging.

    Edit: workarounds are also welcome :)

  6. added
    in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)
    on Oct 23, 2018
  7. added this to the 5.2.0.M1 milestone on Oct 23, 2018
  8. changed the title [-]AuthenticationSuccessEvent not published in case of OAuth2 login[/-] [+]AuthenticationSuccessEvent not published for oauth2Login()[/+] on Oct 23, 2018
  9. added 2 commits that reference this issue on Oct 23, 2018
    8971777
    d6da4d2
  10. jgrandja commented on Oct 23, 2018

    @jgrandja
    Collaborator

    @ismarslomic The fix has been applied to master and backported to 5.1.2 and 5.0.10.

  11. ismarslomic commented on Oct 23, 2018

    @ismarslomic

    After retest (with 5.1.2.BUILD-SNAPSHOT): I can confirm AuthenticationSuccessEvents er being published, and I can also find AUTHENTICATION_SUCCESS events at Actuator endpoint /auditevents. Thanks a lot for quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)type: bugA general bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions