Here is a collection of frequently asked questions about TidBits:
TidBits itself does not manage your users for you, but relies on the
Acegi Security System to handle authentication and
authorization. This means you have the full power and flexibility of Acegi available for configuring
user access to your TidBits deployment. By default, TidBits comes configured to use an in-memory,
hard-coded list of users and passwords. These are stored in the WEB-INF/classes/securityContext.xml
configuration file, which contains the complete Acegi configuration for the TidBits application.
To add or modify users for the in-memory, hard-coded list of users, simply modify the userMap
property of the inMemoryDao
bean. For example, to add a new user user2
with a password of password, the configuration would look like this:
<bean id="inMemoryDaoImpl" class="org.acegisecurity.userdetails.memory.InMemoryDaoImpl"> <property name="userMap"> <value> test=test,ROLE_USER user2=password,ROLE_USER </value> </property> </bean>
Yes. You need to simply un-comment out two lines from the default securityContext.xml file
to enabled MD5-encrypted passwords. Look for the phrase passwordEncoder
in the
securityContext.xml file, and make sure those lines are not commented out. Then you must
encrypt the passwords used by the inMemoryDaoImpl
bean as MD5 hashes. The whole
configuration would look like this:
<bean id="testDaoAuthenticationProvider" class="org.acegisecurity.providers.dao.DaoAuthenticationProvider"> <property name="userDetailsService" ref="inMemoryDaoImpl"/> <property name="userCache" ref="userCache"/> <property name="passwordEncoder" ref="passwordEncoder"/> </bean> <bean id="passwordEncoder" class="org.acegisecurity.providers.encoding.Md5PasswordEncoder"/> <bean id="inMemoryDaoImpl" class="org.acegisecurity.userdetails.memory.InMemoryDaoImpl"> <property name="userMap"> <value> test=098f6bcd4621d373cade4e832627b4f6,ROLE_USER </value> </property> </bean>
Most operating systems come with a MD5 utility that you can use to generate the MD5 hash
values. For example on OS X you can execute the md5
utility like this:
$ md5 -s test MD5 ("test") = 098f6bcd4621d373cade4e832627b4f6
Yes. Consult the Acegi documentation for detailed information on how to configure an
LDAP provider. Note that TidBits uses the 1.0.1 release of Acegi; some LDAP-related configurations
changed between the 1.0RC releases and the final 1.0 release. Here is an example of an LDAP
configuration that uses the businessCategory
attribute of the
groupOfUniqueNames
object class to store the user roles,
and the uid
attribute of the inetOrgPerson
class to store
the user logins:
<bean id="authenticationManager" class="org.acegisecurity.providers.ProviderManager"> <property name="providers"> <list> <ref local="ldapAuthProvider"/> <ref local="testDaoAuthenticationProvider"/> <ref local="anonymousAuthenticationProvider"/> </list> </property> </bean> <bean id="ldapUserSearch" class="org.acegisecurity.ldap.search.FilterBasedLdapUserSearch"> <constructor-arg index="0" value="ou=People"/> <constructor-arg index="1" value="(uid={0})"/> <constructor-arg index="2" ref="ldapInitialDirContextFactory" /> <property name="searchSubtree" value="false"/> </bean> <bean id="ldapAuthProvider" class="org.acegisecurity.providers.ldap.LdapAuthenticationProvider"> <constructor-arg> <bean class="org.acegisecurity.providers.ldap.authenticator.BindAuthenticator"> <constructor-arg ref="ldapInitialDirContextFactory"/> <property name="userSearch" ref="ldapUserSearch"/> </bean> </constructor-arg> <constructor-arg> <bean class="org.acegisecurity.providers.ldap.populator.DefaultLdapAuthoritiesPopulator"> <constructor-arg ref="ldapInitialDirContextFactory"/> <constructor-arg value="ou=Groups"/> <property name="groupSearchFilter" value="(uniqueMember={0})"/> <property name="groupRoleAttribute" value="businessCategory"/> <property name="defaultRole" value="ROLE_USER"/> </bean> </constructor-arg> </bean> <bean id="ldapInitialDirContextFactory" class="org.acegisecurity.ldap.DefaultInitialDirContextFactory"> <constructor-arg value="ldap://ldap.server:389/dc=mydomain,dc=com"/> <property name="managerDn" value="cn=manager,dc=mydomain,dc=com"/> <property name="managerPassword" value="manager.password.here"/> </bean>