Simplified sub-class usage. Made compatible with changes to User constructor.
This commit is contained in:
parent
b332c3bc03
commit
ea05e0b931
|
@ -54,8 +54,8 @@ public class JdbcDaoImpl extends JdbcDaoSupport implements AuthenticationDao {
|
||||||
|
|
||||||
//~ Instance fields ========================================================
|
//~ Instance fields ========================================================
|
||||||
|
|
||||||
private AuthoritiesByUsernameQuery authoritiesByUsernameQuery;
|
protected AuthoritiesByUsernameQuery authoritiesByUsernameQuery;
|
||||||
private UsersByUsernameQuery usersByUsernameQuery;
|
protected UsersByUsernameQuery usersByUsernameQuery;
|
||||||
|
|
||||||
//~ Methods ================================================================
|
//~ Methods ================================================================
|
||||||
|
|
||||||
|
@ -82,24 +82,9 @@ public class JdbcDaoImpl extends JdbcDaoSupport implements AuthenticationDao {
|
||||||
user.isEnabled(), arrayAuths);
|
user.isEnabled(), arrayAuths);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setAuthoritiesByUsernameQuery(
|
|
||||||
AuthoritiesByUsernameQuery authoritiesByUsernameQuery) {
|
|
||||||
this.authoritiesByUsernameQuery = authoritiesByUsernameQuery;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setUsersByUsernameQuery(
|
|
||||||
UsersByUsernameQuery usersByUsernameQuery) {
|
|
||||||
this.usersByUsernameQuery = usersByUsernameQuery;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void initDao() throws ApplicationContextException {
|
protected void initDao() throws ApplicationContextException {
|
||||||
if (usersByUsernameQuery == null) {
|
usersByUsernameQuery = new UsersByUsernameQuery(getDataSource());
|
||||||
usersByUsernameQuery = new UsersByUsernameQuery(getDataSource());
|
authoritiesByUsernameQuery = new AuthoritiesByUsernameQuery(getDataSource());
|
||||||
}
|
|
||||||
|
|
||||||
if (authoritiesByUsernameQuery == null) {
|
|
||||||
authoritiesByUsernameQuery = new AuthoritiesByUsernameQuery(getDataSource());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//~ Inner Classes ==========================================================
|
//~ Inner Classes ==========================================================
|
||||||
|
@ -140,7 +125,8 @@ public class JdbcDaoImpl extends JdbcDaoSupport implements AuthenticationDao {
|
||||||
String username = rs.getString("username");
|
String username = rs.getString("username");
|
||||||
String password = rs.getString("password");
|
String password = rs.getString("password");
|
||||||
boolean enabled = rs.getBoolean("enabled");
|
boolean enabled = rs.getBoolean("enabled");
|
||||||
User user = new User(username, password, enabled, null);
|
User user = new User(username, password, enabled,
|
||||||
|
new GrantedAuthority[] {new GrantedAuthorityImpl("HOLDER")});
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue