Package org.apache.directory.shared.ldap.entry

Examples of org.apache.directory.shared.ldap.entry.ServerEntry


            schemaManager.lookupAttributeTypeRegistry( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ), principal.getName() );
        mods.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, principalAttribute ) );
       
        //FIXME check if keyderivation is necessary
       
        ServerEntry entry = StoreUtils.findPrincipalEntry( session, searchBaseDn, principal.getName() );
        session.modify( entry.getDn(), mods );

        return entry.getDn().toString();
    }
View Full Code Here


        assertNotNull( evaluator.getNormalizer() );
        assertNotNull( evaluator.getLdapComparator() );

        DN dn = new DN( "cn=jane doe,o=good times co." );
        dn.normalize( schemaManager.getNormalizerMapping() );
        ServerEntry attrs = new DefaultServerEntry( schemaManager, dn );
        attrs.add( "objectClass", "person" );
        attrs.add( "c-street", "1" );
        attrs.add( "cn", "jane doe" );
        attrs.add( "sn", "doe" );
        attrs.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
        attrs.add( "entryUUID", UUID.randomUUID().toString() );
        store.add( attrs );

        indexEntry.setId( 12L );
        assertTrue( evaluator.evaluate( indexEntry ) );
    }
View Full Code Here

     * @throws Exception if there are problems accessing registries
     */
    public static ServerEntry toServerEntry( CoreSession session, DN dn, PrincipalStoreEntry principalEntry )
        throws Exception
    {
        ServerEntry outAttrs = session.getDirectoryService().newEntry( dn );
       
        // process the objectClass attribute
        outAttrs.add( SchemaConstants.OBJECT_CLASS_AT,
            SchemaConstants.TOP_OC, SchemaConstants.UID_OBJECT_AT,
            "uidObject", SchemaConstants.EXTENSIBLE_OBJECT_OC,
            SchemaConstants.PERSON_OC, SchemaConstants.ORGANIZATIONAL_PERSON_OC,
            SchemaConstants.INET_ORG_PERSON_OC, SchemaConstants.KRB5_PRINCIPAL_OC,
            "krb5KDCEntry" );

        outAttrs.add( SchemaConstants.UID_AT, principalEntry.getUserId() );
        outAttrs.add( KerberosAttribute.APACHE_SAM_TYPE_AT, "7" );
        outAttrs.add( SchemaConstants.SN_AT, principalEntry.getUserId() );
        outAttrs.add( SchemaConstants.CN_AT, principalEntry.getCommonName() );
       
        EncryptionKey encryptionKey = principalEntry.getKeyMap().get( EncryptionType.DES_CBC_MD5 );
        outAttrs.add( KerberosAttribute.KRB5_KEY_AT, EncryptionKeyEncoder.encode( encryptionKey ) );

        int keyVersion = encryptionKey.getKeyVersion();

        outAttrs.add( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, principalEntry.getPrincipal().getName() );
        outAttrs.add( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT, Integer.toString( keyVersion ) );

        return outAttrs;
    }
