|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate3.support.HibernateDaoSupport
org.riotfamily.riot.hibernate.dao.AbstractHibernateRiotDao
org.riotfamily.riot.hibernate.dao.AbstractHqlDao
org.riotfamily.riot.hibernate.dao.HqlDao
org.riotfamily.riot.hibernate.security.HibernateUserDao
public class HibernateUserDao
RiotUserDao that performs look-ups via Hibernate.
Field Summary | |
---|---|
static String |
DEFAULT_PASSWORD
|
static String |
DEFAULT_USERNAME
|
Fields inherited from class org.springframework.dao.support.DaoSupport |
---|
logger |
Constructor Summary | |
---|---|
HibernateUserDao(org.hibernate.SessionFactory sessionFactory)
|
Method Summary | |
---|---|
protected boolean |
anyUserExists()
Returns whether any user exists in the database. |
protected RiotUser |
findInitialUser(String userId)
If no user exists, the given userId is compared with the one of the initial user. |
protected RiotUser |
findInitialUser(String username,
String password)
If no user exists, the given credentials are compared with the ones of the initial user. |
RiotUser |
findUserByCredentials(String username,
String password)
Performs a database lookup with the given credentials. |
RiotUser |
findUserById(String userId)
Performs a database lookup with the given userId. |
protected String |
hashPassword(String plainText)
Hashes the given password. |
protected void |
initDao()
Creates (or validates) the initial user. |
void |
save(Object entity,
Object parent)
Invokes hashNewPassword(Object) and delegates the call to the
super method. |
void |
setEntityClass(Class<?> entityClass)
Sets the user class. |
void |
setHashPasswords(boolean hashPasswords)
Sets whether hashed passwords should be used instead of plain text. |
void |
setInitialUser(RiotUser initialUser)
Sets the initial user object that is persisted when no other user exists. |
void |
setNewPasswordProperty(String newPasswordProperty)
Sets the name of the (transient) property that holds the new plain text password. |
void |
setPasswordProperty(String passwordProperty)
Sets the name of the property that holds the (possibly hashed) password. |
void |
setUsernameProperty(String usernameProperty)
Sets the name of the property that holds the username. |
void |
update(Object entity)
Invokes hashNewPassword(Object) and delegates the call to the
super method. |
void |
updatePassword(RiotUser user,
String newPassword)
|
Methods inherited from class org.riotfamily.riot.hibernate.dao.HqlDao |
---|
buildMaxPositionHql, getEntityClass, getOrderBy, getSelect, getWhere, isPolymorph, isSetPositionOnSave, setPolymorph, setPositionIfNeeded, setPositionProperty, setSelect, setSetPositionOnSave, setWhere, swapEntity |
Methods inherited from class org.riotfamily.riot.hibernate.dao.AbstractHqlDao |
---|
buildCountHql, buildHql, getFilterWhereClause, getFrom, getListSize, getSearchWhereClause, getWhereClause, isPrefixSearch, isSuffixSearch, listInternal, setFilterParameters, setQueryParameters |
Methods inherited from class org.riotfamily.riot.hibernate.dao.AbstractHibernateRiotDao |
---|
delete, getObjectId, list, load, merge |
Methods inherited from class org.springframework.orm.hibernate3.support.HibernateDaoSupport |
---|
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory |
Methods inherited from class org.springframework.dao.support.DaoSupport |
---|
afterPropertiesSet |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.riotfamily.riot.dao.RiotDao |
---|
delete, getEntityClass, getListSize, getObjectId, list, load, merge |
Field Detail |
---|
public static final String DEFAULT_USERNAME
public static final String DEFAULT_PASSWORD
Constructor Detail |
---|
public HibernateUserDao(org.hibernate.SessionFactory sessionFactory)
Method Detail |
---|
public void setEntityClass(Class<?> entityClass)
setEntityClass
in class HqlDao
IllegalArgumentException
- if the given class does not implement
the RiotUser
interface.public void setUsernameProperty(String usernameProperty)
findUserByCredentials(String, String)
to look up
a user upon login.
public void setPasswordProperty(String passwordProperty)
findUserByCredentials(String, String)
to look up a user upon login.
public void setHashPasswords(boolean hashPasswords)
true
.
hashPassword(String)
public void setNewPasswordProperty(String newPasswordProperty)
hashed passwords
are
used, this property is checked upon updates. If the property contains a
non null value, this value is used to create a new password hash.
public void setInitialUser(RiotUser initialUser)
null
(default), a new instance of the
entity class
is created via reflection.
protected void initDao() throws Exception
Note: The user is not saved to the database at this point, as this
method is not invoked within a transaction. The user will be persisted
when findUserByCredentials(String, String)
or
findUserById(String)
is called and the database does not
contain any user objects.
initDao
in class DaoSupport
Exception
protected String hashPassword(String plainText)
public void updatePassword(RiotUser user, String newPassword)
updatePassword
in interface RiotUserDao
public RiotUser findUserByCredentials(String username, String password)
findInitialUser(String, String)
is called.
findUserByCredentials
in interface RiotUserDao
protected RiotUser findInitialUser(String username, String password)
public RiotUser findUserById(String userId)
findInitialUser(String)
is called.
findUserById
in interface RiotUserDao
protected RiotUser findInitialUser(String userId)
protected boolean anyUserExists()
public void save(Object entity, Object parent)
hashNewPassword(Object)
and delegates the call to the
super method.
save
in interface RiotDao
save
in class HqlDao
public void update(Object entity)
hashNewPassword(Object)
and delegates the call to the
super method.
update
in interface RiotDao
update
in class AbstractHibernateRiotDao
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |