优雅欢快的轻音乐

00:00/00:00

00:00/00:00

00:00/00:00

00:00/00:00

00:00/00:00

AD域验证

public class Test_ADUser {
	
  public static void main(String[] args) {
	String username = "zhangsan";
	String password="123456";
	String serverName = "ldap://" + "123.206.29.175" + ":" + "389";//默认端口389
	System.out.print(VerifyADUser(serverName,username,password));
  } 
  private static boolean VerifyADUser(String serverName,String username,String password) { 
        DirContext ctx = null;
	Hashtable<String, String> evn = new Hashtable<String, String>();
	evn.put(Context.SECURITY_AUTHENTICATION, "simple");
	evn.put(Context.SECURITY_PRINCIPAL, username);
	evn.put(Context.SECURITY_CREDENTIALS, password);
	evn.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
	evn.put("com.sun.jndi.ldap.connect.timeout", "3000");// 连接超时设置为3秒
	evn.put(Context.PROVIDER_URL,serverName);
	try {
		ctx = new InitialDirContext(evn);
		ctx.close();
		return true;
	} catch (NamingException e) {
		System.out.println("身份验证失败");
	} catch (Exception ex) {
		System.out.print("Failed to open socket ");
	}

	return false;
	}

}