Does SpringSecurity have some built-in ability to ignore the letter-case of username? For example, if the username is “student001”, then it will accept “Student001” as well as “stUdent001”.
The reason I need this is that our system use emails as usernames. Of course I would be able to do this by extending the DAOAuthenticationProvider class, but I just wonder if there’s any built-in option exists for this problem?
If you’re using the
DaoAuthenticationProviderthen I presume you’re using theJdbcDaoImplwith it, which loads users from a JDBC database.If so, you can override the SQL query that
JdbcDaoImpluses to look up users by manually creating the bean yourself. The default query that Spring Security uses is:You can use the SQL lower function to ignore case:
The appropriate Spring Security XML configuration is: