Skip to content

Instantly share code, notes, and snippets.

@ssisaias
Created December 4, 2016 05:15
Show Gist options
  • Save ssisaias/1aa49ba0eed6ffb6b786a5ed9bd99bb3 to your computer and use it in GitHub Desktop.
Save ssisaias/1aa49ba0eed6ffb6b786a5ed9bd99bb3 to your computer and use it in GitHub Desktop.
SpringSecurity(4.1.3) Many Table Login example
//Login config
@Autowired
public void configAuthentication(AuthenticationManagerBuilder auth_1, AuthenticationManagerBuilder auth_2) throws Exception {
auth_1.jdbcAuthentication().dataSource(dataSource)
.usersByUsernameQuery(
"select login,password,1 from table1 where login=?")
.authoritiesByUsernameQuery(
"select login,role from table1 where login=?");
auth_2.jdbcAuthentication().dataSource(dataSource)
.usersByUsernameQuery(
"select login,password,1 from table2 where login=?")
.authoritiesByUsernameQuery(
"select login,role from table2 where login=?");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment