Announcement Announcement Module
Collapse
No announcement yet.
Ldap reset password problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ldap reset password problem

    hi to one n all...

    I have a requirement to reset the password of user on LDAP(AD)...Iam using spring ldaptemplate to communicate with AD...I have done in searching the ldap and retrieving the results from AD...but my create user and reset password functions are not working....

    here my configuration :
    Code:
    <bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource">
    		<property name="url" value="ldap://xxx.xxx.192.10:389" />
    		<property name="base" value="dc\=xxxxxDESK,dc\=IN" />
    		<property name="userDn" value="[email protected]" />
    		<property name="password" value="xxxxxx" />
    		<property name="pooled" value="false"></property>
    		<property name="baseEnvironmentProperties">
    			<map>
    				<entry key="java.naming.security.authentication" value="simple"> </entry>
    			</map>
    			</property>
    	</bean>

    and my java code to reset password is:
    Code:
     DistinguishedName dn = new DistinguishedName();		 
      		  dn.add("OU","GBUsers");
      		  dn.add("CN",userName);
    
    			  try{Attribute oldattr = new BasicAttribute("unicodePwd", oldpwd);
    			  Attribute newattr = new BasicAttribute("unicodePwd", newpwd);
    
    			  ModificationItem olditem = new ModificationItem(
    			  DirContext.REMOVE_ATTRIBUTE, oldattr);
    
    			  ModificationItem newitem = new ModificationItem(
    			  DirContext.ADD_ATTRIBUTE, newattr);
    
    			  ModificationItem repitem = new ModificationItem(
    			  DirContext.REPLACE_ATTRIBUTE, newattr);
    
    			  ModificationItem[] mods = new ModificationItem[2];
    			  mods[0] = olditem;
    			  mods[1] = newitem;
    
    			  // ldapTemplate.modifyAttributes("cn=administrator,cn=Users", mods);
    
    			  ldapTemplate.modifyAttributes(dn,
    			  new ModificationItem[] { repitem });
    			  }
    			  catch (OperationNotSupportedException e) {
    		           e.printStackTrace();
    		        } catch (Throwable e) {
    		          e.printStackTrace();
    		        }
    I am getting the username,oldpwd and newpwd from other function....


    when I run it on my tc server it is throwing exception.

    here my full stacktrace:

    org.springframework.ldap.OperationNotSupportedExce ption: [LDAP: error code 53 - 0000001F: SvcErr: DSID-031A120C, problem 5003 (WILL_NOT_PERFORM), data 0 remaining name 'cn=admin,ou=GBUsers'
    at org.springframework.ldap.support.LdapUtils.convert LdapException(LdapUtils.java:201)
    at org.springframework.ldap.core.LdapTemplate.execute WithContext(LdapTemplate.java:810)
    at org.springframework.ldap.core.LdapTemplate.execute ReadWrite(LdapTemplate.java:802)
    at org.springframework.ldap.core.LdapTemplate.modifyA ttributes(LdapTemplate.java:967)
    at com.rcv.ldap.dao.DaoImpl.changePassword(DaoImpl.ja va:409)
    at com.rcv.ldap.web.LdapController.resetPwd(LdapContr oller.java:104)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.springframework.web.bind.annotation.support.Ha ndlerMethodInvoker.invokeHandlerMethod(HandlerMeth odInvoker.java:176)
    at org.springframework.web.servlet.mvc.annotation.Ann otationMethodHandlerAdapter.invokeHandlerMethod(An notationMethodHandlerAdapter.java:436)
    at org.springframework.web.servlet.mvc.annotation.Ann otationMethodHandlerAdapter.handle(AnnotationMetho dHandlerAdapter.java:424)
    at org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:790)
    at org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:719)
    at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:669)
    at org.springframework.web.servlet.FrameworkServlet.d oGet(FrameworkServlet.java:574)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:621)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:722)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:224)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:175)
    at org.apache.catalina.authenticator.AuthenticatorBas e.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:929)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:405)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:279)
    at org.apache.coyote.AbstractProtocol$AbstractConnect ionHandler.process(AbstractProtocol.java:515)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProce ssor.run(JIoEndpoint.java:300)
    at java.util.concurrent.ThreadPoolExecutor.runWorker( ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
    Caused by: javax.naming.OperationNotSupportedException: [LDAP: error code 53 - 0000001F: SvcErr: DSID-031A120C, problem 5003 (WILL_NOT_PERFORM), data 0
    remaining name 'cn=admin,ou=GBUsers'
    at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.jav a:3160)
    at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCt x.java:3033)
    at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCt x.java:2840)
    at com.sun.jndi.ldap.LdapCtx.c_modifyAttributes(LdapC tx.java:1478)
    at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_mod ifyAttributes(ComponentDirContext.java:273)
    at com.sun.jndi.toolkit.ctx.PartialCompositeDirContex t.modifyAttributes(PartialCompositeDirContext.java :190)
    at javax.naming.directory.InitialDirContext.modifyAtt ributes(InitialDirContext.java:172)
    at org.springframework.ldap.core.LdapTemplate$19.exec uteWithContext(LdapTemplate.java:969)
    at org.springframework.ldap.core.LdapTemplate.execute WithContext(LdapTemplate.java:807)
    ... 33 more
    is this problem with SSL...

    Note that my tc server are installed on the same machine on which AD is installed on...so I think it is not required SSL connection...

    please help me on this....

  • #2
    Try to perform the change password operation on ldaps, import the certs to keystore so java can do a proper SSL connection
    https://forums.oracle.com/forums/thr...readID=2175638

    Comment

    Working...
    X