Created
December 1, 2020 10:26
-
-
Save ahndmal/4468faefbb0734ec4170ff72013f3acf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@EnableWebSecurity | |
public class JdbcSecurityConfiguration extends WebSecurityConfigurerAdapter { | |
... | |
protected void configure(AuthenticationManagerBuilder auth) throws Exception { | |
auth | |
.jdbcAuthentication() | |
.dataSource(dataSource) | |
.passwordEncoder(passwordEncoder()) | |
.usersByUsernameQuery( | |
"SELECT username, password, enabled from users where username = ?") | |
.authoritiesByUsernameQuery( | |
"SELECT u.username, a.authority " + | |
"FROM user_authorities a, users u " + | |
"WHERE u.username = ? " + | |
"AND u.id = a.user_id" | |
); | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment