import javax.naming.directory.Attributes;
import javax.naming.ldap.LdapName;
-import junit.framework.TestCase;
-
+import org.argeo.naming.LdapAttrs;
import org.argeo.naming.LdifParser;
+import junit.framework.TestCase;
+
public class LdifParserTest extends TestCase implements BasicTestConstants {
public void testBasicLdif() throws Exception {
LdifParser ldifParser = new LdifParser();
Attributes rootAttributes = res.get(rootDn);
assertNotNull(rootAttributes);
assertEquals("Superuser",
- rootAttributes.get(LdifName.description.name()).get());
+ rootAttributes.get(LdapAttrs.description.name()).get());
byte[] rawPwEntry = (byte[]) rootAttributes.get(
- LdifName.userPassword.name()).get();
+ LdapAttrs.userPassword.name()).get();
assertEquals("{SHA}ieSV55Qc+eQOaYDRSha/AjzNTJE=",
new String(rawPwEntry));
byte[] hashedPassword = DigestUtils.sha1("demo".getBytes());
LdapName adminDn = new LdapName(ADMIN_GROUP_DN);
Attributes adminAttributes = res.get(adminDn);
assertNotNull(adminAttributes);
- Attribute memberAttribute = adminAttributes.get(LdifName.member.name());
+ Attribute memberAttribute = adminAttributes.get(LdapAttrs.member.name());
assertNotNull(memberAttribute);
NamingEnumeration<?> members = memberAttribute.getAll();
List<String> users = new ArrayList<String>();
import javax.transaction.TransactionManager;
+import org.argeo.naming.LdapAttrs;
import org.osgi.service.useradmin.Authorization;
import org.osgi.service.useradmin.Group;
import org.osgi.service.useradmin.Role;
// credentials
byte[] hashedPassword = ("{SHA}" + Base64.getEncoder().encodeToString(DigestUtils.sha1("demo".getBytes())))
.getBytes();
- assertTrue(rootUser.hasCredential(LdifName.userPassword.name(), hashedPassword));
- assertTrue(demoUser.hasCredential(LdifName.userPassword.name(), hashedPassword));
+ assertTrue(rootUser.hasCredential(LdapAttrs.userPassword.name(), hashedPassword));
+ assertTrue(demoUser.hasCredential(LdapAttrs.userPassword.name(), hashedPassword));
// search
Role[] search = userAdmin.getRoles(null);
+++ /dev/null
-package org.argeo.osgi.useradmin;
-
-import javax.naming.ldap.LdapName;
-
-import org.argeo.naming.LdapAttrs;
-import org.argeo.naming.LdapObjs;
-
-/**
- * Standard LDAP attributes and object classes leveraged in this implementation
- * of user admin. Named {@link LdifName} in order not to collide with
- * {@link LdapName}.
- *
- * @deprecated Use {@link LdapAttrs} and {@link LdapObjs} instead.
- */
-@Deprecated
-public enum LdifName {
- // Attributes
- dn, dc, cn, sn, uid, mail, displayName, objectClass, userPassword, givenName, description, member,
- // Object classes
- inetOrgPerson, organizationalPerson, person, groupOfNames, groupOfUniqueNames, top;
-
- public final static String PREFIX = "ldap:";
-
- /** For use as XML name. */
- public String property() {
- return PREFIX + name();
- }
-
- public static LdifName local(String property) {
- return LdifName.valueOf(property.substring(PREFIX.length()));
- }
-}