Package org.apache.directory.server.core

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


                LdapPrincipal ldapPrincipal = ( LdapPrincipal ) ldapSession
                    .getSaslProperty( SaslConstants.SASL_AUTHENT_USER );
                if ( ldapPrincipal != null )
                {
                    DirectoryService ds = ldapSession.getLdapServer().getDirectoryService();
                    String saslMechanism = bindRequest.getSaslMechanism();
                    CoreSession userSession = ds.getSession( ldapPrincipal.getClonedName(), ldapPrincipal
                        .getUserPassword(), saslMechanism, null );

                    // Set the user session into the ldap session
                    ldapSession.setCoreSession( userSession );
                }
View Full Code Here


     * @throws Exception If the authentication cannot be done
     */
    public void handleSaslAuth( LdapSession ldapSession, InternalBindRequest bindRequest ) throws Exception
    {
        String saslMechanism = bindRequest.getSaslMechanism();
        DirectoryService ds = getLdapServer().getDirectoryService();

        // Case #2 : the user does have a session. We have to unbind him
        if ( ldapSession.isAuthenticated() )
        {
            // We already have a bound session for this user. We have to
View Full Code Here

        if ( !schemaDirectory.exists() )
        {
            throw new LdapConfigurationException( I18n.err( I18n.ERR_697, schemaDirectory ) );
        }

        DirectoryService directoryService = new DefaultDirectoryService();
        //schemaPartition.init( directoryService );

        // --------------------------------------------------------------------
        // Initialize schema subsystem and reset registries
        // --------------------------------------------------------------------
View Full Code Here

    private static boolean isSubSchemaSubEntrySearch( LdapSession session, InternalSearchRequest req ) throws Exception
    {
        DN base = req.getBase();
        String baseNormForm = ( base.isNormalized() ? base.getNormName() : base.getNormName() );

        DirectoryService ds = session.getCoreSession().getDirectoryService();
        PartitionNexus nexus = ds.getPartitionNexus();
        Value<?> subschemaSubentry = nexus.getRootDSE( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
        DN subschemaSubentryDn = new DN( subschemaSubentry.getString() );
        subschemaSubentryDn.normalize( ds.getSchemaManager().getNormalizerMapping() );
        String subschemaSubentryDnNorm = subschemaSubentryDn.getNormName();
       
        return subschemaSubentryDnNorm.equals( baseNormForm );
    }
View Full Code Here

    public static class MyFactory implements DirectoryServiceFactory
    {
        public DirectoryService newInstance() throws NamingException
        {
            DirectoryService service = new DefaultDirectoryService();
            service.getChangeLog().setEnabled( true );

            JdbmPartition partition = new JdbmPartition();
            partition.setId( "apache" );
            partition.setSuffix( SUFFIX_DN );

            HashSet<Index<?, ServerEntry>> indexedAttributes = new HashSet<Index<?, ServerEntry>>();
            indexedAttributes.add( new JdbmIndex<String,ServerEntry>( "objectClass" ) );
            indexedAttributes.add( new JdbmIndex<String,ServerEntry>( "ou" ) );
            indexedAttributes.add( new JdbmIndex<String,ServerEntry>( "uid" ) );
            partition.setIndexedAttributes( indexedAttributes );

            Set<Partition> partitions = new HashSet<Partition>();
            partitions.add( partition );

            service.setPartitions( partitions );
            return service;
        }
View Full Code Here

   
    public static class MyFactory implements DirectoryServiceFactory
    {
        public DirectoryService newInstance()
        {
            DirectoryService service = new DefaultDirectoryService();
            service.getChangeLog().setEnabled( true );

            // -------------------------------------------------------------------
            // Alter the partition configuration to index gidNumber
            // -------------------------------------------------------------------

            JdbmPartition partition = new JdbmPartition();
            partition.setId( "system" );
            partition.setSuffix( "ou=system" );

            Set<Index<?, ServerEntry>> indices = new HashSet<Index<?, ServerEntry>>();
            indices.addAll( partition.getIndexedAttributes() );
            indices.add( new JdbmIndex<String,ServerEntry>( "gidNumber" ) );
            partition.setIndexedAttributes( indices );
            service.setSystemPartition( partition );

            return service;
        }
View Full Code Here


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


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


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


    public void testFrontAndBackDoubleBypass() throws Exception
    {
        LdapDN dn = new LdapDN( "ou=system" );
        DirectoryService ds = new MockDirectoryService();
        DefaultCoreSession session = new DefaultCoreSession(
            new LdapPrincipal( new LdapDN(), AuthenticationLevel.STRONG ), ds );
        LookupOperationContext opContext = new LookupOperationContext( session, dn );
        Set<String> bypass = new HashSet<String>();
        bypass.add( "0" );
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.