Package org.apache.directory.server.core.jndi

Examples of org.apache.directory.server.core.jndi.ServerLdapContext


        {
            dn = "";
        }

        CoreSession session = service.getSession( principal );
        LdapContext ctx = new ServerLdapContext( service, session, new LdapName( dn ) );
        return ctx;
    }
View Full Code Here


        {
            dn = "";
        }

        CoreSession session = service.getSession( principal );
        LdapContext ctx = new ServerLdapContext( service, session, new LdapName( dn ) );
        return ctx;
    }
View Full Code Here

            DN userName = new DN( "uid=" + uid + ",ou=users,ou=system" );
            adminContext.createSubcontext( entryRdn, testEntry );

            // compare the telephone numbers
            DirContext userContext = getContextAs( userName, password );
            ServerLdapContext ctx = ( ServerLdapContext ) userContext.lookup( "" );
            ctx.compare( new DN( entryRdn + ",ou=system" ), "telephoneNumber", number );

            // don't return compare result which can be false but true since op was permitted
            return true;
        }
        catch ( LdapNoPermissionException e )
View Full Code Here

        objectClass.add( "inetOrgPerson" );
        user.put( "sn", "bob" );
        user.put( "cn", "bob" );
        adminCtx.createSubcontext( "uid=bob,ou=users", user );

        ServerLdapContext ctx = ( ServerLdapContext ) adminCtx.lookup( "" );
        assertTrue( ctx.compare( new DN( "uid=bob,ou=users,ou=system" ), "userPassword", "bobspassword" ) );
    }
View Full Code Here

        {
            dn = "";
        }

        CoreSession session = service.getSession( principal );
        LdapContext ctx = new ServerLdapContext( service, session, new DN( dn ) );
        return ctx;
    }
View Full Code Here

        try
        {
            GetRecords getRecords = new GetRecords( question );
            String baseDn = catalog.getBaseDn( question.getDomainName() );
            CoreSession session = directoryService.getSession();
            DirContext dirContext = new ServerLdapContext( directoryService, session, new DN( baseDn ) );
            return getRecords.execute( dirContext, null );
        }
        catch ( LdapNameNotFoundException lnnfe )
        {
            LOG.debug( "Name for DNS record search does not exist.", lnnfe );
View Full Code Here

    SingleBaseSearch( String searchBaseDn, DirectoryService directoryService )
    {
        try
        {
            CoreSession session = directoryService.getSession();
            ctx = new ServerLdapContext( directoryService, session, new DN( searchBaseDn ) );
        } catch ( Exception e )
        {
            throw new ServiceConfigurationException( I18n.err( I18n.ERR_649, searchBaseDn ), e );
        }
View Full Code Here

    public void testLdapClassLoaderWithClassLoadedAnywhere() throws Exception
    {
        LdapContext root = getRootContext( service );

        // get default naming context to work on
        ServerLdapContext defaultContext = ( ServerLdapContext ) root.lookup( "ou=system" );

        // set up
        Attributes attributes = new BasicAttributes( "objectClass", "top", true );
        attributes.get( "objectClass" ).add( "javaClass" );
        attributes.put( "fullyQualifiedJavaClassName", "HelloWorld" );
        attributes.put( "javaClassByteCode", HELLOWORLD_CLASS_BYTES );
        defaultContext.createSubcontext( "fullyQualifiedJavaClassName=HelloWorld", attributes );

        // assert set up successfull
        assertNotNull( defaultContext.lookup( "fullyQualifiedJavaClassName=HelloWorld" ) );

        // load the class
        LdapClassLoader loader = new LdapClassLoader( service );
        Class<?> clazz = loader.loadClass( "HelloWorld" );
View Full Code Here

    public void testLdapClassLoaderWithClassLoadedAtDefaultSearchSubtree() throws Exception
    {
        LdapContext root = getRootContext( service );

        // get default naming context to work on
        ServerLdapContext defaultContext = ( ServerLdapContext ) root.lookup( "ou=system" );

        // create an extensible object for holding custom config data
        Attributes classLoaderDefaultSearchContextConfig = new BasicAttributes( true );
        Attribute objectClass = new BasicAttribute( "objectClass" );
        objectClass.add( "top" );
        objectClass.add( "javaContainer" );
       
        // We need to ad this extensibleObject OC in order to avoid an error
        // with the classLoaderDefaultSearchContext AT used later (no OC contains
        // this AT)
        objectClass.add( "extensibleObject" );

        // create custom config entry
        classLoaderDefaultSearchContextConfig.put( objectClass );
        classLoaderDefaultSearchContextConfig.put( new BasicAttribute( "cn", "classLoaderDefaultSearchContext" ) );

        // add a default search context to the configuration
        classLoaderDefaultSearchContextConfig.put( new BasicAttribute( "classLoaderDefaultSearchContext", "ou=system" ) );

        // add the configuration entry to the DIT
        ServerLdapContext configContext = ( ServerLdapContext ) defaultContext.lookup( "ou=configuration" );
        configContext.createSubcontext( "cn=classLoaderDefaultSearchContext", classLoaderDefaultSearchContextConfig );

        // create a class holder entry and add it to the DIT
        Attributes attributes = new BasicAttributes( "objectClass", "top", true );
        attributes.get( "objectClass" ).add( "javaClass" );
        attributes.put( "fullyQualifiedJavaClassName", "HelloWorld" );
View Full Code Here

        {
            dn = "";
        }

        CoreSession session = service.getSession( principal );
        LdapContext ctx = new ServerLdapContext( service, session, new LdapName( dn ) );
        return ctx;
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.server.core.jndi.ServerLdapContext

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.