Examples of BinaryValue


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

        byte[] b2 = Strings.getBytesUtf8( "test2" );

        Value<String> test1 = new StringValue( atCN, "test1" );
        Value<String> test2 = new StringValue( atCN, "test2" );

        Value<byte[]> testB1 = new BinaryValue( atPassword, b1 );
        Value<byte[]> testB2 = new BinaryValue( atPassword, b2 );

        // test a removal of an non existing attribute
        entry.removeAttributes( atCN );

        // Test a simple removal
View Full Code Here

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

        assertEquals( "Entry\n    dn[n]: dc=example,dc=com\n\n", entry.toString() );

        Value<String> strValueTop = new StringValue( "top" );
        Value<String> strValuePerson = new StringValue( "person" );

        Value<byte[]> binValue1 = new BinaryValue( BYTES1 );
        Value<byte[]> binValue2 = new BinaryValue( BYTES2 );
        Value<byte[]> binNullValue = new BinaryValue( ( byte[] ) null );

        entry.put( "ObjectClass", atOC, strValueTop, strValuePerson );
        entry.put( "UserPassword", atPwd, binValue1, binValue2, binNullValue );

        String expected =
View Full Code Here

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

        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

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

            {
                entry.add( mods.getAttributeType(), new StringValue( ( String ) null ) );
            }
            else
            {
                entry.add( mods.getAttributeType(), new BinaryValue( null ) );
            }
        }

        if ( modsOid.equals( SchemaConstants.ALIASED_OBJECT_NAME_AT_OID ) )
        {
View Full Code Here

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

            ( entry.get( KRB5_PRINCIPAL_NAME_AT ) != null ) )
        {
            LOG.debug( "Adding the entry '{}' for Dn '{}'.", entry, normName.getName() );

            // Get the entry's password. We will use the first one.
            BinaryValue userPassword = ( BinaryValue ) entry.get( USER_PASSWORD_AT ).get();
            String strUserPassword = userPassword.getString();

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

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

        }
        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

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

        Attribute userPasswordAttribute = entry.get( passwordAttribute );

        if ( userPasswordAttribute != null )
        {
            BinaryValue userPassword = ( BinaryValue ) userPasswordAttribute.get();

            try
            {
                check( addContext, entry, userPassword.getValue(), policyConfig );
            }
            catch ( PasswordPolicyException e )
            {
                if ( isPPolicyReqCtrlPresent )
                {
                    PasswordPolicyDecorator responseControl =
                        new PasswordPolicyDecorator( directoryService.getLdapCodecService(), true );
                    responseControl.getResponse().setPasswordPolicyError(
                        PasswordPolicyErrorEnum.get( e.getErrorCode() ) );
                    addContext.addResponseControl( responseControl );
                }

                // throw exception if userPassword quality checks fail
                throw new LdapOperationException( ResultCodeEnum.CONSTRAINT_VIOLATION, e.getMessage(), e );
            }

            String pwdChangedTime = DateUtils.getGeneralizedTime();

            if ( ( policyConfig.getPwdMinAge() > 0 ) || ( policyConfig.getPwdMaxAge() > 0 ) )
            {
                Attribute pwdChangedTimeAt = new DefaultAttribute( AT_PWD_CHANGED_TIME );
                pwdChangedTimeAt.add( pwdChangedTime );
                entry.add( pwdChangedTimeAt );
            }

            if ( policyConfig.isPwdMustChange() && addContext.getSession().isAnAdministrator() )
            {
                Attribute pwdResetAt = new DefaultAttribute( AT_PWD_RESET );
                pwdResetAt.add( "TRUE" );
                entry.add( pwdResetAt );
            }

            if ( policyConfig.getPwdInHistory() > 0 )
            {
                Attribute pwdHistoryAt = new DefaultAttribute( AT_PWD_HISTORY );
                byte[] pwdHistoryVal = new PasswordHistory( pwdChangedTime, userPassword.getValue() ).getHistoryValue();
                pwdHistoryAt.add( pwdHistoryVal );
                entry.add( pwdHistoryAt );
            }
        }
View Full Code Here

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

            {
                entry.add( mods.getAttributeType(), new StringValue( null ) );
            }
            else
            {
                entry.add( mods.getAttributeType(), new BinaryValue( null ) );
            }
        }

        if ( modsOid.equals( SchemaConstants.ALIASED_OBJECT_NAME_AT_OID ) )
        {
View Full Code Here

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

        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() );
        EntryAttribute attributeL = entry.get( "l" );
        
        // Cannot store a binary value in a String attribute
View Full Code Here

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

                throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, message, le );
            }

            try
            {
                createAva( schemaManager, upType, new BinaryValue( attributeType, upValue ) );
            }
            catch ( LdapInvalidAttributeValueException liave )
            {
                String message = I18n.err( I18n.ERR_04188 );
                LOG.error( message );
                throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, message, liave );
            }
        }
        else
        {
            createAva( upType, new BinaryValue( upValue ) );
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.