Project

General

Profile

« Previous | Next » 

Revision 8703

Added by Jing Tao almost 11 years ago

Rather than directly to modify the env, we use context.addToEnv.
This fixed a bug in non-tls env, the alias log-in doesn't work.

View differences:

src/edu/ucsb/nceas/metacat/AuthLdap.java
430 430
		double stopTime;
431 431
		
432 432
		logMetacat.info("AuthLdap.authenticateNonTLS - Trying to authenticate without TLS");
433
		env.put(Context.SECURITY_AUTHENTICATION, "simple");
434
		env.put(Context.SECURITY_PRINCIPAL, userDN);
435
		env.put(Context.SECURITY_CREDENTIALS, password);
433
		//env.put(Context.SECURITY_AUTHENTICATION, "simple");
434
		//env.put(Context.SECURITY_PRINCIPAL, userDN);
435
		//env.put(Context.SECURITY_CREDENTIALS, password);
436 436

  
437 437
		startTime = System.currentTimeMillis();
438 438
		ctx = new InitialLdapContext(env, null);
439
		ctx.addToEnvironment(Context.SECURITY_AUTHENTICATION, "simple");
440
        ctx.addToEnvironment(Context.SECURITY_PRINCIPAL, userDN);
441
        ctx.addToEnvironment(Context.SECURITY_CREDENTIALS, password);
442
        ctx.reconnect(null);
439 443
		stopTime = System.currentTimeMillis();
440 444
		logMetacat.info("AuthLdap.authenticateNonTLS - Connection time thru " + ldapsUrl + " was: "
441 445
				+ (stopTime - startTime) / 1000 + " seconds.");

Also available in: Unified diff