O'Reilly logo

Hands-On High Performance with Spring 5 by Dinesh Radadiya, Prashant Goswami, Pritesh Shah, Subhash Shah, Chintan Mehta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Providing AuthenticationProvider to AuthenticationManagerBuilder

Now, let's provide AuthenticationProvider to AuthenticationManagerBuilder in the Spring Security configuration class:

@Autowired    @Override    protected void configure(AuthenticationManagerBuilder auth) throws         Exception {               auth         .eraseCredentials(false)         //Providing AuthenticationProvider to           AuthenticationManagerBuilder.         .authenticationProvider(authenticationProviderBean())         .jdbcAuthentication()         .dataSource(dataSource);     }

Now, let's call that API and check the performance of authentication. If we call the API four times, the following log will be generated:

22:46:55.314 RDS DEBUG EhCacheBasedUserCache - Cache hit: false; username: cust00122:46:55.447 RDS DEBUG JdbcTemplate - Executing ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required