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


Java LDAPException.INVALID_CREDENTIALS属性代码示例

本文整理汇总了Java中com.novell.ldap.LDAPException.INVALID_CREDENTIALS属性的典型用法代码示例。如果您正苦于以下问题:Java LDAPException.INVALID_CREDENTIALS属性的具体用法?Java LDAPException.INVALID_CREDENTIALS怎么用?Java LDAPException.INVALID_CREDENTIALS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.novell.ldap.LDAPException的用法示例。


在下文中一共展示了LDAPException.INVALID_CREDENTIALS属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bind

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");
		}
	}

}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:25,代码来源:JdbcInsert.java

示例2: bindPrimary

private void bindPrimary(DistinguishedName dn, Password pwd, LDAPConstraints constraints,
		Bool primaryBindFailed, HashMap<DN, DistinguishedName> boundNameSpaces, BindInterceptorChain bindChain) throws LDAPException {
	try {
		DistinguishedName newBindDN = new DistinguishedName(util.getRemoteMappedDN(dn.getDN(),this.explodedLocalNameSpace,this.explodedPrimaryNamespace));
		bindChain.nextBind(newBindDN,pwd,constraints);
		
		boundNameSpaces.put(this.primaryNamespace, newBindDN);
		primaryBindFailed.setValue(false);
	} catch (LDAPException e) {
		primaryBindFailed.setValue(true);
		if (e.getResultCode() != LDAPException.INVALID_CREDENTIALS) {
			throw e;
		}
	}
	
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:16,代码来源:Joiner.java

示例3: bind

public void bind(BindInterceptorChain chain,DistinguishedName dn,Password pwd,LDAPConstraints constraints) throws LDAPException {
	
	
	//check for an anonymouse user
	if (pwd.getValue().length == 0) {
		//user has not bind DN
		dn.setDN(new DN(""));
		return;
	}
	
	ArrayList<NameSpace> localBackends = getLocalLevels(chain, dn);
	int num = 0;
	
	Iterator<NameSpace> it = localBackends.iterator();
	while (it.hasNext()) {
		NameSpace curr = it.next();
		BindInterceptorChain localChain = new BindInterceptorChain(chain.getBindDN(),chain.getBindPassword(),0,curr.getChain(),chain.getSession(),chain.getRequest());
		try {
			localChain.nextBind(dn,pwd,constraints);
		} catch (LDAPException e) {
			if (e.getResultCode() == LDAPException.INVALID_CREDENTIALS || e.getResultCode() == LDAPException.NO_SUCH_OBJECT) {
				num++;
			} else {
				throw e;
			}
		}
		
		if (num == localBackends.size()) {
			throw new LDAPException("Could not bind to any services",LDAPException.INVALID_CREDENTIALS,dn.getDN().toString());
		}
	}
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:32,代码来源:Router.java

示例4: bind

@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));
	}
	
	
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:42,代码来源:SimpleDBAuth.java

示例5: bind

public void bind(BindInterceptorChain chain, DistinguishedName dn,
		Password pwd, LDAPConstraints constraints) throws LDAPException {
	Vector<RDN> rdns = dn.getDN().getRDNs();
	
	
	String domain = rdns.get(1).getValue();
	String user = rdns.get(0).getValue();
	
	
	
	try {
		SmbSession.logon(this.addr,new NtlmPasswordAuthentication(domain,user,new String(pwd.getValue())));
	} catch (SmbException e) {
		e.printStackTrace();
		throw new LDAPException(e.toString(),LDAPException.INVALID_CREDENTIALS,"");
	}
	
	chain.getSession().put(SessionVariables.BOUND_INTERCEPTORS,this.name);

}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:20,代码来源:NTLMAuthenticator.java

示例6: bind

@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));
	}
	
	
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:50,代码来源:Pbkdf2Auth.java

示例7: bind

@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));
	}
	
	
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:46,代码来源:SimpleDBAuth.java

示例8: bindJoined

private void bindJoined(BindInterceptorChain chain, DistinguishedName dn, Password pwd, LDAPConstraints constraints,
		Bool primaryBindFailed, HashMap<DN, DistinguishedName> boundNameSpaces) throws LDAPException {
	BindInterceptorChain bindChain;
	SearchInterceptorChain searchChain = new SearchInterceptorChain(chain.getBindDN(),chain.getBindPassword(),ns.getRouter().getGlobalChain().getLength(),ns.getRouter().getGlobalChain(),chain.getSession(),chain.getRequest(),ns.getRouter());
	Results res = new Results(new InsertChain(new Insert[0]));
	ArrayList<Attribute> attribs = new ArrayList<Attribute>();
	attribs.add(new Attribute("joinedDNs"));
	attribs.add(new Attribute("joinedBases"));
	searchChain.nextSearch(dn,new Int(0),Joiner.OBJ_CLASS_FILTER,attribs,new Bool(false),res,new LDAPSearchConstraints());
	
	res.start();
	if (! res.hasMore() && primaryBindFailed.getValue()) {
		throw new LDAPException("Could not bind to any services",LDAPException.INVALID_CREDENTIALS,dn.getDN().toString());
	}
	
	LDAPEntry entry = res.next().getEntry();
	res.finish();
	
	LDAPAttribute joinDNs = entry.getAttribute("joinedDNs");
	LDAPAttribute joinBases = entry.getAttribute("joinedBases");
	if (joinDNs == null) {
		if (primaryBindFailed.getValue()) {
			throw new LDAPException("Could not bind to any services",LDAPException.INVALID_CREDENTIALS,dn.getDN().toString());
		}
	} else {
		String[] dns = joinDNs.getStringValueArray();
		String[] bases = joinBases.getStringValueArray();
		for (int i=0,m=dns.length;i<m;i++) {
			bindChain = new BindInterceptorChain(chain.getBindDN(),chain.getBindPassword(),ns.getRouter().getGlobalChain().getLength(),ns.getRouter().getGlobalChain(),chain.getSession(),chain.getRequest(),ns.getRouter());
			try {
				DistinguishedName binddn = new DistinguishedName(dns[i]);
				bindChain.nextBind(binddn,pwd,constraints);
				boundNameSpaces.put(new DN(bases[i]), binddn);
				primaryBindFailed.setValue(false);
				break;
			} catch (LDAPException e) {
				if (e.getResultCode() != LDAPException.INVALID_CREDENTIALS) {
					throw e;
				}
				primaryBindFailed.setValue(true);
				
				boundNameSpaces.put(new DN(bases[i]), new DistinguishedName(""));
			}
		}
		
		
	}
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:48,代码来源:Joiner.java


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