cancel
Showing results for 
Search instead for 
Did you mean: 

Ldap authentication in ALfresco2.1

sanghamitra
Champ in-the-making
Champ in-the-making
Hi,

Can anyone suggest me the Ldap authentication process in alfresco2.1.
I have integrated Alfresco2.1 with Liferay4.3, but i am now unable to authenticate the Ldap server from alfresco.

I have provided the Ldap server values and other details in
ldap-authentication-context.xml. The file is as follows:



Here's the code:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

<!– DAO that rejects changes - LDAP is read only at the moment. It does allow users to be deleted with out warnings from the UI. –>

<bean name="authenticationDao" class="org.alfresco.repo.security.authentication.DefaultMutableAuthenticationDao" >
<property name="allowDeleteUser">
<value>true</value>
</property>
</bean>


<!– LDAP authentication configuration –>

<!–

You can also use JAAS authentication for Kerberos against Active Directory or NTLM if you also require single sign on from the
web browser. You do not have to use LDAP authentication to synchronise groups and users from an LDAP store if it supports other
authentication routes, like Active Directory.

–>

<bean id="authenticationComponent" class="org.alfresco.repo.security.authentication.ldap.LDAPAuthenticationComponentImpl">
<property name="LDAPInitialDirContextFactory">
<ref bean="ldapInitialDirContextFactory"/>
</property>
<property name="userNameFormat">
<!–

This maps between what the user types in and what is passed through to the underlying LDAP authentication.

"%s" - the user id is passed through without modification.
Used for LDAP authentication such as DIGEST-MD5, anything that is not "simple".

"cn=%s,ou=London,dc=company,dc=com" - If the user types in "Joe Bloggs" the authentricate as "cn=Joe Bloggs,ou=London,dc=company,dc=com"
Usually for simple authentication.

–>
<value>%s</value>
</property>
</bean>

<!–

This bean is used to support general LDAP authentication. It is also used to provide read only access to users and groups
to pull them out of the LDAP reopsitory

–>

<bean id="ldapInitialDirContextFactory" class="org.alfresco.repo.security.authentication.ldap.LDAPInitialDirContextFactoryImpl">
<property name="initialDirContextEnvironment">
<map>
<!– The LDAP provider –>
<entry key="java.naming.factory.initial">
<value>com.sun.jndi.ldap.LdapCtxFactory</value>
</entry>

<!– The url to the LDAP server –>
<!– Note you can use space separated urls - they will be tried in turn until one works –>
<!– This could be used to authenticate against one or more ldap servers (you will not know which one ….) –>
<entry key="java.naming.provider.url">
<value>ldap://*********</value>
</entry>

<!– The authentication mechanism to use –>
<!– Some sasl authentication mechanisms may require a realm to be set –>
<!– java.naming.security.sasl.realm –>
<!– The available options will depend on your LDAP provider –>
<entry key="java.naming.security.authentication">
<value>DIGEST-MD5</value>
</entry>

<!– The id of a user who can read group and user information –>
<!– This does not go through the pattern substitution defined above and is used "as is" –>
<entry key="java.naming.security.principal">
<value>cn=****,ou=***,dc=***</value>
</entry>

<!– The password for the user defined above –>
<entry key="java.naming.security.credentials">
<value>******</value>
</entry>
</map>
</property>
</bean>

<!– Ldap Syncronisation support –>

<!–

There can be more than one stack of beans that import users or groups. For example, it may be easier
to have a version of ldapPeopleExportSource, and associated beans, for each sub-tree of your ldap directory
from which you want to import users. You could then limit users to be imported from two or more sub tress and ignore
users found else where. The same applies to the import of groups.

The defaults shown below are for OpenLDAP.

–>


<!– Extract user information from LDAP and transform this to XML –>

<bean id="ldapPeopleExportSource" class="org.alfresco.repo.security.authentication.ldap.LDAPPersonExportSource">
<!–
The query to select objects that represent the users to import.

For Open LDAP, using a basic schema, the following is probably what you want:
(objectclass=inetOrgPerson)

For Active Directory:
(objectclass=user)
–>
<property name="personQuery">
<value>(objectclass=inetOrgPerson)</value>
</property>

<!–
The seach base restricts the LDAP query to a sub section of tree on the LDAP server.
–>
<property name="searchBase">
<value>OU=*****,dc=*****</value>
</property>

