More missing/changed/undocumented functionality: login events

There is information about standard Spring authentication events in the docs: Authentication :: Jmix Documentation.

There are also io.jmix.core.security.event.PreAuthenticationCheckEvent and io.jmix.core.security.event.PostAuthenticationCheckEvent that are not yet included in the docs.

Perhaps you can use PreAuthenticationCheckEvent, see for example how it’s used in the LDAP add-on:

@EventListener
public void onPreAuthenticationCheckEvent(PreAuthenticationCheckEvent event) {
    if (!ldapProperties.getStandardAuthenticationUsers().contains(event.getUser().getUsername())) {
        throw new BadCredentialsException("Current user cannot be authenticated via standard authentication");
    }
}

Regards,
Konstantin

1 Like