You can try to extend the StandardSecurityConfiguration (which actually extends WebSecurityConfigurerAdapter) from Jmix so that it overrides its void configure(AuthenticationManagerBuilder auth). In this method register your own AuthenticationProvider instead of standard DaoAuthenticationProvider.
@Configuration
@EnableWebSecurity
public class MySecurityConfiguration extends StandardSecurityConfiguration {
@Autowired
private UserRepository userRepository;
@Autowired
private PasswordEncoder passwordEncoder;
@Autowired
private PreAuthenticationChecks preAuthenticationChecks;
@Autowired
private PostAuthenticationChecks postAuthenticationChecks;
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(new SystemAuthenticationProvider(userRepository));
auth.authenticationProvider(new SubstitutedUserAuthenticationProvider(userRepository));
MyAuthenticationProvider daoAuthenticationProvider = new MyAuthenticationProvider();
daoAuthenticationProvider.setUserDetailsService(userRepository);
daoAuthenticationProvider.setPasswordEncoder(passwordEncoder);
daoAuthenticationProvider.setPreAuthenticationChecks(preAuthenticationChecks);
daoAuthenticationProvider.setPostAuthenticationChecks(postAuthenticationChecks);
auth.authenticationProvider(daoAuthenticationProvider);
}
}
public class MyAuthenticationProvider extends DaoAuthenticationProvider {
private static final Logger log = LoggerFactory.getLogger(MyAuthenticationProvider.class);
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
log.info("Custom authentication");
return super.authenticate(authentication);
}
}