<!–
The unique identifier for the user.

THIS MUST MATCH WHAT THE USER TYPES IN AT THE LOGIN PROMPT

For simple LDAP authentication this is likely to be "cn" or, less friendly, "distinguishedName"

In OpenLDAP, using other authentication mechanisms "uid", but this depends on how you map
from the id in the LDAP authentication request to search for the inetOrgPerson against which
to authenticate.

In Active Directory this is most likely to be "sAMAccountName"

This property is mandatory and must appear on all users found by the query defined above.

–>
<property name="userIdAttributeName">
<value>sAMAccountName</value>
</property>

<!– Services –>
<property name="LDAPInitialDirContextFactory">
<ref bean="ldapInitialDirContextFactory"/>
</property>
<property name="personService">
<ref bean="personService"></ref>
</property>
<property name="namespaceService">
<ref bean="namespaceService"/>
</property>

<!–
This property defines a mapping between attributes held on LDAP user objects and
the properties of user objects held in the repository. The key is the QName of an attribute in
the repository, the value is the attribute name from the user/inetOrgPerson/.. object in the
LDAP repository.
–>
<property name="attributeMapping">
<map>
<entry key="cm:userName">
<!– Must match the same attribute as userIdAttributeName –>
<value>sAMAccountName</value>
</entry>
<entry key="cm:firstName">
<!– OpenLDAP: "givenName" –>
<!– Active Directory: "givenName" –>
<value>givenName</value>
</entry>
<entry key="cm:lastName">
<!– OpenLDAP: "sn" –>
<!– Active Directory: "sn" –>
<value>sn</value>
</entry>
<entry key="cm:email">
<!– OpenLDAP: "mail" –>
<!– Active Directory: "???" –>
<value>mail</value>
</entry>
<entry key="cmSmiley SurprisedrganizationId">
<!– OpenLDAP: "o" –>
<!– Active Directory: "???" –>
<value>o</value>
</entry>
<!– Always use the default –>
<entry key="cm:homeFolderProvider">
<null/>
</entry>
</map>
</property>
<!– Set a default home folder provider –>
<!– Defaults only apply for values above –>
<property name="attributeDefaults">
<map>
<entry key="cm:homeFolderProvider">
<value>companyFolderProvider</value>
</entry>
</map>
</property>
</bean>

<!– Extract group information from LDAP and transform this to XML –>

<bean id="ldapGroupExportSource" class="org.alfresco.repo.security.authentication.ldap.LDAPGroupExportSource">
<!–
The query to select objects that represent the groups to import.

For Open LDAP, using a basic schema, the following is probably what you want:
(objectclass=groupOfNames)

For Active Directory:
(objectclass=group)
–>
<property name="groupQuery">
<value>(objectclass=groupOfNames)</value>
</property>

<!–
The search base restricts the LDAP query to a sub section of tree on the LDAP server.
–>
<property name="searchBase">
<value>OU=*****,dc=****</value>
</property>

<!–
The unique identifier for the user. This must match the userIdAttributeName on the ldapPeopleExportSource bean above.
–>
<property name="userIdAttributeName">
<value>sAMAccountName</value>
</property>

<!–
An attribute that is a unique identifier for each group found.
This is also the name of the group with the current group implementation.
This is mandatory for any groups found.

OpenLDAP: "cn" as it is mandatory on groupOfNames
Active Directory: "cn"

–>
<property name="groupIdAttributeName">
<value>cn</value>
</property>

<!–
The objectClass attribute for group members.
For each member of a group, the distinguished name is given.
The object is looked up by its DN. If the object is of this class it is treated as a group.
–>
<property name="groupType">
<value>groupOfNames</value>
</property>

<!–
The objectClass attribute for person members.
For each member of a group, the distinguished name is given.
The object is looked up by its DN. If the object is of this class it is treated as a person.
–>
<property name="personType">
<value>inetOrgPerson</value>
</property>
<property name="LDAPInitialDirContextFactory">
<ref bean="ldapInitialDirContextFactory"/>
</property>
<property name="namespaceService">
<ref bean="namespaceService"/>
</property>

<!–
The repeating attribute on group objects (found by query or as sub groups)
used to define membership of the group. This is assumed to hold distinguished names of
other groups or users/people; the above types are used to determine this.

