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

Examples of org.apache.directory.shared.ldap.model.entry.BinaryValue


                    for ( byte b : val )
                    {
                        newVal[i++] = ( byte ) ( b & 0x007F );
                    }

                    return new BinaryValue( Strings.trim( newVal ) );
                }

                throw new IllegalStateException( I18n.err( I18n.ERR_474 ) );
            }
View Full Code Here


        if ( ( entry.get( SchemaConstants.USER_PASSWORD_AT ) != null ) &&
            ( entry.get( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ) != null ) )
        {
            log.debug( "Adding the entry '{}' for Dn '{}'.", entry, normName.getName() );

            BinaryValue userPassword = ( BinaryValue ) entry.get( SchemaConstants.USER_PASSWORD_AT ).get();
            String strUserPassword = userPassword.getString();

            if ( log.isDebugEnabled() )
            {
                StringBuffer sb = new StringBuffer();
                sb.append( "'" + strUserPassword + "' ( " );
View Full Code Here

        if ( pwdAt == null )
        {
            return;
        }

        BinaryValue userPassword = ( BinaryValue ) pwdAt.get();

        // check if the given password is already hashed
        LdapSecurityConstants existingAlgo = PasswordUtil.findAlgorithm( userPassword.getValue() );

        // if there exists NO algorithm, then hash the password
        if ( existingAlgo == null )
        {
            byte[] hashedPassword = PasswordUtil.createStoragePassword( userPassword.getValue(), algorithm );

            pwdAt.clear();
            pwdAt.add( hashedPassword );
        }
    }
View Full Code Here

        }
        else
        {
            if ( value instanceof String )
            {
                val = new BinaryValue( attributeType, Strings.getBytesUtf8( ( String ) value ) );
            }
            else if ( value instanceof byte[] )
            {
                val = new BinaryValue( attributeType, ( byte[] ) value );
            }
            else
            {
                throw new LdapException( I18n.err( I18n.ERR_309, oid ) );
            }
View Full Code Here

            {
                normalized = new StringValue( ( String ) ncn.normalizeByName( attribute, value.getString() ) );
            }
            else
            {
                normalized = new BinaryValue( ( byte[] ) ncn.normalizeByName( attribute, value.getBytes() ) );
            }

            return normalized;
        }
        catch ( LdapException ne )
View Full Code Here

        }
        else
        {
            if ( value instanceof StringValue )
            {
                return new BinaryValue( attributeType, ( ( StringValue ) value ).getBytes() );
            }
        }

        return null;
    }
View Full Code Here

            {
                List<Value<?>> binaries = new ArrayList<Value<?>>();

                for ( Value<?> value : attribute )
                {
                    binaries.add( new BinaryValue( attribute.getAttributeType(), value.getBytes() ) );
                }

                attribute.clear();

                for ( Value<?> value : binaries )
View Full Code Here

        assertEquals( 2, attributeSN.size() );
        assertNotNull( attributeSN.get() );
        assertTrue( attributeSN.contains( value1 ) );
        assertTrue( attributeSN.contains( value2 ) );

        Value<byte[]> value4 = new BinaryValue( atPwd, BYTES1 );
        entry.add( "l", value1, value4 );
        assertEquals( 3, entry.size() );
        Attribute attributeL = entry.get( "l" );

        // Cannot store a binary value in a String attribute
View Full Code Here

        Value<String> strValue1 = new StringValue( atDC, "test1" );
        Value<String> strValue2 = new StringValue( atDC, "test2" );
        Value<String> strValue3 = new StringValue( atDC, "test3" );
        Value<String> strNullValue = new StringValue( atDC, null );

        Value<byte[]> binValue1 = new BinaryValue( atPwd, BYTES1 );
        Value<byte[]> binValue2 = new BinaryValue( atPwd, BYTES2 );
        Value<byte[]> binValue3 = new BinaryValue( atPwd, BYTES3 );

        try
        {
            entry.add( ( AttributeType ) null, strValue1 );
            fail();
View Full Code Here

        Value<String> strValue1 = new StringValue( atDC, "test1" );
        Value<String> strValue2 = new StringValue( atDC, "test2" );
        Value<String> strValue3 = new StringValue( atDC, "test3" );
        Value<String> strNullValue = new StringValue( atDC, null );

        Value<byte[]> binValue1 = new BinaryValue( atPwd, BYTES1 );
        Value<byte[]> binValue2 = new BinaryValue( atPwd, BYTES2 );
        Value<byte[]> binValue3 = new BinaryValue( atPwd, BYTES3 );

        try
        {
            entry.add( "cn", ( AttributeType ) null, strValue1 );
            fail();
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.model.entry.BinaryValue

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.