testauth.java~5~
来自「JNDI课件」· JAVA~5~ 代码 · 共 37 行
JAVA~5~
37 行
package jndi;/* 曾海 2003-10-1测试ldap server支持的加密服务*/import javax.naming.*;import javax.naming.directory.*;import java.util.*;public class TestAuth { public TestAuth() { try{ DirContext ctx = new InitialDirContext(); Attributes attrs = ctx.getAttributes( "ldap://localhost:389", new String[]{"supportedSASLMechanisms"}); Enumeration enu = attrs.getAll() ; while(enu!=null && enu.hasMoreElements() ){ Attribute atr = (Attribute) enu.nextElement(); System.err.println("属性是"+ atr ); Enumeration ne = atr.getAll() ; while(ne!=null && ne.hasMoreElements() ) System.err.println(" = "+ne.nextElement() ); } ctx.close() ; }catch(Exception e ) {System.err.println("出现意外"); System.exit(1);}; } public static void main(String[] args) { TestAuth testAuth1 = new TestAuth(); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?