T - type of AppUserpublic class LdapPasswordComposite<T extends AppUser> extends PasswordAuthComposite<T>
PasswordAuthComposite that queries an external pre-populated LDAP server for authentication.
The assumption is that the user has read access to their own LDAP entry.
All the password-change functionality is not supported but
database records will be auto-created when an authentication succeeds.
We assume all users are at the same level of the ldap tree and the supplied username corresponds to
a unique attribute (default to uid) of the user record. This allows a LdapName for the record to be
generated simply and does not require an anonymous bind to search for the user.
An anonymous bind can be introduced by sub-classing.
The identifying attribute name is stored as the web-name.
Configuration properties:
PasswordAuthComposite.PasswordResetRequiredPage, PasswordAuthComposite.UpdatePasswordTransition| Modifier and Type | Field and Description |
|---|---|
protected javax.naming.ldap.LdapName |
base_name |
protected java.lang.String |
factory |
protected java.lang.String |
filter |
protected java.lang.String |
ldap_url |
protected java.lang.String |
name_attr |
protected boolean |
use_ssl |
CHANGE_PASSWORD, USER_CHANGE_PASSWORD_FEATURE| Constructor and Description |
|---|
LdapPasswordComposite(AppUserFactory<T> fac) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canResetPassword(T user)
Is it legal to reset the password for the current user.
|
boolean |
checkPassword(T u,
java.lang.String password)
Check if a string matches this persons password.
|
T |
findByLoginNamePassword(java.lang.String name,
java.lang.String password)
Check a supplied user-name and password.
|
T |
findByLoginNamePassword(java.lang.String name,
java.lang.String password,
boolean check_fail_count)
Check a supplied user-name and password.
|
java.lang.String |
firstPassword(T user)
set the initial randomised password for the user
|
protected javax.naming.directory.DirContext |
getContext(java.lang.String name,
java.lang.String password) |
void |
lockPassword(T user)
lock the account so no password works.
|
TableSpecification |
modifyDefaultTableSpecification(TableSpecification spec,
java.lang.String table)
Modify the
TableSpecification of the target factory. |
boolean |
mustResetPassword(T user)
Is the user required to change their password
|
void |
newPassword(T user)
Set a new randomised password for the user and send a notification email
|
java.lang.String |
randomisePassword(T user)
set a new randomised password for the user
|
java.lang.String |
reasonForReset(T user)
Text explanation of why
PasswordAuthComposite.mustResetPassword(AppUser) returned true. |
void |
setPassword(T user,
java.lang.String password)
Change the password for a user
|
doWelcome, getRequiredPages, getTransitions, getType, newSignupaddDefaults, addFieldHelp, addOptional, addSelectors, addSuppress, addTranslations, customiseForm, customiseUpdateForm, getContext, getFactory, getLogger, getRecord, getRepository, postUpdate, preRegister, release, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddFieldConstraints, addFormFieldsprotected final java.lang.String ldap_url
protected final boolean use_ssl
protected final javax.naming.ldap.LdapName base_name
protected final java.lang.String factory
protected final java.lang.String filter
protected final java.lang.String name_attr
public LdapPasswordComposite(AppUserFactory<T> fac)
fac - public boolean checkPassword(T u, java.lang.String password)
PasswordAuthCompositecheckPassword in class PasswordAuthComposite<T extends AppUser>u - AppUser to checkpassword - unencrypted password to check.public T findByLoginNamePassword(java.lang.String name, java.lang.String password) throws DataException
PasswordAuthCompositefindByLoginNamePassword in class PasswordAuthComposite<T extends AppUser>DataExceptionprotected javax.naming.directory.DirContext getContext(java.lang.String name,
java.lang.String password)
throws javax.naming.InvalidNameException,
javax.naming.NamingException
name - password - javax.naming.InvalidNameExceptionjavax.naming.NamingExceptionpublic T findByLoginNamePassword(java.lang.String name, java.lang.String password, boolean check_fail_count) throws DataException
PasswordAuthCompositefindByLoginNamePassword in class PasswordAuthComposite<T extends AppUser>check_fail_count - set to false to ignore failed logins.DataExceptionpublic boolean canResetPassword(T user)
PasswordAuthCompositecanResetPassword in class PasswordAuthComposite<T extends AppUser>user - or null for general testpublic void setPassword(T user, java.lang.String password) throws DataFault
PasswordAuthCompositesetPassword in class PasswordAuthComposite<T extends AppUser>password - clear-text passwordDataFaultpublic void lockPassword(T user) throws UnsupportedException
PasswordAuthCompositelockPassword in class PasswordAuthComposite<T extends AppUser>UnsupportedExceptionpublic void newPassword(T user) throws java.lang.Exception
PasswordAuthCompositenewPassword in class PasswordAuthComposite<T extends AppUser>java.lang.Exceptionpublic java.lang.String randomisePassword(T user) throws DataFault
PasswordAuthCompositerandomisePassword in class PasswordAuthComposite<T extends AppUser>DataFaultpublic java.lang.String firstPassword(T user) throws DataFault
PasswordAuthCompositefirstPassword in class PasswordAuthComposite<T extends AppUser>DataFaultpublic boolean mustResetPassword(T user)
PasswordAuthCompositemustResetPassword in class PasswordAuthComposite<T extends AppUser>public java.lang.String reasonForReset(T user)
PasswordAuthCompositePasswordAuthComposite.mustResetPassword(AppUser) returned true.reasonForReset in class PasswordAuthComposite<T extends AppUser>public TableSpecification modifyDefaultTableSpecification(TableSpecification spec, java.lang.String table)
TableStructureContributerTableSpecification of the target factory.modifyDefaultTableSpecification in interface TableStructureContributer<T extends AppUser>modifyDefaultTableSpecification in class Composite<T extends AppUser,PasswordAuthComposite<T extends AppUser>>