Fix typos in FAQ docs

This commit is contained in:
Eleftheria Stein 2021-06-15 15:32:17 +02:00
parent e89db9fd69
commit 1b72e9d4e0
1 changed files with 8 additions and 7 deletions

View File

@ -545,17 +545,18 @@ To use JDBC instead, you can implement the interface yourself, using whatever SQ
JdbcTemplate template; JdbcTemplate template;
List<GrantedAuthority> getGrantedAuthorities(DirContextOperations userData, String username) { List<GrantedAuthority> getGrantedAuthorities(DirContextOperations userData, String username) {
List<GrantedAuthority> = template.query("select role from roles where username = ?", return template.query("select role from roles where username = ?",
new String[] {username}, new String[] {username},
new RowMapper<GrantedAuthority>() { new RowMapper<GrantedAuthority>() {
/** /**
* We're assuming here that you're using the standard convention of using the role * We're assuming here that you're using the standard convention of using the role
* prefix "ROLE_" to mark attributes which are supported by Spring Security's RoleVoter. * prefix "ROLE_" to mark attributes which are supported by Spring Security's RoleVoter.
*/ */
@Override
public GrantedAuthority mapRow(ResultSet rs, int rowNum) throws SQLException { public GrantedAuthority mapRow(ResultSet rs, int rowNum) throws SQLException {
return new SimpleGrantedAuthority("ROLE_" + rs.getString(1); return new SimpleGrantedAuthority("ROLE_" + rs.getString(1));
} }
} });
} }
} }
@ -580,7 +581,7 @@ The processor class would look like this:
[source,java] [source,java]
---- ----
public class BeanPostProcessor implements BeanPostProcessor { public class CustomBeanPostProcessor implements BeanPostProcessor {
public Object postProcessAfterInitialization(Object bean, String name) { public Object postProcessAfterInitialization(Object bean, String name) {
if (bean instanceof UsernamePasswordAuthenticationFilter) { if (bean instanceof UsernamePasswordAuthenticationFilter) {