Package javax.naming.ldap

Examples of javax.naming.ldap.InitialLdapContext


        this.convertSubErrorCodesToExceptions = convertSubErrorCodesToExceptions;
    }

    static class ContextFactory {
        DirContext createContext(Hashtable<?,?> env) throws NamingException {
            return new InitialLdapContext(env, null);
        }
View Full Code Here


        if (ldapLoginPassword != null && ldapLoginPassword.length() > 0) {
            env.put(Context.SECURITY_CREDENTIALS, ldapLoginPassword);
        }
        env.put(Context.PROVIDER_URL, ldapUrl);
        try {
            ctx = new InitialLdapContext(env, null);
        } catch (NamingException e) {
            throw new NamingException("Instantiation of Ldap Context failed");
        }
        return ctx;
    }
View Full Code Here

      env.put(Context.PROVIDER_URL, ConfigMain.getParameter("ldap_url"));
      env.put("java.naming.ldap.version", "3");
      LdapContext ctx = null;
      StartTlsResponse tls = null;
      try {
        ctx = new InitialLdapContext(env, null);

        // Authentication must be performed over a secure channel
        tls = (StartTlsResponse) ctx.extendedOperation(new StartTlsRequest());
        tls.negotiate();
View Full Code Here

      env.put(Context.PROVIDER_URL, ConfigMain.getParameter("ldap_url"));
      env.put("java.naming.ldap.version", "3");
      LdapContext ctx = null;
      StartTlsResponse tls = null;
      try {
        ctx = new InitialLdapContext(env, null);

        // Authentication must be performed over a secure channel
        tls = (StartTlsResponse) ctx.extendedOperation(new StartTlsRequest());
        tls.negotiate();
View Full Code Here

    if(contextProperties != null) {
      env.putAll(contextProperties);
    }

    try {
      return new InitialLdapContext(env, null);

    } catch(AuthenticationException e) {
      throw new LdapAuthenticationException("Could not authenticate with LDAP server", e);

    } catch(NamingException e) {
View Full Code Here

        {
            public void run()
            {
                try
                {
                    context = new InitialLdapContext( environment, null );

                    if ( useStartTLS )
                    {
                        try
                        {
View Full Code Here

        if ( log.isInfoEnabled() )
        {
            log.info( "Getting initial context for realm base at " + dn + " for " + config.getPrimaryRealm() );
        }

        return new InitialLdapContext( cloned, new Control[]{} );
    }
View Full Code Here

    * {@inheritDoc}
    */
   public LdapContext getLdapContext(boolean renew) throws NamingException
   {
      // Force create new context. 
      return new InitialLdapContext(new Hashtable<String, String>(env), null);
   }
View Full Code Here

   public InitialContext getInitialContext() throws NamingException
   {
      Hashtable<String, String> props = new Hashtable<String, String>(env);
      props.put(Context.OBJECT_FACTORIES, "com.sun.jndi.ldap.obj.LdapGroupFactory");
      props.put(Context.STATE_FACTORIES, "com.sun.jndi.ldap.obj.LdapGroupFactory");
      return new InitialLdapContext(props, null);
   }
View Full Code Here

      props.put("com.sun.jndi.ldap.connect.pool", "false");

      InitialContext ctx = null;
      try
      {
         ctx = new InitialLdapContext(props, null);

         // anonymous user could be bind to AD but aren't able to pick up information
         return (ctx.lookup(userDN) != null);
      }
      catch (NamingException e)
View Full Code Here

TOP

Related Classes of javax.naming.ldap.InitialLdapContext

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.