0

When we use xml based configuration for Spring Security we are able to use <jdbc-user-service> tag with attributes authorities-by-username-query and users-by-username-query to get username, password and role from database for a specific username input.

Reference: http://docs.spring.io/spring-security/site/docs/3.2.5.RELEASE/reference/htmlsingle/#nsa-jdbc-user-service

The code given in Spring Security documentation for Java Configuration seem to be using hard-coded username & password.

Reference: http://docs.spring.io/spring-security/site/docs/3.2.5.RELEASE/reference/htmlsingle/#jc-authentication-jdbc

The related sample project (spring-security / samples / jdbc-jc) also appears to use the same hard-coded username & password values.

So with Java Configuration, how can we validate the user input with user credentials stored in a database?

Blesson Jose
  • 698
  • 9
  • 14

1 Answers1

3

Looks like you're looking for JdbcDaoImpl class with his setters setAuthoritiesByUsernameQuery() and setUsersByUsernameQuery().

Slava Semushin
  • 14,904
  • 7
  • 53
  • 69