Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
François Descamps
Liferay - Integration with LDAP - Generate password and send email
18 luglio 2013 0.05
Risposta

François Descamps

Punteggio: New Member

Messaggi: 1

Data di Iscrizione: 17 luglio 2013

Messaggi recenti

Hi,

We use Liferay with a ldap.

But we would like a synchronization between LIFERAY DB and the ldap so we use the "import ldap" functionality.

Our Liferay reads correctly the users from the LDAP and generate a password.

But Liferay doesn't send an email after generating password for an user account created from the ldap import.

Which property we have to use in order to send email for fresh user account ?

Our portal-ext.properties is like that :
# COMMON CONFIG
setup.wizard.enabled=false
admin.email.from.address=*******
admin.email.from.name=Admin *****
admin.email.user.added.enabled=true
admin.email.password.sent.enabled=true


# Change pwd on first use
passwords.change.on.first.use=true

# Remember query
users.reminder.queries.enabled=true
users.reminder.queries.custom.question.enabled=true


#
# Settings for connecting to LDAP
#
ldap.factory.initial=com.sun.jndi.ldap.LdapCtxFactory
# Enable the below setting for enabling LDAP referral follow
#ldap.referral=follow

#LDAP connection settings
ldap.server.ids=0
ldap.server.name.0=*********
ldap.base.provider.url.0=ldaps://********:****
ldap.base.dn.0=dc=********,dc=********
ldap.security.principal.0=cn=********,dc=********,dc=********
ldap.security.credentials.0=********

# enable/disable liferay authentication
auth.pipeline.enable.liferay.check=true
# setting the LDAP auth for pipelined authentication
auth.pipeline.pre=com.liferay.portal.security.auth.LDAPAuth

# Set below property to false to disable ldap auth
ldap.auth.enabled=true
ldap.auth.required=false
ldap.auth.method=bind


# LDAP import properties
ldap.import.enabled=true
ldap.import.on.startup=true
ldap.import.interval=1
ldap.import.method=user
ldap.import.user.password.enabled=false
ldap.import.user.password.autogenerated=true


# LDAP Export properties
ldap.export.enabled=false
ldap.export.group.enabled=false

ldap.auth.search.filter.0=(mail=@screen_name@)

# Provide mapping for the 5 mandatory LDAP attributes for liferay to authentiate with LDAP
# other attributes jobTitle=title, group=groupMembership
ldap.user.mappings.0=screenName=uid\npassword=userPassword\nemailAddress=mail\nfirstName=givenName\nlastName=sn\nfullName=cn
ldap.user.custom.mappings.0=screenName=uid\npassword=userPassword\nemailAddress=mail\nfirstName=givenName\nlastName=sn\nfullName=cn
ldap.group.mappings.0=groupName=cn\ndescription=description\nuser=uniqueMember
ldap.contact.mappings.0=
ldap.contact.custom.mappings.0=

# Attributes to skip
#ldap.user.ignore.attributes=aimSn,comments,facebookId,facebookSn,greeting,icqSn,jabberSn,jobTitle,languageId,msnSn,mySpaceSn,openId,prefixId,reminderQueryAnswer,reminderQueryQuestion,skypeSn,smsSn,suffixId,timeZoneId,twitterSn,ymSn

# Search filters for users and groups. These properties applies only when ldap.import.enabled is True
ldap.import.user.search.filter.0=(objectClass=inetOrgPerson)
ldap.import.group.search.filter.0=(objectClass=groupOfUniqueNames)


# SMTP
mail.session.mail.transport.protocol=smtp
mail.session.mail.smtp.auth=false
mail.session.mail.smtp.host=********
mail.session.mail.smtp.port=********
mail.session.mail.smtp.user=
mail.session.mail.smtp.password="
Rahul Pande
RE: Liferay - Integration with LDAP - Generate password and send email
21 luglio 2013 23.25
Risposta

Rahul Pande

Punteggio: Expert

Messaggi: 308

Data di Iscrizione: 6 luglio 2010

Messaggi recenti

Hi François,

Please check the code for importing users from LDAP is written in PortalLDAPImporterImpl.java class. Internally it is calling user services of Liferay to create a new user.

Following method adds a new user

1protected User addUser(long companyId, LDAPUser ldapUser, String password)


Internally it calls following method from user service

 1UserLocalServiceUtil.addUser(ldapUser.getCreatorUserId(), companyId, ldapUser.isAutoPassword(),
 2            password, password, ldapUser.isAutoScreenName(),
 3            ldapUser.getScreenName(), ldapUser.getEmailAddress(),
 4            ldapUser.getFacebookId(), ldapUser.getOpenId(),
 5            ldapUser.getLocale(), ldapUser.getFirstName(),
 6            ldapUser.getMiddleName(), ldapUser.getLastName(),
 7            ldapUser.getPrefixId(), ldapUser.getSuffixId(), ldapUser.isMale(),
 8            birthdayMonth, birthdayDay, birthdayYear, ldapUser.getJobTitle(),
 9            ldapUser.getGroupIds(), ldapUser.getOrganizationIds(),
10            ldapUser.getRoleIds(), ldapUser.getUserGroupIds(),
11            ldapUser.isSendEmail(), ldapUser.getServiceContext())


Please check this methods boolean parameter ldapUser.isSendEmail(), if it is true then email will be sent to newly created user. You can find the implementation of this method in UserLocalServiceImpl.java class.


HTH
Rahul Pande