Support for a custom schema
It's common for new users of Spring Security to begin their experience by adapting the JDBC user, group, or role mapping to an existing schema. Even though a legacy database doesn't conform to the expected Spring Security schema, we can still configure JdbcDaoImpl
to map to it.
We will now update Spring Security's JDBC support to use our existing CalendarUser
database along with a new calendar_authorities
table.
We can easily change the configuration of JdbcUserDetailsManager
to utilize this schema and override Spring Security's expected table definitions and columns, which we're using for the JBCP calendar application.
Determining the correct JDBC SQL queries
The JdbcUserDetailsManager
class has three SQL queries that have a well-defined parameter and a set of returned columns. We must determine the SQL that we'll assign to each of these queries, based on the intended functionality. Each SQL query used by JdbcUserDetailsManager
takes the username presented at login...