Lorenzo Tramuto
Lorenzo Tramuto

Reputation: 31

Jhipster and Spring Security - Add Authentication provider leaving active default jdbcauthentication mode

I've added a custom LDAP authentication provider mechanism to my jHipster application. Without insert any configureGlobal(AuthenticationManagerBuilder auth) or configureGlobal(AuthenticationManagerBuilder auth) method to SecurityConfiguration class, but with @Component annotation on my custom AuthenticationProvider implementation, the new authentication work fine, but, I lose the default authentication with users on database.

I try to add this on securityConfiguration:

@Inject
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
    super.configure(auth);
    auth.authenticationProvider(aDauthenticationProvider);
}

but the result is the same, I lose the database authentication.

How could I add the default auth mechanism to the list of providers of AuthenticationManagerBuilder?

Thanks

Upvotes: 1

Views: 373

Answers (1)

Lorenzo Tramuto
Lorenzo Tramuto

Reputation: 31

I've found the solution, I write this if someone have my same issue.

It's sufficient to add this code line on GlobalConfigure method:

auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder());

to add the predefined JDBC authentication method to the list of authentication providers.

Upvotes: 1

Related Questions