Hi Jiajia,

I noticed build failure for Kerby on Jenkins and looked into it. Then I
saw that you use JNDI in the new LDAPUtils class, see below. Any reason
not to use the LDAP API? It is alrady used in the ldap-backend module.

Kind Regards,
Stefan

On 07/12/2018 04:15 AM, [email protected] wrote:
> 
> DIRKRB-677 Add LDAP plugin for new authentication mechanism. Contributed by 
> Songjun.
> 
> Commit: 5747dd130fa31a09291c95385d8e8b046f665817
>
> +++ 
> b/has-project/has-plugins/src/main/java/org/apache/kerby/has/plugins/server/ldap/LDAPUtils.java
> +    public static boolean doUserAuth(String user, String pwd) throws 
> NamingException {
> +        Map env = new HashMap<>();
> +        env.put(Context.INITIAL_CONTEXT_FACTORY, 
> "com.sun.jndi.ldap.LdapCtxFactory");
> +        env.put(Context.PROVIDER_URL, ldapServerConf.getLdapUrl());
> +        env.put(Context.SECURITY_AUTHENTICATION, "simple");
> +        env.put(Context.SECURITY_PRINCIPAL, ldapServerConf.getBindDN());
> +        env.put(Context.SECURITY_CREDENTIALS, ldapServerConf.getBindPwd());
> +        DirContext ctx = null;
> +
> +        boolean ret = false;
> +        try {
> +            ctx = new InitialDirContext(new Hashtable<>(env));

Reply via email to