本文整理汇总了Java中com.unboundid.ldap.sdk.BindResult类的典型用法代码示例。如果您正苦于以下问题:Java BindResult类的具体用法?Java BindResult怎么用?Java BindResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BindResult类属于com.unboundid.ldap.sdk包,在下文中一共展示了BindResult类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: authenticateConnectionPoolImpl
import com.unboundid.ldap.sdk.BindResult; //导入依赖的package包/类
private boolean authenticateConnectionPoolImpl(final String bindDn, final String password) throws LDAPException, ConnectionException {
boolean loggedIn = false;
if (bindDn == null) {
return loggedIn;
}
boolean closeConnection = false;
LDAPConnection connection = connectionProvider.getConnection();
try {
closeConnection = true;
BindResult r = connection.bind(bindDn, password);
if (r.getResultCode() == ResultCode.SUCCESS) {
loggedIn = true;
}
} finally {
connectionProvider.releaseConnection(connection);
// We can't use connection which binded as ordinary user
if (closeConnection) {
connectionProvider.closeDefunctConnection(connection);
}
}
return loggedIn;
}
示例2: authenticateBindConnectionPoolImpl
import com.unboundid.ldap.sdk.BindResult; //导入依赖的package包/类
private boolean authenticateBindConnectionPoolImpl(final String bindDn, final String password) throws LDAPException, ConnectionException {
if (bindDn == null) {
return false;
}
LDAPConnection connection = bindConnectionProvider.getConnection();
try {
BindResult r = connection.bind(bindDn, password);
return r.getResultCode() == ResultCode.SUCCESS;
} finally {
bindConnectionProvider.releaseConnection(connection);
}
}
示例3: testInMemBind
import com.unboundid.ldap.sdk.BindResult; //导入依赖的package包/类
@Test
public void testInMemBind() throws Exception {
String user = "cn=test,dc=staticsecurity,dc=geomajas,dc=org";
LDAPConnection connection = new LDAPConnection("localhost", PORT);
BindResult auth = connection.bind(user, "cred");
System.out.println("auth " + auth);
System.out.println(" rc " + auth.getResultCode());
System.out.println(" cu " + auth.getResultCode().isConnectionUsable());
System.out.println(" dn " + auth.getMatchedDN());
System.out.println(" dm " + auth.getDiagnosticMessage());
SearchRequest request = new SearchRequest(user,
SearchScope.ONE, Filter.createEqualityFilter("objectclass", "person"),
"cn", "groupMembership", "givenName", "sn", "ou");
SearchResult search = connection.search(request);
System.out.println(search);
System.out.println("count " + search.getEntryCount());
System.out.println("count " + search.getSearchEntries());
for (SearchResultEntry se : search.getSearchEntries()) {
System.out.println("-- cn " + se.getAttributeValue("cn"));
System.out.println(" givenName " + se.getAttributeValue("givenName"));
System.out.println(" sn " + se.getAttributeValue("sn"));
System.out.println(" ou " + se.getAttributeValue("ou"));
System.out.println(" groupMembership ");
if (null != se.getAttributeValues("groupMembership")) {
for (String val : se.getAttributeValues("groupMembership")) {
System.out.println(" " + val);
}
}
}
}