cancel
Showing results for 
Search instead for 
Did you mean: 

LDAP + Alfresco user authent...

davidbarbion
Champ in-the-making
Champ in-the-making
Is there anyone who can give me the configuration file to chain ldap+alfresco user authentication ?

The example given in "chaining" doesn't cover this topic, and I couldn't manage to do it…

Thanks in advance.
50 REPLIES 50

rivetlogic
Champ on-the-rise
Champ on-the-rise
Hi,

This should work:

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

<beans>

    <!– Chaining –>
    <bean id="authenticationServiceImpl" class="org.alfresco.repo.security.authentication.ChainingAuthenticationServiceImpl">
        <property name="authenticationServices">
            <list>
                <ref bean="authenticationServiceImplLDAP"/>
            </list>
        </property>
        <property name="mutableAuthenticationService">
            <ref bean="authenticationServiceImplAlfresco"/>
        </property>
    </bean>

    <!– Alfresco Auth –>
    <bean id="authenticationServiceImplAlfresco" class="org.alfresco.repo.security.authentication.AuthenticationServiceImpl">
        <property name="authenticationDao">
            <ref bean="authenticationDaoAlfresco"/>
        </property>
        <property name="ticketComponent">
            <ref bean="ticketComponent"/>
        </property>
        <property name="authenticationComponent">
            <ref bean="authenticationComponentImplAlfresco"/>
        </property>
    </bean>
        
    <bean id="authenticationDaoAlfresco" class="org.alfresco.repo.security.authentication.RepositoryAuthenticationDao">
        <property name="nodeService">
            <ref bean="nodeService"/>
        </property>
        <property name="dictionaryService">
            <ref bean="dictionaryService"/>
        </property>
        <property name="namespaceService">
            <ref bean="namespaceService"/>
        </property>
        <property name="searchService">
            <ref bean="searchService"/>
        </property>
        <property name="userNamesAreCaseSensitive">
            <value>${user.name.caseSensitive}</value>
        </property>
        <property name="passwordEncoder">
            <ref bean="passwordEncoder"/>
        </property>
    </bean>

    <bean id="authenticationComponentImplAlfresco" class="org.alfresco.repo.security.authentication.AuthenticationComponentImpl">
        <property name="authenticationDao">
            <ref bean="authenticationDaoAlfresco"/>
        </property>
        <property name="authenticationManager">
            <ref bean="authenticationManager"/>
        </property>
        <property name="allowGuestLogin">
            <value>true</value>
        </property>
    </bean>

   <!– LDAP Auth –>
    <bean id="authenticationServiceImplLDAP" class="org.alfresco.repo.security.authentication.AuthenticationServiceImpl">
        <property name="authenticationDao">
            <ref bean="authenticationDaoLDAP" />
        </property>
        <property name="ticketComponent">
            <ref bean="ticketComponent" />
        </property>
        <property name="authenticationComponent">
            <ref bean="authenticationComponentImplLDAP" />
        </property>
    </bean>

    <bean id="authenticationComponentImplLDAP" class="org.alfresco.repo.security.authentication.ldap.LDAPAuthenticationComponentImpl">
        <property name="LDAPInitialDirContextFactory">
            <ref bean="ldapInitialDirContextFactory"/>
        </property>
        <property name="userNameFormat">
            <value>cn=%s,ou=people,dc=rivetlogic,dc=com</value>
        </property>
    </bean>

    <bean id="authenticationDaoLDAP" class="org.alfresco.repo.security.authentication.ntlm.NullMutableAuthenticationDao"/>

</beans>

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

<beans>

    <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 –>
                <entry key="java.naming.provider.url">
                    <value>ldap://xx.xx.xx.xx:389</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>simple</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=user_with_read_access,dc=rivetlogic,dc=com</value>
                </entry>

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

</beans>

Hope this helps,

–Aladdin

davidbarbion
Champ in-the-making
Champ in-the-making
Ok, thank you very much. I'll try the conf as soon as possible.

ribz33
Champ on-the-rise
Champ on-the-rise
Its not working for me. Smiley Sad

All my users were defined in a LDAP and its working.
Now i want to implement chaining in order to have internal alfresco users also.

So i had created an internal user in web client.
I had copy/paste your code for chaining.

Now i can connect with external LDAP user like before but i cant connect with internal user that i had created.
I have this error

javax.faces.FacesException: Error calling action method of component with id loginForm:submit
caused by:
javax.faces.el.EvaluationException: Exception while invoking expression #{LoginBean.login}
caused by:
org.alfresco.error.AlfrescoRuntimeException: Not implemented

I had done more test :
Without ldap config i can connect with internal user - its ok
Without chaining config i can connect with external users and internal user are unknow  - its ok

For info i use 1.4 preview

I expect someone have an idea Smiley Wink
thx a lot

rivetlogic
Champ on-the-rise
Champ on-the-rise
Hi,

Just for clarification; have you replaced:

- userNameFormat
- java.naming.provider.url
- java.naming.security.principal
- java.naming.security.credentials

with the appropriate values?

–Aladdin

ribz33
Champ on-the-rise
Champ on-the-rise
Yes Smiley Very Happy

And my problem is with internal users not external users.
So my LDAP configuration is working.

Thx for your help Smiley Happy

rivetlogic
Champ on-the-rise
Champ on-the-rise
Hi,

For what it's worth, I tried chaining LDAP/Alfresco authentication using the config listed here and had no problems. I used 1.4 Preview.

Try posting your chaining-authentication-context.xml and ldap-authentication-context.xml files.

Regards,

–Aladdin

ribz33
Champ on-the-rise
Champ on-the-rise
Ok sorry,

i had found my mistake !

I had forgot to delete bean "authenticationComponentImpl" in ldap-authetication-context.xml

Its working now !

Thx for your help Smiley Very Happy

unknown-user
Champ on-the-rise
Champ on-the-rise
Hi all,

I'm using the 2.0 version and have the same exception when I change the name of the bean authenticationServiceImpl to authenticationService. It is necessary to modify ldap-authentication-context.xml to get Chaining service running?

Thanks

Felipe

cn2ca
Champ in-the-making
Champ in-the-making
Its not working for me. Smiley Sad

All my users were defined in a LDAP and its working.
Now i want to implement chaining in order to have internal alfresco users also.

So i had created an internal user in web client.
I had copy/paste your code for chaining.

Now i can connect with external LDAP user like before but i cant connect with internal user that i had created.
I have this error

javax.faces.FacesException: Error calling action method of component with id loginForm:submit
caused by:
javax.faces.el.EvaluationException: Exception while invoking expression #{LoginBean.login}
caused by:
org.alfresco.error.AlfrescoRuntimeException: Not implemented

I had done more test :
Without ldap config i can connect with internal user - its ok
Without chaining config i can connect with external users and internal user are unknow  - its ok

For info i use 1.4 preview

I expect someone have an idea Smiley Wink
thx a lot

Hi, someone have idea about that? i have the same issue of that…