many of us often encounter the need to have a user management/authentication services.
if you're lucky, the users data is stored in an LDAP (unfortunately it's usually Active Directory).
if not, don't try to re-implement an LDAP. don't settle for short term vision. managing users/groups/passwords/policies is a major task that tends to grow during projects lifetime and eventually you spend a lot of time writing code that you shouldn't have.
instead, use OpenDS - a fully functional open source LDAP server from Sun.