Package org.apache.directory.server.core

Examples of org.apache.directory.server.core.DirectoryService



    public void handleExtendedOperation( LdapSession requestor, InternalExtendedRequest req )
        throws Exception
    {
        DirectoryService service = requestor.getCoreSession().getDirectoryService();
       
        if ( ! requestor.getCoreSession().isAnAdministrator() )
        {
            requestor.getIoSession().write( new LaunchDiagnosticUiResponse( req.getMessageId(),
                ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS ) );
            return;
        }

        requestor.getIoSession().write( new LaunchDiagnosticUiResponse( req.getMessageId() ) );

        PartitionNexus nexus = service.getPartitionNexus();
        DN adminDn = new DN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
        adminDn.normalize( service.getSchemaManager().getNormalizerMapping() );
        LdapPrincipal principal = new LdapPrincipal( adminDn, AuthenticationLevel.STRONG );
        CoreSession session = service.getSession( principal );
        Set<String> suffixes = nexus.listSuffixes( new ListSuffixOperationContext( session ) );
        int launchedWindowCount = 0;
           
        for ( String suffix:suffixes )
        {
            DN dn = new DN( suffix );
            Partition partition = nexus.getPartition( dn );
           
            if ( partition instanceof BTreePartition )
            {
                try
                {
                    BTreePartition btPartition = ( BTreePartition ) partition;
                    // TODO : If a partition does not have an initial entry associated, we wil:
                    // get a NPE : this has to be fixed.
                    PartitionFrame frame = new PartitionFrame( btPartition, service.getSchemaManager() );
                    Point pos = getCenteredPosition( frame );
                    pos.y = launchedWindowCount * 20 + pos.y;
                    double multiplier = getAspectRatio() * 20.0;
                    pos.x = ( int ) ( launchedWindowCount * multiplier ) + pos.x;
                    frame.setLocation( pos );
View Full Code Here


public class CreateKdcServerAnnotationTest
{
    @Test
    public void testCreateKdcServer() throws Exception
    {
        DirectoryService directoryService = DSAnnotationProcessor.getDirectoryService();
       
        assertEquals( "CreateKdcServerAnnotationTest-class", directoryService.getInstanceId() );
       
        KdcServer server = ServerAnnotationProcessor.getKdcServer( directoryService, 1024 );

        assertEquals( 2, server.getTransports().length );
       
View Full Code Here

    @Test
    public void testNoBypass() throws Exception
    {
        DN dn = new DN( "ou=system" );
        DirectoryService ds = new MockDirectoryService();
        DefaultCoreSession session = new DefaultCoreSession(
            new LdapPrincipal( new DN(), AuthenticationLevel.STRONG ), ds );
        LookupOperationContext opContext = new LookupOperationContext( session, dn );
        InvocationStack.getInstance().push( opContext );
View Full Code Here

    @Test
    public void testSingleBypass() throws Exception
    {
        DN dn = new DN( "ou=system" );
        DirectoryService ds = new MockDirectoryService();
        DefaultCoreSession session = new DefaultCoreSession(
            new LdapPrincipal( new DN(), AuthenticationLevel.STRONG ), ds );
        LookupOperationContext opContext = new LookupOperationContext( session, dn );
        opContext.setByPassed( Collections.singleton( "0" ) );
        InvocationStack.getInstance().push( opContext );
View Full Code Here

    @Test
    public void testAdjacentDoubleBypass() throws Exception
    {
        DN dn = new DN( "ou=system" );
        DirectoryService ds = new MockDirectoryService();
        DefaultCoreSession session = new DefaultCoreSession(
            new LdapPrincipal( new DN(), AuthenticationLevel.STRONG ), ds );
        LookupOperationContext opContext = new LookupOperationContext( session, dn );
        Set<String> bypass = new HashSet<String>();
        bypass.add( "0" );
View Full Code Here

    @Test
    public void testFrontAndBackDoubleBypass() throws Exception
    {
        DN dn = new DN( "ou=system" );
        DirectoryService ds = new MockDirectoryService();
        DefaultCoreSession session = new DefaultCoreSession(
            new LdapPrincipal( new DN(), AuthenticationLevel.STRONG ), ds );
        LookupOperationContext opContext = new LookupOperationContext( session, dn );
        Set<String> bypass = new HashSet<String>();
        bypass.add( "0" );
View Full Code Here

    @Test
    public void testDoubleBypass() throws Exception
    {
        DN dn = new DN( "ou=system" );
        DirectoryService ds = new MockDirectoryService();
        DefaultCoreSession session = new DefaultCoreSession(
            new LdapPrincipal( new DN(), AuthenticationLevel.STRONG ), ds );
        LookupOperationContext opContext = new LookupOperationContext( session, dn );
        Set<String> bypass = new HashSet<String>();
        bypass.add( "1" );
View Full Code Here

    @Test
    public void testCompleteBypass() throws Exception
    {
        DN dn = new DN( "ou=system" );
        DirectoryService ds = new MockDirectoryService();
        DefaultCoreSession session = new DefaultCoreSession(
            new LdapPrincipal( new DN(), AuthenticationLevel.STRONG ), ds );
        LookupOperationContext opContext = new LookupOperationContext( session, dn );
        opContext.setByPassed( ByPassConstants.BYPASS_ALL_COLLECTION );
        InvocationStack.getInstance().push( opContext );
View Full Code Here

            apacheDS = ( ApacheDS ) factory.getBean( "apacheDS" ); //$NON-NLS-1$
        }
        else
        {
            LOG.info( "server: using default settings ..." ); //$NON-NLS-1$
            DirectoryService directoryService = new DefaultDirectoryService();
            directoryService.startup();
            ldapServer = new LdapServer();
            ldapServer.setDirectoryService( directoryService );
            TcpTransport tcpTransportSsl = new TcpTransport( 10636 );
            tcpTransportSsl.enableSSL( true );
            ldapServer.setTransports( new TcpTransport( 10389 ), tcpTransportSsl );
View Full Code Here

     * {@inheritDoc}
     */
    public Entry lookup( NextInterceptor next, LookupOperationContext lookupContext ) throws LdapException
    {
        CoreSession session = lookupContext.getSession();
        DirectoryService directoryService = session.getDirectoryService();

        LdapPrincipal principal = session.getEffectivePrincipal();
        Dn principalDn = principal.getDn();

        if ( !principalDn.isSchemaAware() )
        {
            principalDn.apply( schemaManager );
        }

        // Bypass this interceptor if we disabled the AC subsystem or if the principal is the admin
        if ( isPrincipalAnAdministrator( principalDn ) || !directoryService.isAccessControlEnabled() )
        {
            return next.lookup( lookupContext );
        }

        lookupContext.setByPassed( ByPassConstants.LOOKUP_BYPASS );
        Entry entry = directoryService.getOperationManager().lookup( lookupContext );

        checkLookupAccess( lookupContext, entry );

        return next.lookup( lookupContext );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.server.core.DirectoryService

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.