Modifying authentication managers

Spring Security provides some configuration helpers to set up authentication manager features in your application. This will help to get the features quickly. AuthenticationManagerBuilder helps to modify the authentication managers.

Here is an example of how to implement AuthenticationManagerBuilder in the ApplicationSecurity.kt class:

class ApplicationSecurity: WebSecurityConfigurerAdapter() {
@Autowired
fun initialize(builder: AuthenticationManagerBuilder, dataSource: DataSource){
builder.jdbcAuthentication().dataSource(dataSource).withUser("Sunnat629").password("packtPub").roles("USER")
}
}

Here, we have given a username, sunnat629, and a password, packtPub, as a USER role in this application.

Spring Boot accompanies a default global AuthenticationManager, which is sufficiently secure. You can supplant it by giving your own AuthenticationManager bean.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.148.144.228