Project

General

Profile

« Previous | Next » 

Revision 8650

Added by Jing Tao over 10 years ago

In the getALiasedName method, the referral set to ignore. Since the alias name is the local referral, we need to set it to ignore.

View differences:

src/edu/ucsb/nceas/metacat/AuthLdap.java
358 358
	 */
359 359
	private String getAliasedDn(String alias, Hashtable<String, String> env, boolean useTLS) throws NamingException, IOException  {
360 360
	    String aliasedDn = null;
361
	    if(env != null) {
362
	        env.put(Context.REFERRAL, "ignore");
363
	    }
361 364
        LdapContext sctx = new InitialLdapContext(env, null);
362 365
        StartTlsResponse tls = null;
363 366
        if(useTLS) {
......
629 632
	public String[] getUserInfo(String user, String password) throws ConnectException {
630 633
		String[] userinfo = new String[3];
631 634

  
635
		logMetacat.info("AuthLdap.getUserInfo - get the user info for user  "+user);
632 636
		// Identify service provider to use
633 637
		Hashtable env = new Hashtable(11);
634
		env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
635
		env.put(Context.REFERRAL, referral);
638
		env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");	
636 639
		env.put(Context.PROVIDER_URL, ldapUrl);
637 640
		String realName = null;
638 641
		try {
......
640 643
		} catch(Exception e) {
641 644
		    logMetacat.warn("AuthLdap.getUserInfo - can't get the alias name for the user "+user+" since "+e.getMessage());
642 645
		}
643
		
646
		logMetacat.info("AuthLdap.getUserInfo - get the real name   "+realName);
644 647
		if(realName != null) {
645 648
		    //the the user is an alias name. we need to use the the real name
646 649
		    user = realName;
......
649 652
		try {
650 653

  
651 654
			// Create the initial directory context
655
		    env.put(Context.REFERRAL, referral);
652 656
			DirContext ctx = new InitialDirContext(env);
653 657
			// Specify the attributes to match.
654 658
			// Users are objects that have the attribute

Also available in: Unified diff