当前位置: 首页>>代码示例>>Java>>正文


Java BindResult类代码示例

本文整理汇总了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;
}
 
开发者ID:GluuFederation,项目名称:oxCore,代码行数:26,代码来源:LdapOperationsServiceImpl.java

示例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);
	}
}
 
开发者ID:GluuFederation,项目名称:oxCore,代码行数:14,代码来源:LdapOperationsServiceImpl.java

示例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);
			}
		}
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:33,代码来源:LdapTest.java


注:本文中的com.unboundid.ldap.sdk.BindResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。