Project

General

Profile

« Previous | Next » 

Revision 1006

Added by Jing Tao over 22 years ago

Fixed getGroup method return a exception and cause authenticate failed.

View differences:

src/edu/ucsb/nceas/metacat/AuthLdap.java
111 111
        if (!authenticated) {
112 112
            MetaCatUtil.debugMessage("Looking up DN for: " + identifier);
113 113
            identifier = getIdentifyingName(identifier,ldapUrl,ldapBase);
114
            System.out.println("identifier: "+identifier);
114
            //System.out.println("identifier: "+identifier);
115 115
            String refUrl = "";
116 116
            String refBase = "";
117 117
            if (identifier.startsWith("ldap")) {
......
663 663
      }
664 664
    } catch (NamingException e) {
665 665
      e.printStackTrace(System.err);
666
      throw new ConnectException(
667
      "Problem getting groups for a user in AuthLdap.getGroups:" + e);
666
      String groups[] = new String[uvec.size()];
667
      for(int i=0; i<uvec.size(); i++)
668
      {
669
        groups[i] = (String)uvec.elementAt(i);
670
      }
671
      return groups;
672
       /*throw new ConnectException(
673
      "Problem getting groups for a user in AuthLdap.getGroups:" + e);*/
668 674
    } 
669 675
    
670 676
    MetaCatUtil.debug("The user is in the following groups: " + uvec.toString());
......
1018 1024
        //revise environment variable
1019 1025
        referralInfo=(String)refExc.getReferralInfo();
1020 1026
        env.put(Context.PROVIDER_URL,refExc.getReferralInfo());
1021
        System.out.println("referral info: "+referralInfo);
1027
        //System.out.println("referral info: "+referralInfo);
1022 1028
        //if (referralInfo.indexOf("piscoweb")!=-1)
1023 1029
        //{
1024 1030
          //userName=uid+",o=PISCO,dc=piscoweb,dc=org";
1025 1031
        //}
1026 1032
        env.put(Context.INITIAL_CONTEXT_FACTORY, 
1027 1033
                "com.sun.jndi.ldap.LdapCtxFactory");
1028
        System.out.println("principal: "+userName);
1034
        //System.out.println("principal: "+userName);
1029 1035
        env.put(Context.SECURITY_PRINCIPAL, userName);
1030 1036
        env.put(Context.SECURITY_CREDENTIALS, userPassword);
1031 1037
        env.put(Context.REFERRAL, "throw");

Also available in: Unified diff