Package org.apache.directory.server.core.entry

Examples of org.apache.directory.server.core.entry.ServerAttribute


    {
        LdapDN dn = new LdapDN( "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );
        dn.normalize( attributeRegistry.getNormalizerMapping() );

        List<Modification> mods = new ArrayList<Modification>();
        ServerAttribute attrib = new DefaultServerAttribute( SchemaConstants.SURNAME_AT,
            attributeRegistry.lookup( SchemaConstants.SURNAME_AT ) );
       
        String attribVal = "Walker";
        attrib.add( attribVal );
       
        Modification add = new ServerModification( ModificationOperation.ADD_ATTRIBUTE, attrib );
        mods.add( add );
       
        ServerEntry lookedup = store.lookup( store.getEntryId( dn.toNormName() ) );
View Full Code Here


    {
        LdapDN dn = new LdapDN( "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );
        dn.normalize( attributeRegistry.getNormalizerMapping() );

        List<Modification> mods = new ArrayList<Modification>();
        ServerAttribute attrib = new DefaultServerAttribute( SchemaConstants.SN_AT,
            attributeRegistry.lookup( SchemaConstants.SN_AT_OID ) );
       
        String attribVal = "Johnny";
        attrib.add( attribVal );
       
        Modification add = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attrib );
        mods.add( add );
       
        ServerEntry lookedup = store.lookup( store.getEntryId( dn.toNormName() ) );
View Full Code Here

        // remove all the objectClass attribute values from a cloned copy and then
        // we can analyze what remains in this attribute to make sure a structural
        // objectClass is present for the entry

        ServerAttribute cloned = ( ServerAttribute ) entryObjectClasses.clone();
       
        for ( Value<?> value:attribute )
        {
            cloned.remove( value );
        }

        // check resultant set of objectClass values for a structural objectClass
        for ( Value<?> objectClass:cloned )
        {
View Full Code Here

                        operation = "Replacing";
                        break;
                }
            }

            ServerAttribute attr = (ServerAttribute)mod.getAttribute();

            if ( attr.instanceOf( SchemaConstants.USER_PASSWORD_AT ) )
            {
                Value<?> userPassword = attr.get();
                String pwd = "";

                if ( userPassword != null )
                {
                    if ( userPassword instanceof ServerStringValue )
View Full Code Here

    {
        LdapDN dn = new LdapDN( "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );
        dn.normalize( attributeRegistry.getNormalizerMapping() );

        List<Modification> mods = new ArrayList<Modification>();
        ServerAttribute attrib = new DefaultServerAttribute( SchemaConstants.SN_AT,
            attributeRegistry.lookup( SchemaConstants.SN_AT_OID ) );
       
        Modification add = new ServerModification( ModificationOperation.REMOVE_ATTRIBUTE, attrib );
        mods.add( add );
       
View Full Code Here

        entry.add( "entryUUID", SchemaUtils.uuidToBytes( UUID.randomUUID() ) );
       
        store.add( entry );
       
        List<Modification> mods = new ArrayList<Modification>();
        ServerAttribute attrib = new DefaultServerAttribute( SchemaConstants.OU_AT,
            attributeRegistry.lookup( SchemaConstants.OU_AT_OID ) );
       
        String attribVal = "Marketing";
        attrib.add( attribVal );
       
        Modification add = new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attrib );
        mods.add( add );
       
        ServerEntry lookedup = store.lookup( store.getEntryId( dn.toNormName() ) );
View Full Code Here

    {
        for ( Modification mod : opContext.getModItems() )
        {
            String opAttrOid = registries.getOidRegistry().getOid( mod.getAttribute().getId() );
           
            ServerAttribute serverAttribute = (ServerAttribute)mod.getAttribute();

            switch ( mod.getOperation() )
            {
                case ADD_ATTRIBUTE :
View Full Code Here

                        operation = "Replacing";
                        break;
                }
            }

            ServerAttribute attr = (ServerAttribute)mod.getAttribute();

            if ( attr.instanceOf( SchemaConstants.USER_PASSWORD_AT ) )
            {
                Object firstValue = attr.get();
                String password = null;

                if ( firstValue instanceof ServerStringValue )
                {
                    password = ((ServerStringValue)firstValue).getString();
                    log.debug( "{} Attribute id : 'userPassword',  Values : [ '{}' ]", operation, password );
                }
                else if ( firstValue instanceof ServerBinaryValue )
                {
                    password = ((ServerBinaryValue)firstValue).getString();

                    if ( log.isDebugEnabled() )
                    {
                        StringBuffer sb = new StringBuffer();
                        sb.append( "'" + password + "' ( " );
                        sb.append( StringTools.dumpBytes( ((ServerBinaryValue)firstValue).getBytes() ).trim() );
                        sb.append( " )" );
                        log.debug( "{} Attribute id : 'userPassword',  Values : [ {} ]", operation, sb.toString() );
                    }
                }

                subContext.setUserPassword( password );
                log.debug( "Got userPassword '{}'.", subContext.getUserPassword() );
            }

            if ( attr.instanceOf( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ) )
            {
                subContext.setPrincipalName( attr.getString() );
                log.debug( "Got principal '{}'.", subContext.getPrincipalName() );
            }
        }
    }
View Full Code Here

                new DefaultServerAttribute(
                    KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT,
                    atRegistry.lookup( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ),
                    Integer.toString( kvno ) ) ) );
       
        ServerAttribute attribute = getKeyAttribute( modContext.getSession()
            .getDirectoryService().getRegistries(), keys );
        newModsList.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute ) );

        modContext.setModItems( newModsList );
    }
View Full Code Here

    }


    private ServerAttribute getKeyAttribute( Registries registries, Map<EncryptionType, EncryptionKey> keys ) throws Exception
    {
        ServerAttribute keyAttribute =
            new DefaultServerAttribute( KerberosAttribute.KRB5_KEY_AT,
                registries.getAttributeTypeRegistry().lookup( KerberosAttribute.KRB5_KEY_AT ) );

        Iterator<EncryptionKey> it = keys.values().iterator();

        while ( it.hasNext() )
        {
            try
            {
                keyAttribute.add( EncryptionKeyEncoder.encode( it.next() ) );
            }
            catch ( IOException ioe )
            {
                log.error( "Error encoding EncryptionKey.", ioe );
            }
View Full Code Here

TOP

Related Classes of org.apache.directory.server.core.entry.ServerAttribute

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.