OpenLDAP: "member" as it is mandatory on groupOfNames
Active Directory: "member"

–>
<property name="memberAttribute">
<value>member</value>
</property>

<property name="authorityDAO">
<ref bean="authorityDAO"/>
</property>
</bean>

<!– Job definitions to import LDAP people and groups –>
<!– The triggers register themselves with the scheduler –>
<!– You may comment in the default scheduler to enable these triggers –>
<!– If a cron base trigger is what you want seee scheduled-jobs-context.xml for examples. –>

<!– Trigger to load poeple –>
<!– Note you can have more than one initial (context, trigger, import job and export source) set –>
<!– This would allow you to load people from more than one ldap store –>

<bean id="ldapPeopleTrigger" class="org.alfresco.util.TriggerBean">
<property name="jobDetail">
<bean id="ldapPeopleJobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass">
<value>org.alfresco.repo.importer.ImporterJob</value>
</property>
<property name="jobDataAsMap">
<map>
<entry key="bean">
<ref bean="ldapPeopleImport"/>
</entry>
</map>
</property>
</bean>
</property>
<!– Start after 1 minutes of starting the repository –>
<property name="startDelay">
<value>300</value>
</property>
<!– Repeat every hour –>
<property name="repeatInterval">
<value>3600000</value>
</property>
<!– Commented out to disable
<property name="scheduler">
<ref bean="schedulerFactory" />
</property>
–>
</bean>

<bean id="ldapGroupTrigger" class="org.alfresco.util.TriggerBean">
<property name="jobDetail">
<bean id="ldapGroupJobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass">
<value>org.alfresco.repo.importer.ImporterJob</value>
</property>
<property name="jobDataAsMap">
<map>
<entry key="bean">
<ref bean="ldapGroupImport"/>
</entry>
</map>
</property>
</bean>
</property>
<!– Start after 1 minutes of starting the repository –>
<property name="startDelay">
<value>300</value>
</property>
<!– Repeat every hour –>
<property name="repeatInterval">
<value>3600000</value>
</property>
<!– Commented out to disable
<property name="scheduler">
<ref bean="schedulerFactory" />
</property>
–>
</bean>

<!– The bean that imports xml describing people –>

<bean id="ldapPeopleImport" class="org.alfresco.repo.importer.ExportSourceImporter">
<property name="importerService">
<ref bean="importerComponentWithBehaviour"/>
</property>
<property name="transactionService">
<ref bean="transactionComponent"/>
</property>
<property name="authenticationComponent">
<ref bean="authenticationComponent"/>
</property>
<property name="exportSource">
<ref bean="ldapPeopleExportSource"/>
</property>

<!– The store that contains people - this should not be changed –>
<property name="storeRef">
<value>${spaces.store}</value>
</property>

<!– The location of people nodes within the store defined above - this should not be changed –>
<property name="path">
<value>/${system.system_container.childname}/${system.people_container.childname}</value>
</property>

<!– If true, clear all existing people before import, if false update/add people from the xml –>
<property name="clearAllChildren">
<value>false</value>
</property>
<property name="nodeService">
<ref bean="nodeService"/>
</property>
<property name="searchService">
<ref bean="searchService"/>
</property>
<property name="namespacePrefixResolver">
<ref bean="namespaceService"/>
</property>


<property name="caches">
<set>
<ref bean="permissionsAccessCache"/>
</set>
</property>
</bean>

<!– The bean that imports xml descibing groups –>

<bean id="ldapGroupImport" class="org.alfresco.repo.importer.ExportSourceImporter">
<property name="importerService">
<ref bean="importerComponentWithBehaviour"/>
</property>
<property name="transactionService">
<ref bean="transactionComponent"/>
</property>
<property name="authenticationComponent">
<ref bean="authenticationComponent"/>
</property>
<property name="exportSource">
<ref bean="ldapGroupExportSource"/>
</property>
<!– The store that contains group information - this should not be changed –>
<property name="storeRef">
<value>${alfresco_user_store.store}</value>
</property>

<!– The location of group information in the store above - this should not be changed –>
<property name="path">
<value>/${alfresco_user_store.system_container.childname}/${alfresco_user_store.authorities_container.childname}</value>
</property>

