本文整理汇总了Java中com.novell.ldap.LDAPException.resultCodeToString方法的典型用法代码示例。如果您正苦于以下问题:Java LDAPException.resultCodeToString方法的具体用法?Java LDAPException.resultCodeToString怎么用?Java LDAPException.resultCodeToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.novell.ldap.LDAPException
的用法示例。
在下文中一共展示了LDAPException.resultCodeToString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bind
import com.novell.ldap.LDAPException; //导入方法依赖的package包/类
public void bind(BindInterceptorChain chain, DistinguishedName dn,
Password pwd, LDAPConstraints constraints) throws LDAPException {
Connection con = null;
chain.getRequest().put(JdbcInsert.MYVD_DID_BIND + this.name, false);
try {
con = this.getCon();
chain.getRequest().put(JdbcInsert.MYVD_DB_CON + this.name, con);
chain.nextBind(dn, pwd, constraints);
} catch (Throwable t) {
if (t instanceof LDAPException) {
throw (LDAPException) t;
} else {
throw new LDAPException("Error",LDAPException.OPERATIONS_ERROR,"Error",t);
}
} finally {
unloadRequest(chain, con);
if (! ((Boolean) chain.getRequest().get(MYVD_DID_BIND + this.name))) {
throw new LDAPException(LDAPException.resultCodeToString(LDAPException.INVALID_CREDENTIALS),LDAPException.INVALID_CREDENTIALS,"No authentication occurred");
}
}
}
示例2: configure
import com.novell.ldap.LDAPException; //导入方法依赖的package包/类
@Override
public void configure(String name, Properties props, NameSpace nameSpace)
throws LDAPException {
this.name = name;
this.ns = nameSpace;
this.jdbc = null;
this.sql = props.getProperty("sql");
log.info("SQL : '" + sql + "'");
this.hashFunction = props.getProperty("hashFunction");
log.info("Hash Function : '" + hashFunction + "'");
try {
this.md = MessageDigest.getInstance(this.hashFunction);
} catch (NoSuchAlgorithmException e) {
throw new LDAPException(this.hashFunction + " not present",LDAPException.OPERATIONS_ERROR,LDAPException.resultCodeToString(LDAPException.INVALID_CREDENTIALS));
}
}
示例3: findJdbcInsert
import com.novell.ldap.LDAPException; //导入方法依赖的package包/类
private synchronized void findJdbcInsert() throws LDAPException {
if (this.jdbc != null) {
return;
}
for (int i=0;i<this.ns.getChain().getLength();i++) {
if (this.ns.getChain().getInsert(i) instanceof JdbcPool) {
this.jdbc = (JdbcPool) this.ns.getChain().getInsert(i);
break;
}
}
if (this.jdbc == null) {
throw new LDAPException("No Jdbc Insert found on this chain",LDAPException.OPERATIONS_ERROR,LDAPException.resultCodeToString(LDAPException.OPERATIONS_ERROR));
}
}
示例4: compare
import com.novell.ldap.LDAPException; //导入方法依赖的package包/类
public void compare(CompareInterceptorChain chain, DistinguishedName dn,
Attribute attrib, LDAPConstraints constraints) throws LDAPException {
SearchInterceptorChain nchain = chain.createSearchChain(chain.getPositionInChain(this));
Results res = new Results(null,chain.getPositionInChain(this));
ArrayList<net.sourceforge.myvd.types.Attribute> attribs = new ArrayList<net.sourceforge.myvd.types.Attribute>();
attribs.add(new Attribute("1.1"));
FilterNode node = new FilterNode(FilterType.EQUALS,attrib.getAttribute().getName(),attrib.getAttribute().getStringValue());
Filter filter = new Filter(node);
nchain.nextSearch(dn, new Int(0), filter, attribs, new Bool(false), res, new LDAPSearchConstraints());
boolean compareSucceeds = false;
res.start();
if (res.hasMore()) {
res.next();
while (res.hasMore()) res.next();
compareSucceeds = true;
}
if (! compareSucceeds) {
throw new LDAPException(LDAPException.resultCodeToString(LDAPException.COMPARE_FALSE),LDAPException.COMPARE_FALSE,"Compare failed");
}
}
示例5: getLocalBackendsWrite
import com.novell.ldap.LDAPException; //导入方法依赖的package包/类
private NameSpace getLocalBackendsWrite(InterceptorChain chain, String dn, boolean isRename) throws LDAPException {
NameSpace curr;
String key = null;
if (isRename) {
key = RequestVariables.ROUTE_NAMESPACE_RENAME;
} else {
key = RequestVariables.ROUTE_NAMESPACE;
}
if (! chain.getRequest().containsKey(key)) {
//logger.info("DN : " + dn);
Level level = this.getLevel(new DN(dn));
if (level == null) {
throw new LDAPException(LDAPException.resultCodeToString(LDAPException.NO_SUCH_OBJECT),LDAPException.NO_SUCH_OBJECT,"");
}
Iterator<NameSpace> it = level.backends.iterator();
curr = it.next();
} else {
curr = this.backends.get(chain.getRequest().get(key));
}
return curr;
}
示例6: getLocalLevels
import com.novell.ldap.LDAPException; //导入方法依赖的package包/类
private ArrayList<NameSpace> getLocalLevels(InterceptorChain chain, DistinguishedName dn) throws LDAPException {
ArrayList<NameSpace> localBackends;
logger.debug("Is set namespace?");
if (chain.getRequest().containsKey(RequestVariables.ROUTE_NAMESPACE)) {
logger.debug("namespace manually set");
Object obj = chain.getRequest().get(RequestVariables.ROUTE_NAMESPACE);
if (obj instanceof ArrayList) {
ArrayList<String> list = (ArrayList<String>) obj;
localBackends = new ArrayList<NameSpace>();
Iterator<String> it = list.iterator();
while (it.hasNext()) {
NameSpace lns = this.backends.get(it.next());
if (lns.getBase().getDN().isDescendantOf(dn.getDN()) || dn.getDN().equals(lns.getBase().getDN()) || dn.getDN().isDescendantOf(lns.getBase().getDN())) {
localBackends.add(lns);
}
}
} else if (obj instanceof String) {
localBackends = new ArrayList<NameSpace>();
localBackends.add(this.backends.get((String) obj));
} else {
throw new LDAPException("Invalid routing type",LDAPException.OPERATIONS_ERROR,"");
}
} else {
logger.debug("namespace set by router");
Level level = this.getLevel(dn.getDN());
logger.debug("namespace levels determined");
if (level == null) {
logger.debug("no levels found");
throw new LDAPException(LDAPException.resultCodeToString(LDAPException.NO_SUCH_OBJECT),LDAPException.NO_SUCH_OBJECT,"");
}
localBackends = level.backends;
}
return localBackends;
}
示例7: bind
import com.novell.ldap.LDAPException; //导入方法依赖的package包/类
@Override
public void bind(BindInterceptorChain chain, DistinguishedName dn,
Password pwd, LDAPConstraints constraints) throws LDAPException {
if (this.jdbc == null) {
this.findJdbcInsert();
}
Connection con = null;
boolean success = false;
try {
con = this.jdbc.getCon();
this.md.reset();
String hashedPass = Hex.toHexString(this.md.digest(pwd.getValue()));
RDN rdn = (RDN) dn.getDN().getRDNs().get(0);
PreparedStatement ps = con.prepareStatement(this.sql);
ps.setString(1, rdn.getValue());
ps.setString(2, hashedPass);
ResultSet rs = ps.executeQuery();
success = rs.next();
rs.close();
ps.close();
} catch (Throwable t) {
throw new LDAPException("Could not execute bind",LDAPException.OPERATIONS_ERROR,LDAPException.resultCodeToString(LDAPException.OPERATIONS_ERROR),t);
} finally {
if (con != null) {
this.jdbc.returnCon(con);
}
}
if (! success) {
throw new LDAPException(LDAPException.resultCodeToString(LDAPException.INVALID_CREDENTIALS),LDAPException.INVALID_CREDENTIALS,LDAPException.resultCodeToString(LDAPException.INVALID_CREDENTIALS));
}
}
示例8: bind
import com.novell.ldap.LDAPException; //导入方法依赖的package包/类
@Override
public void bind(BindInterceptorChain chain, DistinguishedName dn,
Password pwd, LDAPConstraints constraints) throws LDAPException {
if (this.jdbc == null) {
this.findJdbcInsert();
}
Connection con = null;
boolean success = false;
try {
con = this.jdbc.getCon();
RDN rdn = (RDN) dn.getDN().getRDNs().get(0);
if (log.isDebugEnabled()) {
log.debug("User RDN : '" + rdn.getValue() + "'");
}
PreparedStatement ps = con.prepareStatement(this.sql);
ps.setString(1, rdn.getValue());
ResultSet rs = ps.executeQuery();
if (rs.next()) {
String hashedPassword = rs.getString(1);
success = PBKDF2.checkPassword(new String(pwd.getValue()), hashedPassword);
} else {
success = false;
}
rs.close();
ps.close();
} catch (Throwable t) {
throw new LDAPException("Could not execute bind",LDAPException.OPERATIONS_ERROR,LDAPException.resultCodeToString(LDAPException.OPERATIONS_ERROR),t);
} finally {
if (con != null) {
this.jdbc.returnCon(con);
}
}
if (! success) {
throw new LDAPException(LDAPException.resultCodeToString(LDAPException.INVALID_CREDENTIALS),LDAPException.INVALID_CREDENTIALS,LDAPException.resultCodeToString(LDAPException.INVALID_CREDENTIALS));
}
}
示例9: bind
import com.novell.ldap.LDAPException; //导入方法依赖的package包/类
@Override
public void bind(BindInterceptorChain chain, DistinguishedName dn,
Password pwd, LDAPConstraints constraints) throws LDAPException {
if (this.jdbc == null) {
this.findJdbcInsert();
}
Connection con = null;
boolean success = false;
try {
con = this.jdbc.getCon();
this.md.reset();
String hashedPass = Hex.toHexString(this.md.digest(pwd.getValue()));
RDN rdn = (RDN) dn.getDN().getRDNs().get(0);
if (log.isDebugEnabled()) {
log.debug("User RDN : '" + rdn.getValue() + "'");
log.debug("Hashed Password : '" + hashedPass + "'");
}
PreparedStatement ps = con.prepareStatement(this.sql);
ps.setString(1, rdn.getValue());
ps.setString(2, hashedPass);
ResultSet rs = ps.executeQuery();
success = rs.next();
rs.close();
ps.close();
} catch (Throwable t) {
throw new LDAPException("Could not execute bind",LDAPException.OPERATIONS_ERROR,LDAPException.resultCodeToString(LDAPException.OPERATIONS_ERROR),t);
} finally {
if (con != null) {
this.jdbc.returnCon(con);
}
}
if (! success) {
throw new LDAPException(LDAPException.resultCodeToString(LDAPException.INVALID_CREDENTIALS),LDAPException.INVALID_CREDENTIALS,LDAPException.resultCodeToString(LDAPException.INVALID_CREDENTIALS));
}
}