本文整理了Java中com.novell.ldap.LDAPConnection.compare()
方法的一些代码示例,展示了LDAPConnection.compare()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LDAPConnection.compare()
方法的具体详情如下:
包路径:com.novell.ldap.LDAPConnection
类名称:LDAPConnection
方法名:compare
[英]Synchronously checks to see if an entry contains an attribute with a specified value.
[中]同步检查条目是否包含具有指定值的属性。
代码示例来源:origin: com.novell.ldap/jldap
/**
*
* Synchronously checks to see if an entry contains an attribute
* with a specified value.
*
* @param dn The distinguished name of the entry to use in the
* comparison.
*<br><br>
* @param attr The attribute to compare against the entry. The
* method checks to see if the entry has an
* attribute with the same name and value as this
* attribute.
*
* @return True if the entry has the value,
* and false if the entry does not
* have the value or the attribute.
*
* @exception LDAPException A general exception which includes an error
* message and an LDAP error code.
*/
public boolean compare(String dn,
LDAPAttribute attr)
throws LDAPException
{
return compare(dn, attr, defSearchCons);
}
代码示例来源:origin: com.novell.ldap/jldap
throws LDAPException
return compare(dn, attr, queue, defSearchCons);
代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core
/**
* Check if provided password is correct provided users's password.
*
* @param userDN the user.
* @param password the password.
* @param passwordField the name of the LDAP field containing the password.
* @return true if the password is valid, false otherwise.
*/
public boolean checkPassword(String userDN, String password, String passwordField)
{
try {
LDAPAttribute attribute = new LDAPAttribute(passwordField, password);
return this.connection.compare(userDN, attribute);
} catch (LDAPException e) {
if (e.getResultCode() == LDAPException.NO_SUCH_OBJECT) {
if (LOG.isDebugEnabled()) {
LOG.debug("Unable to locate user_dn:" + userDN, e);
}
} else if (e.getResultCode() == LDAPException.NO_SUCH_ATTRIBUTE) {
if (LOG.isDebugEnabled()) {
LOG.debug("Unable to verify password because userPassword attribute not found.", e);
}
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("Unable to verify password", e);
}
}
}
return false;
}
代码示例来源:origin: org.xwiki.platform/xwiki-platform-ldap-authenticator
/**
* Check if provided password is correct provided users's password.
*
* @param userDN the user.
* @param password the password.
* @param passwordField the name of the LDAP field containing the password.
* @return true if the password is valid, false otherwise.
*/
public boolean checkPassword(String userDN, String password, String passwordField)
{
try {
LDAPAttribute attribute = new LDAPAttribute(passwordField, password);
return this.connection.compare(userDN, attribute);
} catch (LDAPException e) {
if (e.getResultCode() == LDAPException.NO_SUCH_OBJECT) {
LOGGER.debug("Unable to locate user_dn [{}]", userDN, e);
} else if (e.getResultCode() == LDAPException.NO_SUCH_ATTRIBUTE) {
LOGGER.debug("Unable to verify password because userPassword attribute not found.", e);
} else {
LOGGER.debug("Unable to verify password", e);
}
}
return false;
}
代码示例来源:origin: stackoverflow.com
try
compareResult = connection.compare(compareRequest);
if (compareResult.compareMatched())
代码示例来源:origin: com.novell.ldap/jldap
/**
*
* Synchronously checks to see if an entry contains an attribute
* with a specified value.
*
* @see <a href="../../../../api/com/novell/ldap/LDAPConnection.html#compare(java.lang.String, com.novell.ldap.LDAPAttribute)">
com.novell.ldap.LDAPConnection.compare(String, LDAPAttribute)</a>
*/
public boolean compare(String dn,
LDAPAttribute attr)
throws LDAPException
{
try {
return conn.compare( dn, attr.getWrappedObject());
} catch( com.novell.ldap.LDAPException ex) {
if( ex instanceof com.novell.ldap.LDAPReferralException) {
throw new LDAPReferralException(
(com.novell.ldap.LDAPReferralException)ex);
} else {
throw new LDAPException( ex);
}
}
}
代码示例来源:origin: com.novell.ldap/jldap
/**
* Checks to see if an entry contains an attribute with a specified
* value, using the specified constraints.
*
* @see <a href="../../../../api/com/novell/ldap/LDAPConnection.html#compare(java.lang.String, com.novell.ldap.LDAPAttribute,
com.novell.ldap.LDAPConstraints)">
com.novell.ldap.LDAPConnection.compare(String, LDAPAttribute,
LDAPConstraints)</a>
*/
public boolean compare(String dn,
LDAPAttribute attr,
LDAPConstraints cons)
throws LDAPException
{
try {
return conn.compare( dn,
attr.getWrappedObject(),
cons.getWrappedObject());
} catch( com.novell.ldap.LDAPException ex) {
if( ex instanceof com.novell.ldap.LDAPReferralException) {
throw new LDAPReferralException(
(com.novell.ldap.LDAPReferralException)ex);
} else {
throw new LDAPException( ex);
}
}
}
代码示例来源:origin: com.novell.ldap/jldap
/**
* Asynchronously compares an attribute value with one in the directory,
* using the specified queue.
*
* @see <a href="../../../../api/com/novell/ldap/LDAPConnection.html#compare(java.lang.String, com.novell.ldap.LDAPAttribute,
com.novell.ldap.LDAPResponseQueue)">
com.novell.ldap.LDAPConnection.compare(String, LDAPAttribute,
LDAPResponseQueue)</a>
*/
public LDAPResponseQueue compare(String dn,
LDAPAttribute attr,
LDAPResponseQueue queue)
throws LDAPException
{
try {
return new LDAPResponseQueue(
conn.compare( dn,
attr.getWrappedObject(),
queue.getWrappedObject()));
} catch( com.novell.ldap.LDAPException ex) {
if( ex instanceof com.novell.ldap.LDAPReferralException) {
throw new LDAPReferralException(
(com.novell.ldap.LDAPReferralException)ex);
} else {
throw new LDAPException( ex);
}
}
}
代码示例来源:origin: com.novell.ldap/jldap
conn.compare( dn,
attr.getWrappedObject(),
queue.getWrappedObject(),
代码示例来源:origin: com.novell.ldap/jldap
"compare(" + dn + ") if value");
LDAPResponseQueue queue = compare(dn, attr, null, cons);
内容来源于网络,如有侵权,请联系作者删除!