Hi,

I can successfully authenticate my login details with the active directory
using the configurations in my security.xml which is as follow. My Question
is, Is there a way to get the DN of the authenticated user? 

--------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
             xmlns:beans="http://www.springframework.org/schema/beans";
             xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
              http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-2.0.1.xsd";>

    <http auto-config="true" lowercase-comparisons="false">
        <!--intercept-url pattern="/images/*" filters="none"/>
        <intercept-url pattern="/styles/*" filters="none"/>
        <intercept-url pattern="/scripts/*" filters="none"/-->
        <intercept-url pattern="/admin/*" access="ROLE_ADMIN"/>
        <intercept-url pattern="/passwordHint.html*"
access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
        <intercept-url pattern="/signup.html*"
access="ROLE_ANONYMOUS,ROLE_ADMIN,ROLE_USER"/>
        <intercept-url pattern="/**/*.html*" access="ROLE_ADMIN,ROLE_USER"/>
        <form-login login-page="/login.jsp"
authentication-failure-url="/login.jsp?error=true"
login-processing-url="/j_security_check"/>
        <logout invalidate-session="true"/>
        <remember-me user-service-ref="userDao"
key="e37f4b31-0c45-11dd-bd0b-0800200c9a66"/>
    </http><!--

    <authentication-provider user-service-ref="userDao">
        <password-encoder ref="passwordEncoder"/>
    </authentication-provider>

    --><!-- Override the default password-encoder (SHA) by uncommenting the
following and changing the class -->
    <!-- <bean id="passwordEncoder"
class="org.springframework.security.providers.encoding.ShaPasswordEncoder"/>
-->


<!-- LDAP Authentication -->
    <ldap-server id="ldapServer"
     url="ldap://172.20.210.7:389/dc=irmhpmas,dc=com";
manager-dn="i...@irmhpmas.com" manager-password="1qaz2wsx@"/>
   
        <beans:bean id="userSearch"
          
           
class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">
                      <beans:constructor-arg index="0" value="ou=IMD"/>
                      <beans:constructor-arg index="1"
value="(sAMAccountName={0})"/>
                      <beans:constructor-arg index="2" ref="ldapServer" />
                      <beans:property name="searchSubtree" value="true" />
        </beans:bean>
               
        <beans:bean id="ldapAuthenticationProvider"
                          
           
class="org.springframework.security.providers.ldap.LdapAuthenticationProvider"
            autowire="default">
                      <custom-authentication-provider/>
                      <beans:constructor-arg>
                        <beans:bean
           
class="org.springframework.security.providers.ldap.authenticator.BindAuthenticator">
                          <beans:constructor-arg ref="ldapServer"/><!--
                          <beans:property name="userDnPatterns">
                          
           
<beans:list><beans:value>uid={0},ou=People</beans:value></beans:list>
                          </beans:property>
                          -->
                        <beans:property name="userSearch" ref="userSearch"/>
                        </beans:bean>
                      </beans:constructor-arg>
                      <beans:constructor-arg>
                        <beans:bean
           
class="org.springframework.security.ldap.populator.DefaultLdapAuthoritiesPopulator">
                          <beans:constructor-arg ref="ldapServer"/>
                          <beans:constructor-arg value="ou=IMD"/>
                          <beans:property name="groupRoleAttribute"
value="cn"/>
                          <beans:property name="convertToUpperCase"
value="true" />
                          <beans:property name="rolePrefix" value="ROLE_" />
                          <beans:property name="searchSubtree" value="true"
/>
                          <beans:property name="groupSearchFilter"
value="member={0}" />
                         </beans:bean>
                      </beans:constructor-arg>
        </beans:bean>

<!-- End of LDAP Authentication -->   

    <global-method-security>
        <protect-pointcut expression="execution(*
*..service.UserManager.getUsers(..))" access="ROLE_ADMIN"/>
        <protect-pointcut expression="execution(*
*..service.UserManager.removeUser(..))" access="ROLE_ADMIN"/>
    </global-method-security>
</beans:beans>

-------------------------------------------------------------------------------------------------

Please guide me asap.I am stuck with :(

Thanks in advance,
Harshi
-- 
View this message in context: 
http://appfuse.547863.n4.nabble.com/retreive-authenticated-user-DN-tp2524302p2524302.html
Sent from the AppFuse - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to