Package javax.naming.directory

Examples of javax.naming.directory.InitialDirContext


            return (context);

        try {

            // Ensure that we have a directory context available
            context = new InitialDirContext(getDirectoryContextEnvironment());

        } catch (Exception e) {

            connectionAttempt = 1;

            // log the first exception.
            containerLog.warn(sm.getString("jndiRealm.exception"), e);

            // Try connecting to the alternate url.
            context = new InitialDirContext(getDirectoryContextEnvironment());

        } finally {

            // reset it in case the connection times out.
            // the primary may come back.
View Full Code Here


        //Load the proper class for the Context Loader
        ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(classLoader);

        //Fire it up
        new InitialDirContext( env );
       
        //Set it back
        Thread.currentThread().setContextClassLoader(oldCL);
        log.debug("LDAP Directory service started.");
    }
View Full Code Here

        //Load the proper class for th Context Loader
        ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(classLoader);

        //Shut it down
        new InitialDirContext( env );

        //Set it back
        Thread.currentThread().setContextClassLoader(oldCL);

    }
View Full Code Here

    //
    String[] parts = hostIp.getHostAddress().split("\\.");
    String reverseIP = parts[3] + "." + parts[2] + "." + parts[1] + "."
      + parts[0] + ".in-addr.arpa";

    DirContext ictx = new InitialDirContext();
    Attributes attribute =
      ictx.getAttributes("dns://"               // Use "dns:///" if the default
                         + ((ns == null) ? "" : ns) +
                         // nameserver is to be used
                         "/" + reverseIP, new String[] { "PTR" });
    ictx.close();
   
    return attribute.get("PTR").get().toString();
  }
View Full Code Here

        env.put(Context.SECURITY_CREDENTIALS, password);

        DirContext ctx = null;
        try
        {
            ctx = new InitialDirContext(env);

            //Authentication succeeded
            return new AuthenticationResult(new UsernamePrincipal(name));
        }
        catch(AuthenticationException ae)
View Full Code Here

        env.put(Context.PROVIDER_URL, _providerSearchURL);
        env.put(Context.SECURITY_AUTHENTICATION, "none");

        try
        {
            new InitialDirContext(env).close();
        }
        catch (NamingException e)
        {
            throw new RuntimeException("Unable to establish anonymous connection to the ldap server at " + _providerSearchURL, e);
        }
View Full Code Here

        env.put(Context.PROVIDER_URL, _providerSearchURL);

        env.put(Context.SECURITY_AUTHENTICATION, "none");
        DirContext ctx = null;

        ctx = new InitialDirContext(env);

        try
        {
            SearchControls searchControls = new SearchControls();
            searchControls.setReturningAttributes(new String[] {});
View Full Code Here

        env.put( "java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory" );
        env.put( "java.naming.provider.url", "ldap://localhost:" + port + "/ou=system" );
        env.put( "java.naming.security.principal", "uid=admin,ou=system" );
        env.put( "java.naming.security.credentials", "secret" );
        env.put( "java.naming.security.authentication", "simple" );
        ctx = new InitialDirContext( env );
    }
View Full Code Here

                env.put(Context.SECURITY_CREDENTIALS, connectionPassword);
            }
            env.put(Context.SECURITY_PROTOCOL, connectionProtocol == null ? "" : connectionProtocol);
            env.put(Context.PROVIDER_URL, connectionURL == null ? "" : connectionURL);
            env.put(Context.SECURITY_AUTHENTICATION, authentication == null ? "" : authentication);
            context = new InitialDirContext(env);

        } catch (NamingException e) {
            log.error(e);
            throw e;
        }
View Full Code Here

                env.put(Context.SECURITY_CREDENTIALS, connectionPassword);
            }
            env.put(Context.SECURITY_PROTOCOL, connectionProtocol == null ? "" : connectionProtocol);
            env.put(Context.PROVIDER_URL, connectionURL == null ? "" : connectionURL);
            env.put(Context.SECURITY_AUTHENTICATION, authentication == null ? "" : authentication);
            context = new InitialDirContext(env);

        } catch (NamingException e) {
            log.error(e);
            throw e;
        }
View Full Code Here

TOP

Related Classes of javax.naming.directory.InitialDirContext

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.