Package javax.naming.directory

Examples of javax.naming.directory.Attribute


      DirContext ctx = bindSystem();
      String dn = searchUserDN(uid, ctx);
     
      ModificationItem [] modificationItems = new ModificationItem [ 1 ];
     
      Attribute userPasswordAttribute;
      if(LDAPLoginModule.isActiveDirectory()) {
        //active directory need the password enquoted and unicoded (but little-endian)
        String quotedPassword = "\"" + pwd + "\"";
        char unicodePwd[] = quotedPassword.toCharArray();
        byte pwdArray[] = new byte[unicodePwd.length * 2];
 
View Full Code Here


    // Set User Property's (Iterates over Attributes and gets OLAT Property out
    // of olatexconfig.xml)
    NamingEnumeration<Attribute> neAttr = (NamingEnumeration<Attribute>) userAttributes.getAll();
    try {
      while (neAttr.hasMore()) {
        Attribute attr = neAttr.next();
        String olatProperty = LDAPHelper.mapLdapAttributeToOlatProperty(attr.getID());
        if (attr.get() != uid) {
          String ldapValue = LDAPHelper.getAttributeValue(attr);
          if (olatProperty == null || ldapValue == null) continue;
          user.setProperty(olatProperty, ldapValue);
        }
      }
View Full Code Here

    Map<String, String> olatPropertyMap = new HashMap<String, String>();
    User user = identity.getUser();
    NamingEnumeration<Attribute> neAttrs = (NamingEnumeration<Attribute>) attributes.getAll();
    try {
      while (neAttrs.hasMore()) {
        Attribute attr = neAttrs.next();
        String olatProperty = LDAPHelper.mapLdapAttributeToOlatProperty(attr.getID());
        if(olatProperty == null) {
          continue;
        }
        String ldapValue = LDAPHelper.getAttributeValue(attr);
        String olatValue = user.getProperty(olatProperty, null);
View Full Code Here

        while (enm.hasMore()) {
          SearchResult result = enm.next();
          Attributes attrs = result.getAttributes();
          NamingEnumeration<? extends Attribute> aEnum = attrs.getAll();
          while (aEnum.hasMore()) {
            Attribute attr = aEnum.next();
            // use lowercase username
            ldapList.add(attr.get().toString().toLowerCase());
          }
          counter++;
        }
      } catch (SizeLimitExceededException e) {
        log
View Full Code Here

             for(int i = 0; i < attributes.size(); i++){
              
               String key = attributes.get(i);
               String val = "";
             
               Attribute but = attrs.get(key);
              
               if(but!= null){
                  Object obj = but.get();
                
                 if(obj != null)
                   val = String.valueOf(obj);
               }
               innerMap.put(key,val );
View Full Code Here

      results = authContext.search(searchBase, searchFilter,  searchCtls);
      while (results.hasMore()) {
        SearchResult searchResult = (SearchResult) results.next();
        String cn = searchResult.getName();
        Attributes attributes = searchResult.getAttributes();
        Attribute attrib = attributes.get("uid");
       
        if (attrib != null) {
          String uid = (String) attrib.get();
          uidCnDictionary.put(uid, cn);
        }
      }
    } catch (NamingException e) {
      log.error("Error occured on LDAP Search : " + e.getMessage());
View Full Code Here

            String dnSlice = extractSlice(userDN, nameParser, startIndex,
                endIndex);
            int dotIndex = attributeId.indexOf(".");
            if (dotIndex > -1) {
              Attributes nestedAttrs = ctx.getAttributes(dnSlice, null);
              Attribute attr = nestedAttrs.get(attributeId
                  .substring(dotIndex + 1));
              if (attr != null && attr.size() > 0) {
                if (attr.size() == 1) {
                  userPrincipal.putCustomProperty(option.getKey().substring(
                      CUSTOM_PROPERTY_OPT.length()), attr.get());
                } else {
                  List<Object> values = new ArrayList<Object>();
                  for (NamingEnumeration<?> avne = attr.getAll(); avne
                      .hasMore();) {
                    values.add(avne.next());
                  }
                  userPrincipal.putCustomProperty(option.getKey().substring(
                      CUSTOM_PROPERTY_OPT.length()), values);
                }
              }
            } else {
              userPrincipal.putCustomProperty(option.getKey().substring(
                  CUSTOM_PROPERTY_OPT.length()), dnSlice);
            }
          } else {
            Attribute attr = attrs.get(attributeId);
            if (attr != null && attr.size() > 0) {
              if (attr.size() == 1) {
                userPrincipal.putCustomProperty(option.getKey().substring(
                    CUSTOM_PROPERTY_OPT.length()), extractSlice((String) attr
                    .get(), nameParser, startIndex, endIndex));
              } else {
                List<Object> values = new ArrayList<Object>();
                for (NamingEnumeration<?> avne = attr.getAll(); avne.hasMore();) {
                  values.add(extractSlice((String) avne.next(), nameParser,
                      startIndex, endIndex));
                }
                userPrincipal.putCustomProperty(option.getKey().substring(
                    CUSTOM_PROPERTY_OPT.length()), values);
              }
            }
          }
        } else {
          if ("DN".equalsIgnoreCase(attributeId)) {
            userPrincipal.putCustomProperty(option.getKey().substring(
                CUSTOM_PROPERTY_OPT.length()), userDN);
          } else {
            Attribute attr = attrs.get(attributeId);
            if (attr != null && attr.size() > 0) {
              if (attr.size() == 1) {
                userPrincipal.putCustomProperty(option.getKey().substring(
                    CUSTOM_PROPERTY_OPT.length()), attr.get());
              } else {
                List<Object> values = new ArrayList<Object>();
                for (NamingEnumeration<?> avne = attr.getAll(); avne.hasMore();) {
                  values.add(avne.next());
                }
                userPrincipal.putCustomProperty(option.getKey().substring(
                    CUSTOM_PROPERTY_OPT.length()), values);
              }
View Full Code Here

        log.fine("ldap-authenticator: " + query + "->" + (attributes != null));

      if (attributes == null)
        return null;

      Attribute passwordAttr = attributes.get(_passwordAttribute);

      String ldapPassword = (String) passwordAttr.get();

      if (passwordAttr == null)
        return null;

      String []roles = null;
     
      if (_roleAttribute != null) {
        Attribute roleAttr = attributes.get(_roleAttribute);

        if (roleAttr != null) {
          String roleSet = (String) roleAttr.get();

          if (roleSet != null)
            roles = roleSet.split("[, ]+");
        }
      }
View Full Code Here

            while (answer.hasMore())
            {
                SearchResult sr = (SearchResult) answer.next();
                Attributes attribs = sr.getAttributes();
                Attribute attr = attribs.get("turbineGroupName");

                if (attr != null && attr.get() != null)
                {
                    Group group = getNewGroup(attr.get().toString());

                    groups.add(group);
                }
            }
        }
View Full Code Here

            while (answer.hasMore())
            {
                SearchResult sr = (SearchResult) answer.next();
                Attributes attribs = sr.getAttributes();
                Attribute attr = attribs.get("turbineRoleName");

                if (attr != null)
                {
                    NamingEnumeration values = attr.getAll();

                    while (values.hasMore())
                    {
                        Role role = getNewRole(values.next().toString());
View Full Code Here

TOP

Related Classes of javax.naming.directory.Attribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.