Package javax.naming.directory

Examples of javax.naming.directory.InitialDirContext


        env.put(Context.SECURITY_AUTHENTICATION, "simple");

        env.put(Context.SECURITY_PRINCIPAL, username);
        env.put(Context.SECURITY_CREDENTIALS, password);
        DirContext ctx = new InitialDirContext(env);
        ctx.close();
        final Subject subject = new Subject();
        subject.getPrincipals().add(new UsernamePrincipal(username));
        return new AuthenticationResult(subject);
    }
View Full Code Here


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

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


        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( Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory" );
        // env.put( Context.INITIAL_CONTEXT_FACTORY,
        // DEFAULT_INITIAL_CONTEXT_FACTORY );
        env.put( Context.PROVIDER_URL, "ldap://localhost:389/dc=tcat,dc=test" );

        return new InitialDirContext( env );
    }
View Full Code Here

        env.put( DirContext.SECURITY_AUTHENTICATION, "simple" );
        env.put( DirContext.SECURITY_PRINCIPAL, "uid=admin, ou=system" );
        env.put( DirContext.SECURITY_CREDENTIALS, "secret" );
        env.put( DirContext.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory" );
        env.put( DirectoryService.JNDI_KEY, service );
        return new InitialDirContext( env );
    }
View Full Code Here

        env.put( DirContext.SECURITY_AUTHENTICATION, "simple" );
        env.put( DirContext.SECURITY_PRINCIPAL, user.toString() );
        env.put( DirContext.SECURITY_CREDENTIALS, password );
        env.put( DirContext.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory" );
        env.put( DirectoryService.JNDI_KEY, service );
        return new InitialDirContext( env );
    }
View Full Code Here

        DirContext ctx = null;
       
        // Create the initial context
        try
        {
            ctx = new InitialDirContext(env);
        }
        catch ( NamingException ne )
        {
            fail();
        }
View Full Code Here

        env.put(Context.SECURITY_CREDENTIALS, "badsecret");

        // Create the initial context
        try
        {
            new InitialDirContext(env);

            // We should not be connected
            fail();
        }
        catch ( LdapAuthenticationException lae )
View Full Code Here

        env.put(Context.SECURITY_CREDENTIALS, "secret");

        // Create the initial context
        try
        {
            new InitialDirContext(env);

            // We should not be connected
            fail();
        }
        catch ( InvalidNameException ine )
View Full Code Here

        env.put(Context.SECURITY_CREDENTIALS, "secret");

        // Create the initial context
        try
        {
            new InitialDirContext(env);

            // We should not be connected
            fail();
        }
        catch ( LdapAuthenticationException lae )
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.