View Full Code Here

                getFilter( schemaManager, principal ), AliasDerefMode.DEREF_ALWAYS, null );
   
            cursor.beforeFirst();
            if ( cursor.next() )
            {
                ServerEntry entry = cursor.get();
                LOG.debug( "Found entry {} for kerberos principal name {}", entry, principal );
               
                while ( cursor.next() )
                {
                    LOG.error( I18n.err( I18n.ERR_149, principal, cursor.next() ) );
View Full Code Here

        // Test AddContextPartition
        service.addPartition( partition );

        DN suffixDn = new DN( "ou=removable" );
        suffixDn.normalize( service.getSchemaManager().getNormalizerMapping() );
        ServerEntry ctxEntry = new DefaultServerEntry( service.getSchemaManager(), suffixDn );
        ctxEntry.put( "objectClass", "top" );
        ctxEntry.get( "objectClass" ).add( "organizationalUnit" );
        ctxEntry.put( "ou", "removable" );
        ctxEntry.put( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
        ctxEntry.put( "entryUUID", UUID.randomUUID().toString() );
        partition.add( new AddOperationContext( service.getAdminSession(), ctxEntry ) );

        Hashtable<String, Object> env = new Hashtable<String, Object>();
        env.put( Context.INITIAL_CONTEXT_FACTORY, CoreContextFactory.class.getName() );
        env.put( DirectoryService.JNDI_KEY, service );
View Full Code Here

        assertNotNull( evaluator.getNormalizer() );
        assertNotNull( evaluator.getComparator() );

        DN dn = new DN( "cn=jane doe,o=good times co." );
        dn.normalize( schemaManager.getNormalizerMapping() );
        ServerEntry attrs = new DefaultServerEntry( schemaManager, dn );
        attrs.add( "objectClass", "person" );
        attrs.add( "c-street", "3" );
        attrs.add( "cn", "jane doe" );
        attrs.add( "sn", "doe" );
        attrs.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
        attrs.add( "entryUUID", UUID.randomUUID().toString() );
        store.add( attrs );

        indexEntry.setId( 12L );
        assertTrue( evaluator.evaluate( indexEntry ) );
    }
View Full Code Here

    public static void backupDeleted( CoreSession session, ClonedServerEntry deletedEntry ) throws Exception
    {
        LOG.info( "User \"" + session.getEffectivePrincipal() + "\" has deleted entry \"" + deletedEntry + "\"" );
        DN backupDn = new DN ( "ou=backupContext,ou=system" );
        String deletedEntryRdn = deletedEntry.getDn().get( deletedEntry.getDn().size() - 1 );
        ServerEntry entry = ( ServerEntry ) deletedEntry.getOriginalEntry().clone();
        backupDn.add( deletedEntryRdn );
        entry.setDn( backupDn );
        session.add( deletedEntry );
        LOG.info( "Backed up deleted entry to \"" + backupDn + "\"" );
    }
View Full Code Here

    {
        DN dn = new DN( SchemaConstants.CN_AT_OID + "=jd," + SchemaConstants.OU_AT_OID + "=board of directors,"
            + SchemaConstants.O_AT_OID + "=good times co." );
        dn.normalize( schemaManager.getNormalizerMapping() );

        ServerEntry attrs = new DefaultServerEntry( schemaManager, dn );
        attrs.add( "objectClass", "alias", "extensibleObject" );
        attrs.add( "cn", "jd" );
        attrs.add( "aliasedObjectName", "cn=Jack Daniels,ou=Engineering,o=Good Times Co." );
        attrs.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
        attrs.add( "entryUUID", UUID.randomUUID().toString() );
        store.add( attrs );

        dn = new DN( SchemaConstants.CN_AT_OID + "=jdoe," + SchemaConstants.OU_AT_OID + "=board of directors,"
            + SchemaConstants.O_AT_OID + "=good times co." );
        dn.normalize( schemaManager.getNormalizerMapping() );

        attrs = new DefaultServerEntry( schemaManager, dn );
        attrs.add( "objectClass", "person" );
        attrs.add( "cn", "jdoe" );
        attrs.add( "sn", "doe" );
        attrs.add( "entryCSN", new CsnFactory( 1 ).newInstance().toString() );
        attrs.add( "entryUUID", UUID.randomUUID().toString() );
        store.add( attrs );

        ScopeNode node = new ScopeNode( AliasDerefMode.DEREF_IN_SEARCHING, SchemaConstants.OU_AT_OID
            + "=board of directors," + SchemaConstants.O_AT_OID + "=good times co.", SearchScope.SUBTREE );
        SubtreeScopeEvaluator<ServerEntry, Long> evaluator = new SubtreeScopeEvaluator<ServerEntry, Long>( store, node );
View Full Code Here

           
            EntryFilteringCursor subentries = nexus.search( searchOperationContext );

            while ( subentries.next() )
            {
                ServerEntry subentry = subentries.get();
                DN dnName = subentry.getDn();

                String subtree = subentry.get( SchemaConstants.SUBTREE_SPECIFICATION_AT ).getString();
                SubtreeSpecification ss;

                try
                {
                    ss = ssParser.parse( subtree );
View Full Code Here

     * @return the set of subentry op attrs for an entry
     * @throws Exception if there are problems accessing entry information
     */
    public ServerEntry getSubentryAttributes( DN dn, ServerEntry entryAttrs ) throws Exception
    {
        ServerEntry subentryAttrs = new DefaultServerEntry( schemaManager, dn );
        Iterator<String> list = subentryCache.nameIterator();

        while ( list.hasNext() )
        {
            String subentryDnStr = list.next();
            DN subentryDn = new DN( subentryDnStr );
            DN apDn = ( DN ) subentryDn.clone();
            apDn.remove( apDn.size() - 1 );
            Subentry subentry = subentryCache.getSubentry( subentryDnStr );
            SubtreeSpecification ss = subentry.getSubtreeSpecification();

            if ( evaluator.evaluate( ss, apDn, dn, entryAttrs ) )
            {
                EntryAttribute operational;

                if ( subentry.isAccessControlSubentry() )
                {
                    operational = subentryAttrs.get( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT );

                    if ( operational == null )
                    {
                        operational = new DefaultServerAttribute( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT,
                            schemaManager.lookupAttributeTypeRegistry( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ) );
                        subentryAttrs.put( operational );
                    }

                    operational.add( subentryDn.getNormName() );
                }
                if ( subentry.isSchemaSubentry() )
                {
                    operational = subentryAttrs.get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT );

                    if ( operational == null )
                    {
                        operational = new DefaultServerAttribute( SchemaConstants.SUBSCHEMA_SUBENTRY_AT, schemaManager
                            .lookupAttributeTypeRegistry( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) );
                        subentryAttrs.put( operational );
                    }

                    operational.add( subentryDn.getNormName() );
                }
                if ( subentry.isCollectiveSubentry() )
                {
                    operational = subentryAttrs.get( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT );

                    if ( operational == null )
                    {
                        operational = new DefaultServerAttribute( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT,
                            schemaManager.lookupAttributeTypeRegistry( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ) );
                        subentryAttrs.put( operational );
                    }

                    operational.add( subentryDn.getNormName() );
                }
                if ( subentry.isTriggerSubentry() )
                {
                    operational = subentryAttrs.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );

                    if ( operational == null )
                    {
                        operational = new DefaultServerAttribute( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT,
                            schemaManager.lookupAttributeTypeRegistry( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
                        subentryAttrs.put( operational );
                    }

                    operational.add( subentryDn.getNormName() );
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.entry.ServerEntry

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.