<!– If true, clear all existing groups before import, if false update/add groups from the xml –>
<property name="clearAllChildren">
<value>true</value>
</property>
<property name="nodeService">
<ref bean="nodeService"/>
</property>
<property name="searchService">
<ref bean="searchService"/>
</property>
<property name="namespacePrefixResolver">
<ref bean="namespaceService"/>
</property>

<!– caches to clear on import of groups –>
<property name="caches">
<set>
<ref bean="userToAuthorityCache"/>
<ref bean="permissionsAccessCache"/>
</set>
</property>

<!– userToAuthorityCache –>
</bean>

</beans>
2 REPLIES 2

finner
Champ in-the-making
Champ in-the-making
Hi sanghamitra,

I have a ldap configuration working using simple authentication and no synchronization of users or groups.
My ldap file looks like this :



<beans>
   
    <bean name="authenticationDao" class="org.alfresco.repo.security.authentication.DefaultMutableAuthenticationDao" >
        <property name="allowDeleteUser">
            <value>true</value>
        </property>
    </bean>   
  

    <!– LDAP authentication configuration –>


   <bean id="authenticationComponent" class="es.retevision.ecompany.alfresco.repo.security.authentication.ldap.LDAPAuthenticationComponentWrapper">
      <property name="LDAPInitialDirContextFactory">
         <ref bean="ldapInitialDirContextFactory"/>
      </property>
      <property name="userNameFormat">
         <value>uid=%s,ou=***,dc=***,dc=***</value>        
      </property>
   </bean>
</bean>




   <!– LDAP authentication configuration –>

    <bean id="ldapInitialDirContextFactory" class="es.retevision.ecompany.alfresco.repo.security.authentication.ldap.LDAPInitialDirContextFactoryWrapper">
        <property name="initialDirContextEnvironment">
             <map>
                <entry key="java.naming.factory.initial">
                    <value>com.sun.jndi.ldap.LdapCtxFactory</value>
                </entry>
                <entry key="java.naming.provider.url">
                    <value>ldap://my.ldap.server:port</value>
                </entry>
                <entry key="java.naming.security.authentication">
                    <value>simple</value>  
                </entry>
             </map>
        </property>
    </bean>
</beans>

I would suggest you try the config first with "simple" authentication. I haven't been able to configure it with DIGEST-MD5.

Hope this is of help
Finner

sanghamitra
Champ in-the-making
Champ in-the-making
Hi Finner,

I tried with the simple authentication too, but that still it doesnt work.
Here's the code of My log4j file inside tomcat55/common/classes.

# Set root logger level to error
log4j.rootLogger=error, Console, File

###### Console appender definition #######

# All outputs currently set to be a ConsoleAppender.
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{3}] %m%n
#log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n

###### File appender definition #######
log4j.appender.File=org.apache.log4j.DailyRollingFileAppender
log4j.appender.File.File=alfresco.log
log4j.appender.File.Append=true
log4j.appender.File.DatePattern='.'yyyy-MM-dd
log4j.appender.File.layout=org.apache.log4j.PatternLayout
log4j.appender.File.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c] %m%n

###### Hibernate specific appender definition #######
#log4j.appender.file=org.apache.log4j.FileAppender
#log4j.appender.file.File=hibernate.log
#log4j.appender.file.layout=org.apache.log4j.PatternLayout
#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

###### Log level overrides #######

log4j.logger.org.alfresco.repo.model.filefolder=info

# Hibernate
log4j.logger.org.hibernate=error
log4j.logger.org.hibernate.util.JDBCExceptionReporter=fatal
log4j.logger.org.hibernate.event.def.AbstractFlushingEventListener=fatal
#log4j.logger.org.hibernate.cache.EhCacheProvider=warn
log4j.logger.org.hibernate.type=warn
# log4j.logger.org.hibernate.persister.collection=DEBUG

# Spring
log4j.logger.org.springframework=warn

# Axis/WSS4J
log4j.logger.org.apache.axis=info
log4j.logger.org.apache.ws=info

# MyFaces
log4j.logger.org.apache.myfaces.util.DebugUtils=info
log4j.logger.org.apache.myfaces.el.VariableResolverImpl=error
log4j.logger.org.apache.myfaces.application.jsp.JspViewHandlerImpl=error
log4j.logger.org.apache.myfaces.taglib=error

