diff --git a/core/src/main/java/org/springframework/security/core/userdetails/jdbc/JdbcDaoImpl.java b/core/src/main/java/org/springframework/security/core/userdetails/jdbc/JdbcDaoImpl.java index 1ed729c331..103599900a 100644 --- a/core/src/main/java/org/springframework/security/core/userdetails/jdbc/JdbcDaoImpl.java +++ b/core/src/main/java/org/springframework/security/core/userdetails/jdbc/JdbcDaoImpl.java @@ -186,10 +186,9 @@ public class JdbcDaoImpl extends JdbcDaoSupport implements UserDetailsService { * Executes the SQL usersByUsernameQuery and returns a list of UserDetails objects. * There should normally only be one matching user. */ - @SuppressWarnings("unchecked") protected List loadUsersByUsername(String username) { - return getJdbcTemplate().query(usersByUsernameQuery, new String[] {username}, new RowMapper() { - public Object mapRow(ResultSet rs, int rowNum) throws SQLException { + return getJdbcTemplate().query(usersByUsernameQuery, new String[] {username}, new RowMapper() { + public UserDetails mapRow(ResultSet rs, int rowNum) throws SQLException { String username = rs.getString(1); String password = rs.getString(2); boolean enabled = rs.getBoolean(3); @@ -204,14 +203,13 @@ public class JdbcDaoImpl extends JdbcDaoSupport implements UserDetailsService { * * @return a list of GrantedAuthority objects for the user */ - @SuppressWarnings("unchecked") protected List loadUserAuthorities(String username) { - return getJdbcTemplate().query(authoritiesByUsernameQuery, new String[] {username}, new RowMapper() { - public Object mapRow(ResultSet rs, int rowNum) throws SQLException { + return getJdbcTemplate().query(authoritiesByUsernameQuery, new String[] {username}, new RowMapper() { + public GrantedAuthority mapRow(ResultSet rs, int rowNum) throws SQLException { String roleName = rolePrefix + rs.getString(2); GrantedAuthorityImpl authority = new GrantedAuthorityImpl(roleName); - return authority; + return authority; } }); } @@ -221,10 +219,9 @@ public class JdbcDaoImpl extends JdbcDaoSupport implements UserDetailsService { * * @return a list of GrantedAuthority objects for the user */ - @SuppressWarnings("unchecked") protected List loadGroupAuthorities(String username) { - return getJdbcTemplate().query(groupAuthoritiesByUsernameQuery, new String[] {username}, new RowMapper() { - public Object mapRow(ResultSet rs, int rowNum) throws SQLException { + return getJdbcTemplate().query(groupAuthoritiesByUsernameQuery, new String[] {username}, new RowMapper() { + public GrantedAuthority mapRow(ResultSet rs, int rowNum) throws SQLException { String roleName = getRolePrefix() + rs.getString(3); GrantedAuthorityImpl authority = new GrantedAuthorityImpl(roleName); @@ -234,7 +231,8 @@ public class JdbcDaoImpl extends JdbcDaoSupport implements UserDetailsService { } /** - * Can be overridden to customize the creation of the final UserDetailsObject returnd from loadUserByUsername. + * Can be overridden to customize the creation of the final UserDetailsObject which is + * returned by the loadUserByUsername method. * * @param username the name originally passed to loadUserByUsername * @param userFromUserQuery the object returned from the execution of the