AnsweredAssumed Answered

Alfresco 3B + AD authentication

Question asked by richardb on Oct 9, 2008
Latest reply on Dec 26, 2008 by mrojas73
Hello!

few days ago, i upgraded my alfresco 2.9 with 3.B (Centos 5.2 + Mysql).
When i use the AD authentication (OK with 2.9), alfresco returns me an 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:
java.lang.NullPointerException

javax.faces.FacesException: Error calling action method of component with id loginForm:submit
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
at javax.faces.component.UICommand.broadcast(UICommand.java:109)
at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:94)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:619)
Caused by: javax.faces.el.EvaluationException: Exception while invoking expression #{LoginBean.login}
at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:156)
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:61)
… 24 more
Caused by: java.lang.NullPointerException
at org.alfresco.repo.security.authentication.AbstractAuthenticationComponent.isGuestUserName(AbstractAuthenticationComponent.java:359)
at org.alfresco.repo.security.authentication.AbstractAuthenticationComponent.authenticate(AbstractAuthenticationComponent.java:124)
at org.alfresco.repo.security.authentication.AuthenticationServiceImpl.authenticate(AuthenticationServiceImpl.java:117)
at org.alfresco.repo.security.authentication.ChainingAuthenticationServiceImpl.authenticate(ChainingAuthenticationServiceImpl.java:166)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:296)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:177)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:80)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:245)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy20.authenticate(Unknown Source)
at org.alfresco.web.bean.LoginBean.login(LoginBean.java:275)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:132)
… 25 more


My files :
chaining-authentication-context.xml :



<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
       <bean id="authenticationService" class="org.alfresco.repo.security.authentication.ChainingAuthenticationServiceImpl">

   <property name="mutableAuthenticationService">

       <ref bean="authenticationServiceImplAlfresco"/>

   </property>

   <property name="authenticationServices">

       <list>

      <ref bean="authenticationServiceImplLDAP"/>

       </list>

   </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="admSearchService"/>

                </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" parent="authenticationComponentBase">

                <property name="authenticationDao">

                    <ref bean="authenticationDaoAlfresco"/>

                </property>

                <property name="authenticationManager">

                    <ref bean="authenticationManager"/>

                </property>

                <property name="allowGuestLogin">

                    <value>false</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>%s</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>

            <!– The main configuration has moved into a properties file –>

            <bean name="ldapAuthenticationPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

                <property name="ignoreUnresolvablePlaceholders">

                    <value>true</value>

                </property>

                <property name="locations">

                    <value>classpath:alfresco/extension/ldap-authentication.properties</value>

                </property>

            </bean>

            <!– 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="authenticationDaoLDAP" class="org.alfresco.repo.security.authentication.DefaultMutableAuthenticationDao" >

                <property name="allowDeleteUser">

                    <value>false</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="authenticationComponentLDAP"

                  class="org.alfresco.repo.security.authentication.ldap.LDAPAuthenticationComponentImpl"

                  parent="authenticationComponentBase">

                <property name="LDAPInitialDirContextFactory">

                    <ref bean="ldapInitialDirContextFactory"/>

                </property>

                <property name="userNameFormat">

                    <value>${ldap.authentication.userNameFormat}</value>

                </property>

                <property name="nodeService">

                    <ref bean="nodeService" />

                </property>

                <property name="personService">

                    <ref bean="personService" />

                </property>

                <property name="transactionService">

                    <ref bean="transactionService" />

                </property>  

                <property name="escapeCommasInBind">

                    <value>${ldap.authentication.escapeCommasInBind}</value>

                </property>

                <property name="escapeCommasInUid">

                    <value>${ldap.authentication.escapeCommasInUid}</value>

                </property>
                <property name="tenantService">
                    <ref bean="tenantService"/>
                </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>${ldap.authentication.java.naming.factory.initial}</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.authentication.java.naming.provider.url}</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>${ldap.authentication.java.naming.security.authentication}</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>${ldap.authentication.java.naming.security.principal}</value>

                        </entry>
                      

                        <!– The password for the user defined above –>

                        <entry key="java.naming.security.credentials">

                            <value>${ldap.authentication.java.naming.security.credentials}</value>

                        </entry>

                    </map>

                </property>

            </bean>

        </beans>

ldap-authentication.properties:

    #
    # This properties file brings together the common options for LDAP authentication rather than editing the bean definitions
    #

    # How to map the user id entered by the user to taht passed through to LDAP
    # - simple
    #    - this must be a DN and would be something like
    #      CN=%s,DC=company,DC=com
    # - digest
    #    - usually pass through what is entered
    #      %s    

    ldap.authentication.userNameFormat=sAMAccountName=%s
    # The LDAP context factory to use
    ldap.authentication.java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory

    # The URL to connect to the LDAP server
    ldap.authentication.java.naming.provider.url=ldap://XXX.XXX.XXX.XXX:389

    # The authentication mechanism to use
    ldap.authentication.java.naming.security.authentication=SIMPLE

    # The default principal to use (only used for LDAP sync)
    ldap.authentication.java.naming.security.principal=aesis

    # The password for the default principal (only used for LDAP sync)
    ldap.authentication.java.naming.security.credentials=….

    ldap.authentication.escapeCommasInBind=false

    ldap.authentication.escapeCommasInUid=false

ntlm-authentication.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="authenticationDaoLDAP" class="org.alfresco.repo.security.authentication.ntlm.NullMutableAuthenticationDao"/>
    <bean id="authenticationComponent"
          class="org.alfresco.repo.security.authentication.ntlm.NTLMAuthenticationComponentImpl"
          parent="authenticationComponentBase">
        <property name="useLocalServer">
            <value>false</value>
        </property>
        <property name="personService">
            <ref bean="personService" />
        </property>
        <property name="nodeService">
            <ref bean="nodeService" />
        </property>
        <property name="transactionService">
            <ref bean="transactionComponent" />
        </property>
        <property name="guestAccess">
            <value>false</value>
        </property>
         <property name="servers">
             <value>XXX.XXX.XXX.XXX</value>
         </property>
    </bean>
</beans>

Where is the problem in my configuration (i don't see  :?: )?

thanks for your help

Best regards

Richard

Outcomes