# log prepared statement cache activity ###
log4j.logger.org.hibernate.ps.PreparedStatementCache=info

# Alfresco
log4j.logger.org.alfresco=error
log4j.logger.org.alfresco.repo.avm=info
log4j.logger.org.alfresco.config=info
log4j.logger.org.alfresco.sample=info
log4j.logger.org.alfresco.web=info
log4j.logger.org.alfresco.web.scripts=warn
#log4j.logger.org.alfresco.web.ui.repo.component.UIActions=debug
#log4j.logger.org.alfresco.web.ui.repo.tag.PageTag=debug
#log4j.logger.org.alfresco.web.bean.clipboard=debug
log4j.logger.org.alfresco.repo.webservice=info
log4j.logger.org.alfresco.service.descriptor.DescriptorService=info
#log4j.logger.org.alfresco.repo.importer.ImporterBootstrap=info
#log4j.logger.org.alfresco.web.ui.common.Utils=info
log4j.logger.org.alfresco.repo.admin.patch.PatchExecuter=info
log4j.logger.org.alfresco.repo.module.ModuleServiceImpl=info
log4j.logger.org.alfresco.repo.domain.schema.SchemaBootstrap=info
log4j.logger.org.alfresco.repo.admin.ConfigurationChecker=info
log4j.logger.org.alfresco.repo.node.index.FullIndexRecoveryComponent=info
log4j.logger.org.alfresco.util.OpenOfficeConnectionTester=warn
log4j.logger.org.alfresco.repo.node.db.hibernate.HibernateNodeDaoServiceImpl=warn
#log4j.logger.org.alfresco.web.app.DebugPhaseListener=debug
#log4j.logger.org.alfresco.repo.cache.EhCacheTracerJob=debug
#log4j.logger.org.alfresco.repo.search.Indexer=debug
#log4j.logger.org.alfresco.repo.workflow=info
#log4j.logger.org.alfresco.repo.jscript=DEBUG
log4j.logger.org.alfresco.repo.jscript.AlfrescoRhinoScriptDebugger=off

# CIFS server debugging
#log4j.logger.org.alfresco.smb.protocol=debug
#log4j.logger.org.alfresco.smb.protocol.auth=debug
#log4j.logger.org.alfresco.acegi=debug

# FTP server debugging
#log4j.logger.org.alfresco.ftp.protocol=debug
#log4j.logger.org.alfresco.ftp.server=debug

# WebDAV debugging
#log4j.logger.org.alfresco.webdav.protocol=debug

# NTLM servlet filters
#log4j.logger.org.alfresco.web.app.servlet.NTLMAuthenticationFilter=debug
#log4j.logger.org.alfresco.repo.webdav.auth.NTLMAuthenticationFilter=debug

# Integrity message threshold - if 'failOnViolation' is off, then WARNINGS are generated
log4j.logger.org.alfresco.repo.node.integrity=ERROR

# New indexer debugging
#log4j.logger.org.alfresco.repo.search.impl.lucene.index=DEBUG

# Audit debugging
# log4j.logger.org.alfresco.repo.audit=DEBUG
# log4j.logger.org.alfresco.repo.audit.model=DEBUG

# Turn off Spring remoting warnings that should really be info or debug.
log4j.logger.org.springframework.remoting.support=error

# Templating debugging
# log4j.logger.org.alfresco.web.forms=debug
# log4j.logger.org.chiba.xml.xforms=debug

# Property sheet and modelling debugging
# change to error to hide the warnings about missing properties and associations
log4j.logger.alfresco.missingProperties=warn
log4j.logger.org.alfresco.web.ui.repo.component.property.UIChildAssociation=warn
log4j.logger.org.alfresco.web.ui.repo.component.property.UIAssociation=warn
#log4j.logger.org.alfresco.web.ui.repo.component.property=debug
#log4j.logger.org.alfresco.repo.dictionary.DictionaryDAO=info
#added the below line to enter the debug mode
log4.logger.org.alfresco.repo.security.authentication.ldap=debug


# Virtualization Server Registry
#log4j.logger.org.alfresco.mbeans.VirtServerRegistry=debug

# Link Validation debugging
#log4j.logger.org.alfresco.linkvalidation.LinkValidationServiceImpl=debug
#log4j.logger.org.alfresco.linkvalidation.LinkValidationStoreCallbackHandler=debug
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.