Multiple user referentials working with IPA.
[lgpl/argeo-commons.git] / org.argeo.util / src / org / argeo / util / naming / LdapAttrs.java
index 7dcba0992b85f15e37e4f2be0a054b0f6455ece9..1a6642f05ace073efe66571448ceb252a68ed94a 100644 (file)
@@ -1,5 +1,11 @@
 package org.argeo.util.naming;
 
+import java.util.function.Supplier;
+
+import javax.xml.namespace.QName;
+
+import org.argeo.util.internal.DisplayQName;
+
 /**
  * Standard LDAP attributes as per:<br>
  * - <a href= "https://www.ldap.com/ldap-oid-reference">Standard LDAP</a><br>
@@ -7,7 +13,7 @@ package org.argeo.util.naming;
  * "https://github.com/krb5/krb5/blob/master/src/plugins/kdb/ldap/libkdb_ldap/kerberos.schema">Kerberos
  * LDAP (partial)</a>
  */
-public enum LdapAttrs implements SpecifiedName {
+public enum LdapAttrs implements SpecifiedName, Supplier<String> {
        /** */
        uid("0.9.2342.19200300.100.1.1", "RFC 4519"),
        /** */
@@ -283,6 +289,19 @@ public enum LdapAttrs implements SpecifiedName {
        countryOfCitizenship("1.3.6.1.5.5.7.9.4", "RFC 2985"),
        /** */
        countryOfResidence("1.3.6.1.5.5.7.9.5", "RFC 2985"),
+
+       // RFC 2307bis (partial)
+       /** */
+       uidNumber("1.3.6.1.1.1.1.0", "RFC 2307bis"),
+       /** */
+       gidNumber("1.3.6.1.1.1.1.1", "RFC 2307bis"),
+       /** */
+       homeDirectory("1.3.6.1.1.1.1.3", "RFC 2307bis"),
+       /** */
+       loginShell("1.3.6.1.1.1.1.4", "RFC 2307bis"),
+       /** */
+       memberUid("1.3.6.1.1.1.1.12", "RFC 2307bis"),
+
        //
        ;
 
@@ -291,10 +310,16 @@ public enum LdapAttrs implements SpecifiedName {
 //     private final static String LDAP_ = "ldap:";
 
        private final String oid, spec;
+       private final QName value;
 
        LdapAttrs(String oid, String spec) {
                this.oid = oid;
                this.spec = spec;
+               this.value = new DisplayQName(LdapObjs.LDAP_NAMESPACE_URI, name(), LdapObjs.LDAP_DEFAULT_PREFIX);
+       }
+
+       public QName qName() {
+               return value;
        }
 
        @Override
@@ -307,29 +332,19 @@ public enum LdapAttrs implements SpecifiedName {
                return spec;
        }
 
-       public String getPrefix() {
-               return prefix();
-       }
-
-       public static String prefix() {
-               return "ldap";
-       }
-
+       @Deprecated
        public String property() {
-               return qualified();
+               return get();
        }
 
+       @Deprecated
        public String qualified() {
-               String prefix = getPrefix();
-               return prefix != null ? prefix + ":" + name() : name();
-       }
-
-       public String getNamespace() {
-               return namespace();
+               return get();
        }
 
-       public static String namespace() {
-               return "http://www.argeo.org/ns/ldap";
+       @Override
+       public String get() {
+               return LdapObjs.LDAP_DEFAULT_PREFIX + ":" + name();
        }
 
        @Override