Project

General

Profile

« Previous | Next » 

Revision 2697

Added by sgarg about 19 years ago

Changed the filter and ldapbase values in getUserInfo so that it works for both NCEAS and LTER ldap

View differences:

src/edu/ucsb/nceas/metacat/AuthLdap.java
547 547
    env.put(Context.PROVIDER_URL, ldapUrl);
548 548

  
549 549
    try {
550

  
550
      
551 551
      // Create the initial directory context
552 552
      DirContext ctx = new InitialDirContext(env);
553 553
      // Specify the attributes to match.
......
558 558
      ctls.setReturningAttributes(attrIDs);
559 559
      ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);
560 560
      //ctls.setCountLimit(1000);
561
      String filter = "objectclass=InetOrgPerson";
561
      // create the filter based on the uid
562
      
563
      String filter = null;
564
      
565
      if(user.indexOf("o=")>0){
566
    	  String tempStr = user.substring(user.indexOf("o="));
567
    	  filter = "(&(" + user.substring(0, user.indexOf(",")) 
568
			+ ")(" + tempStr.substring(0, tempStr.indexOf(",")) 
569
			+ "))";      
570
      } else{
571
    	  filter = "(&(" + user.substring(0, user.indexOf(",")) 
572
			+ "))";          		  
573
      }
574
   	  filter = "(&(" + user.substring(0, user.indexOf(",")) 
575
		+ "))";          		  
576

  
562 577
      NamingEnumeration namingEnum = ctx.search(user, filter, ctls);
563

  
578
      
564 579
      Attributes tempAttr = null;
565 580
      try {
566 581
        while (namingEnum.hasMore()) {

Also available in: Unified diff