本文整理了Java中org.ldaptive.Response.getResultCode
方法的一些代码示例,展示了Response.getResultCode
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.getResultCode
方法的具体详情如下:
包路径:org.ldaptive.Response
类名称:Response
方法名:getResultCode
[英]Returns the result code of the ldap operation.
[中]返回ldap操作的结果代码。
代码示例来源:origin: org.ldaptive/ldaptive
@Override
public ResultCode getResultCode()
{
return getResponse().getResultCode();
}
代码示例来源:origin: vt-middleware/ldaptive
@Override
public ResultCode getResultCode()
{
return getResponse().getResultCode();
}
代码示例来源:origin: com.floragunn/ldaptive
@Override
public ResultCode getResultCode()
{
return getResponse().getResultCode();
}
代码示例来源:origin: org.ldaptive/ldaptive
@Override
public boolean passivate(final Connection c)
{
boolean success = false;
if (c != null) {
try {
final BindOperation bind = new BindOperation(c);
final Response<Void> response = bind.execute(bindRequest);
success = ResultCode.SUCCESS == response.getResultCode();
} catch (Exception e) {
logger.debug("passivation failed for bind request {}", bindRequest, e);
}
}
return success;
}
代码示例来源:origin: com.floragunn/ldaptive
@Override
public boolean passivate(final Connection c)
{
boolean success = false;
if (c != null) {
try {
final BindOperation bind = new BindOperation(c);
final Response<Void> response = bind.execute(bindRequest);
success = ResultCode.SUCCESS == response.getResultCode();
} catch (Exception e) {
logger.debug("passivation failed for bind request {}", bindRequest, e);
}
}
return success;
}
代码示例来源:origin: vt-middleware/ldaptive
@Override
public boolean passivate(final Connection c)
{
boolean success = false;
if (c != null) {
try {
final BindOperation bind = new BindOperation(c);
final Response<Void> response = bind.execute(bindRequest);
success = ResultCode.SUCCESS == response.getResultCode();
} catch (Exception e) {
logger.debug("passivation failed for bind request {}", bindRequest, e);
}
}
return success;
}
代码示例来源:origin: org.jasig.cas/cas-server-support-x509
/**
* Downloads a CRL from given LDAP url.
*
* @param r the resource that is the ldap url.
* @return the x 509 cRL
* @throws Exception if connection to ldap fails, or attribute to get the revocation list is unavailable
*/
protected X509CRL fetchCRLFromLdap(final Object r) throws Exception {
try {
final String ldapURL = r.toString();
logger.debug("Fetching CRL from ldap {}", ldapURL);
final Response<SearchResult> result = performLdapSearch(ldapURL);
if (result.getResultCode() == ResultCode.SUCCESS) {
final LdapEntry entry = result.getResult().getEntry();
final LdapAttribute attribute = entry.getAttribute();
logger.debug("Located entry [{}]. Retrieving first attribute [{}]",
entry, attribute);
return fetchX509CRLFromAttribute(attribute);
} else {
logger.debug("Failed to execute the search [{}]", result);
}
throw new CertificateException("Failed to establish a connection ldap and search.");
} catch (final LdapException e) {
logger.error(e.getMessage(), e);
throw new CertificateException(e);
}
}
代码示例来源:origin: org.ldaptive/ldaptive
/**
* Executes the ldap search operation.
*
* @param cf connection factory
* @param request search request
*
* @return status code
*
* @throws Exception on any LDAP search error
*/
protected int search(final ConnectionFactory cf, final SearchRequest request)
throws Exception
{
final Connection conn = cf.getConnection();
conn.open();
final SearchOperation op = new SearchOperation(conn);
final Response<SearchResult> response = op.execute(request);
final SearchResult result = response.getResult();
final SearchResultWriter writer;
if (outputDsmlv1) {
writer = new Dsmlv1Writer(new BufferedWriter(new OutputStreamWriter(System.out)));
} else {
writer = new LdifWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
}
writer.write(result);
conn.close();
return response.getResultCode().value();
}
代码示例来源:origin: org.ldaptive/ldaptive
@Override
public void responseReceived(final Response<Void> response)
{
searchResponse = new Response<>(
searchResult,
response.getResultCode(),
response.getMessage(),
response.getMatchedDn(),
response.getControls(),
response.getReferralURLs(),
response.getMessageId());
responseLock.release();
}
代码示例来源:origin: vt-middleware/ldaptive
@Override
public void responseReceived(final Response<Void> response)
{
searchResponse = new Response<>(
searchResult,
response.getResultCode(),
response.getMessage(),
response.getMatchedDn(),
response.getControls(),
response.getReferralURLs(),
response.getMessageId());
responseLock.release();
}
代码示例来源:origin: com.floragunn/ldaptive
@Override
public void responseReceived(final Response<Void> response)
{
searchResponse = new Response<>(
searchResult,
response.getResultCode(),
response.getMessage(),
response.getMatchedDn(),
response.getControls(),
response.getReferralURLs(),
response.getMessageId());
responseLock.release();
}
代码示例来源:origin: org.ldaptive/ldaptive
/**
* Executes the ldap compare operation.
*
* @param cf connection factory
* @param dn to compare attribute on
* @param attr attribute to compare
*
* @return status code
*
* @throws Exception on any LDAP search error
*/
protected int compare(final ConnectionFactory cf, final String dn, final LdapAttribute attr)
throws Exception
{
final Connection conn = cf.getConnection();
conn.open();
final CompareOperation op = new CompareOperation(conn);
final Response<Boolean> response = op.execute(new CompareRequest(dn, attr));
System.out.println(response.getResult());
conn.close();
return response.getResultCode().value();
}
代码示例来源:origin: org.jasig.cas/cas-server-support-ldap-core
/**
* Execute delete operation boolean.
*
* @param connectionFactory the connection factory
* @param entry the entry
* @return the boolean
* @throws LdapException the ldap exception
*/
public static boolean executeDeleteOperation(final ConnectionFactory connectionFactory,
final LdapEntry entry) throws LdapException {
try (Connection connection = createConnection(connectionFactory)) {
final DeleteOperation delete = new DeleteOperation(connection);
final DeleteRequest request = new DeleteRequest(entry.getDn());
request.setReferralHandler(new DeleteReferralHandler());
final Response<Void> res = delete.execute(request);
return res.getResultCode() == ResultCode.SUCCESS;
} catch (final LdapException e) {
LOGGER.error(e.getMessage(), e);
}
return false;
}
}
代码示例来源:origin: vt-middleware/ldaptive
/**
* Executes the ldap compare operation.
*
* @param cf connection factory
* @param dn to compare attribute on
* @param attr attribute to compare
*
* @return status code
*
* @throws Exception on any LDAP search error
*/
protected int compare(final ConnectionFactory cf, final String dn, final LdapAttribute attr)
throws Exception
{
final Connection conn = cf.getConnection();
conn.open();
final CompareOperation op = new CompareOperation(conn);
final Response<Boolean> response = op.execute(new CompareRequest(dn, attr));
System.out.println(response.getResult());
conn.close();
return response.getResultCode().value();
}
代码示例来源:origin: com.floragunn/ldaptive
/**
* Executes the ldap compare operation.
*
* @param cf connection factory
* @param dn to compare attribute on
* @param attr attribute to compare
*
* @return status code
*
* @throws Exception on any LDAP search error
*/
protected int compare(final ConnectionFactory cf, final String dn, final LdapAttribute attr)
throws Exception
{
final Connection conn = cf.getConnection();
conn.open();
final CompareOperation op = new CompareOperation(conn);
final Response<Boolean> response = op.execute(new CompareRequest(dn, attr));
System.out.println(response.getResult());
conn.close();
return response.getResultCode().value();
}
代码示例来源:origin: org.ldaptive/ldaptive
@Override
protected AuthenticationHandlerResponse authenticateInternal(
final Connection c,
final AuthenticationCriteria criteria)
throws LdapException
{
final byte[] hash = digestCredential(criteria.getCredential(), passwordScheme.getAlgorithm());
final LdapAttribute la = new LdapAttribute(
passwordAttribute,
String.format("{%s}%s", passwordScheme.getLabel(), LdapUtils.base64Encode(hash)).getBytes());
final CompareOperation compare = new CompareOperation(c);
final CompareRequest request = new CompareRequest(criteria.getDn(), la);
request.setControls(processRequestControls(criteria));
final Response<Boolean> compareResponse = compare.execute(request);
return
new AuthenticationHandlerResponse(
compareResponse.getResult(),
compareResponse.getResultCode(),
c,
compareResponse.getMessage(),
compareResponse.getControls(),
compareResponse.getMessageId());
}
代码示例来源:origin: vt-middleware/ldaptive
@Override
protected AuthenticationHandlerResponse authenticateInternal(
final Connection c,
final AuthenticationCriteria criteria)
throws LdapException
{
final byte[] hash = digestCredential(criteria.getCredential(), passwordScheme.getAlgorithm());
final LdapAttribute la = new LdapAttribute(
passwordAttribute,
String.format("{%s}%s", passwordScheme.getLabel(), LdapUtils.base64Encode(hash)).getBytes());
final CompareOperation compare = new CompareOperation(c);
final CompareRequest request = new CompareRequest(criteria.getDn(), la);
request.setControls(processRequestControls(criteria));
final Response<Boolean> compareResponse = compare.execute(request);
return
new AuthenticationHandlerResponse(
compareResponse.getResult(),
compareResponse.getResultCode(),
c,
compareResponse.getMessage(),
compareResponse.getControls(),
compareResponse.getMessageId());
}
代码示例来源:origin: com.floragunn/ldaptive
/**
* Performs the ldap search.
*
* @param request to invoke search with
*
* @return ldap response
*
* @throws LdapException if an error occurs
*/
protected Response<SearchResult> executeSearch(final SearchRequest request)
throws LdapException
{
final SearchIterator si = getConnection().getProviderConnection().search(request);
final SearchResult result = readResult(request, si);
final Response<Void> response = si.getResponse();
return
new Response<>(
result,
response.getResultCode(),
response.getMessage(),
response.getMatchedDn(),
response.getControls(),
response.getReferralURLs(),
response.getMessageId());
}
代码示例来源:origin: org.ldaptive/ldaptive
/**
* Performs the ldap search.
*
* @param request to invoke search with
*
* @return ldap response
*
* @throws LdapException if an error occurs
*/
protected Response<SearchResult> executeSearch(final SearchRequest request)
throws LdapException
{
final SearchIterator si = getConnection().getProviderConnection().search(request);
final SearchResult result = readResult(request, si);
final Response<Void> response = si.getResponse();
return
new Response<>(
result,
response.getResultCode(),
response.getMessage(),
response.getMatchedDn(),
response.getControls(),
response.getReferralURLs(),
response.getMessageId());
}
代码示例来源:origin: vt-middleware/ldaptive
/**
* Performs the ldap search.
*
* @param request to invoke search with
*
* @return ldap response
*
* @throws LdapException if an error occurs
*/
protected Response<SearchResult> executeSearch(final SearchRequest request)
throws LdapException
{
final SearchIterator si = getConnection().getProviderConnection().search(request);
final SearchResult result = readResult(request, si);
final Response<Void> response = si.getResponse();
return
new Response<>(
result,
response.getResultCode(),
response.getMessage(),
response.getMatchedDn(),
response.getControls(),
response.getReferralURLs(),
response.getMessageId());
}
内容来源于网络,如有侵权,请联系作者删除!