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


Java LDAPAttribute类代码示例

本文整理汇总了Java中netscape.ldap.LDAPAttribute的典型用法代码示例。如果您正苦于以下问题:Java LDAPAttribute类的具体用法?Java LDAPAttribute怎么用?Java LDAPAttribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: GetValue

import netscape.ldap.LDAPAttribute; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private String GetValue(LDAPAttribute[] attributes_LDIF ,String AttributValue)
{
	String Stringvalue=null;
	int i=0;
       
	for (int j = 0; j < attributes_LDIF.length; j++) 
	{
		LDAPAttribute attribute_DIF = attributes_LDIF[j];
		if (attribute_DIF.getName().equalsIgnoreCase(AttributValue))
		{
			Enumeration<String> valuesLDIF = attribute_DIF.getStringValues();
			
			while (valuesLDIF.hasMoreElements()) 
			{
				String valueLDIF = (String) valuesLDIF.nextElement();
				if (i==0)	
					Stringvalue=  valueLDIF;
				else
					Stringvalue= Stringvalue + data.multiValueSeparator + valueLDIF;	
				i++;
			}
		}
	}
	return Stringvalue;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:27,代码来源:LDIFInput.java

示例2: GetValue

import netscape.ldap.LDAPAttribute; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private String GetValue(LDAPAttribute[] attributes_LDIF,
		String AttributValue) {
	String Stringvalue = null;

	for (int j = 0; j < attributes_LDIF.length; j++) {
		LDAPAttribute attribute_DIF = attributes_LDIF[j];
		if (attribute_DIF.getName().equalsIgnoreCase(AttributValue)) {
			Enumeration<String> valuesLDIF = attribute_DIF.getStringValues();
			// Get the first occurence
			Stringvalue = valuesLDIF.nextElement();
		}
	}

	return Stringvalue;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:17,代码来源:LDIFInputDialog.java

示例3: GetValue

import netscape.ldap.LDAPAttribute; //导入依赖的package包/类
@SuppressWarnings( "unchecked" )
private String GetValue( LDAPAttribute[] attributes_LDIF, String AttributValue ) {
  String Stringvalue = null;
  int i = 0;

  for ( int j = 0; j < attributes_LDIF.length; j++ ) {
    LDAPAttribute attribute_DIF = attributes_LDIF[j];
    if ( attribute_DIF.getName().equalsIgnoreCase( AttributValue ) ) {
      Enumeration<String> valuesLDIF = attribute_DIF.getStringValues();

      while ( valuesLDIF.hasMoreElements() ) {
        String valueLDIF = valuesLDIF.nextElement();
        if ( i == 0 ) {
          Stringvalue = valueLDIF;
        } else {
          Stringvalue = Stringvalue + data.multiValueSeparator + valueLDIF;
        }
        i++;
      }
    }
  }
  return Stringvalue;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:24,代码来源:LDIFInput.java

示例4: GetValue

import netscape.ldap.LDAPAttribute; //导入依赖的package包/类
@SuppressWarnings( "unchecked" )
private String GetValue( LDAPAttribute[] attributes_LDIF, String AttributValue ) {
  String Stringvalue = null;

  for ( int j = 0; j < attributes_LDIF.length; j++ ) {
    LDAPAttribute attribute_DIF = attributes_LDIF[j];
    if ( attribute_DIF.getName().equalsIgnoreCase( AttributValue ) ) {
      Enumeration<String> valuesLDIF = attribute_DIF.getStringValues();
      // Get the first occurence
      Stringvalue = valuesLDIF.nextElement();
    }
  }

  return Stringvalue;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:16,代码来源:LDIFInputDialog.java

示例5: revoke

import netscape.ldap.LDAPAttribute; //导入依赖的package包/类
@Override
public synchronized boolean revoke(String name)
{
    LoginCredentialsController.clearCredentials();
    
    LDAPConnection conn = new LDAPConnection();
    try
    {
        conn.connect(this.host, this.port, this.binddn, this.password);
        
        String attrs[] = {"l"};
        LDAPSearchResults search = conn.search(this.basedn, LDAPv2.SCOPE_SUB, this.getUserSearchFilter(name), 
               attrs, false);
        if (!search.hasMoreElements())
        {
            this.logger.warn("User with name '" + name + "' not found on the LDAP server.");
            this.failureReason = "User with name '" + name + "' not found on the LDAP server.";
            return false;
        }
        
        LDAPEntry user = search.next();
        this.logger.debug("Found user '" + name + "' LDAP record with DN '" + user.getDN() + "'.");
        
        LDAPAttribute attr = user.getAttribute("l");
        if (attr == null)
        {
            this.logger.warn("Unable to restore the " + name + "'s old password as it has not been stored (" +
            		"expected it in 'l'). This is not treated as a failure.");
            return true;
        }
        
        String lmpass = " ", ntpass = " ";
        for (String v : attr.getStringValueArray())
        {
            if (v.startsWith("LM-")) lmpass = v.substring("LM-".length());
            else if (v.startsWith("NT-")) ntpass = v.substring("NT-".length());
        }
        
        LDAPModificationSet mod = new LDAPModificationSet();
        mod.add(LDAPModification.REPLACE, new LDAPAttribute("sambalmpassword", lmpass));
        mod.add(LDAPModification.REPLACE, new LDAPAttribute("sambantpassword", ntpass));
        mod.add(LDAPModification.DELETE, new LDAPAttribute("l"));
        
        conn.modify(user.getDN(), mod);
        return true;
    }
    catch (LDAPException ex)
    {
        this.failureReason = "Failed LDAP operation. Code: " + ex.getLDAPResultCode() + ", message: " 
                + ex.getLDAPErrorMessage() + ".";
        this.logger.error(this.failureReason);
        return false;
    }
    finally
    {
        try
        {
            if (conn.isConnected()) conn.disconnect();
        }
        catch (LDAPException e)
        {
            this.logger.error("Failed LDAP disconnect. Code: " + e.getLDAPResultCode() + ", message: " 
                    + e.getLDAPErrorMessage() + ".");
        }
    }
}
 
开发者ID:sahara-labs,项目名称:rig-client-commons,代码行数:67,代码来源:SambaPasswordAccessAction.java


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