Package org.apache.directory.server.core.authn

Examples of org.apache.directory.server.core.authn.LdapPrincipal


            ctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
           
            LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
            adminDn.normalize( directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
            CoreSession adminSession = new DefaultCoreSession(
                new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), directoryService );
            EntryFilteringCursor results = nexus.search( new SearchOperationContext(
                adminSession, baseDn, AliasDerefMode.DEREF_ALWAYS, filter, ctls ) );
           
            while ( results.next() )
            {
View Full Code Here


    }
   
   
    public CoreSession getSession()
    {
        return new DefaultCoreSession( new LdapPrincipal(), this );
    }
View Full Code Here

        schemaService = new SchemaService( this, schemaPartition, schemaControl );

        adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
        adminDn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
        adminSession = new DefaultCoreSession( new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), this );

        partitionNexus = new DefaultPartitionNexus( new DefaultServerEntry( registries, LdapDN.EMPTY_LDAPDN ) );
        partitionNexus.init( this );
        partitionNexus.addContextPartition( new AddContextPartitionOperationContext( adminSession, schemaPartition ) );
View Full Code Here


    private ServerEntry getTlsEntry() throws Exception
    {
        LdapDN adminDn = PartitionNexus.getAdminName();
        LdapPrincipal principal = new LdapPrincipal( adminDn, AuthenticationLevel.SIMPLE );
        CoreSession session = directoryService.getSession( principal );
        return session.lookup( adminDn );
    }
View Full Code Here

        Modification mod = new ClientModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute );
        mods.add( mod );
     
        LdapDN userDn = new LdapDN( "uid=akarasulu,ou=users,ou=system" );
        userDn.normalize( service.getRegistries().getAttributeTypeRegistry().getNormalizerMapping() );
        LdapPrincipal principal = new LdapPrincipal( userDn, AuthenticationLevel.SIMPLE );
        CoreSession akarasuluSession = service.getSession( principal );

        try
        {
            akarasuluSession.modify(
View Full Code Here

        forward.setChangeType( ChangeType.Add );
        forward.putAttribute( "objectClass", "organizationalUnit" );
        forward.putAttribute( "ou", "system" );

        LdifEntry reverse = LdifRevertor.reverseAdd( new LdapDN( forward.getDn() ) );
        assertEquals( 1, store.log( new LdapPrincipal(), forward, reverse ).getRevision() );
        assertEquals( 1, store.getCurrentRevision() );
    }
View Full Code Here

        LdifEntry reverse = LdifRevertor.reverseAdd( reverseDn );

        String zuluTime = DateUtils.getGeneralizedTime();
        long revision = 1L;
       
        LdapPrincipal principal = new LdapPrincipal( adminDn, AuthenticationLevel.SIMPLE, StringTools.getBytesUtf8( "secret"  ) );
        ChangeLogEvent event = new ChangeLogEvent( revision, zuluTime, principal, forward, reverse );
       
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream( baos );

        out.writeObject( event );
       
        byte[] data = baos.toByteArray();
        ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( data ) );
       
        ChangeLogEvent read = (ChangeLogEvent)in.readObject();
       
        // The read event should not be equal to the written event, as
        // the principal's password has not been stored
        assertNotSame( event, read );
       
        LdapPrincipal readPrincipal = read.getCommitterPrincipal();
       
        assertEquals( principal.getAuthenticationLevel(), readPrincipal.getAuthenticationLevel() );
        assertEquals( principal.getName(), readPrincipal.getName() );
        assertEquals( principal.getJndiName(), readPrincipal.getJndiName() );
        assertNull( readPrincipal.getUserPassword() );
       
        assertEquals( zuluTime, read.getZuluTime() );
        assertEquals( revision, read.getRevision() );
        assertEquals( forward, read.getForwardLdif() );
        assertEquals( reverse, read.getReverseLdifs().get( 0 ) );
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 );

        try
        {
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 );

        try
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" );
        bypass.add( "1" );
        opContext.setByPassed( bypass );
View Full Code Here

TOP

Related Classes of org.apache.directory.server.core.authn.LdapPrincipal

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.