Package org.apache.directory.shared.kerberos.components

Examples of org.apache.directory.shared.kerberos.components.KrbCredInfo


        int size = optionalFieldValueList.size();

        for ( int i = 0; i < size; i++ )
        {
            KrbCredInfo expected = new KrbCredInfo();
            expected.setKey( key );
            Map<String, Field> krbCredInfoFieldNameMap = getFieldMap( expected );

            List<FieldValueHolder> presentFieldList = new ArrayList<FieldValueHolder>();

            FieldValueHolder fieldValHolder = optionalFieldValueList.get( i );
            presentFieldList.add( fieldValHolder );

            Field f = krbCredInfoFieldNameMap.get( Strings.toLowerCase( fieldValHolder.fieldName ) );
            f.set( expected, fieldValHolder.value );

            for ( int j = i + 1; j < size; j++ )
            {
                fieldValHolder = optionalFieldValueList.get( j );
                presentFieldList.add( fieldValHolder );
                f = krbCredInfoFieldNameMap.get( Strings.toLowerCase( fieldValHolder.fieldName ) );
                f.set( expected, fieldValHolder.value );
            }

            ByteBuffer stream = ByteBuffer.allocate( expected.computeLength() );
            expected.encode( stream );
            stream.flip();

            Asn1Decoder decoder = new Asn1Decoder();
            KrbCredInfoContainer container = new KrbCredInfoContainer();
            container.setStream( stream );

            try
            {
                decoder.decode( stream, container );
            }
            catch ( DecoderException e )
            {
                // NOTE: keep this sysout for easy debugging (no need to setup a logger)
                System.out.println( "failed sequence:\n" + expected );
                throw e;
            }

            KrbCredInfo actual = container.getKrbCredInfo();
            assertValues( presentFieldList, actual );
        }

    }
View Full Code Here


        // start from the first mandatory element and add ONLY one OPTIONAL element and then test decoding

        int size = optionalFieldValueList.size();
        for ( int i = size - 1; i >= 0; i-- )
        {
            KrbCredInfo expected = new KrbCredInfo();
            expected.setKey( key );
            Map<String, Field> krbCredInfoFieldNameMap = getFieldMap( expected );

            List<FieldValueHolder> presentFieldList = new ArrayList<FieldValueHolder>();

            FieldValueHolder fieldValHolder = optionalFieldValueList.get( i );
            presentFieldList.add( fieldValHolder );

            Field f = krbCredInfoFieldNameMap.get( Strings.toLowerCase( fieldValHolder.fieldName ) );
            f.set( expected, fieldValHolder.value );

            ByteBuffer stream = ByteBuffer.allocate( expected.computeLength() );
            expected.encode( stream );
            stream.flip();

            Asn1Decoder decoder = new Asn1Decoder();
            KrbCredInfoContainer container = new KrbCredInfoContainer();
            container.setStream( stream );

            try
            {
                decoder.decode( stream, container );
            }
            catch ( DecoderException e )
            {
                // NOTE: keep this sysout for easy debugging (no need to setup a logger)
                System.out.println( "failed sequence:\n" + expected );
                throw e;
            }

            KrbCredInfo actual = container.getKrbCredInfo();
            assertValues( presentFieldList, actual );
        }
    }
View Full Code Here

    public void setup() throws Exception
    {
        optionalFieldValueList = new ArrayList<FieldValueHolder>();

        ticketInfo = new ArrayList<KrbCredInfo>();
        KrbCredInfo info1 = new KrbCredInfo();
        info1.setKey( new EncryptionKey( EncryptionType.DES3_CBC_MD5, new byte[]
            { 0, 1 } ) );
        ticketInfo.add( info1 );

        KrbCredInfo info2 = new KrbCredInfo();
        info2.setKey( new EncryptionKey( EncryptionType.AES128_CTS_HMAC_SHA1_96, new byte[]
            { 2, 3 } ) );
        ticketInfo.add( info2 );

        nonce = 100;
        optionalFieldValueList.add( new FieldValueHolder( "nonce", nonce ) );
View Full Code Here

        catch ( DecoderException e )
        {
            throw e;
        }

        KrbCredInfo ticketInfo = ticketInfoContainer.getKrbCredInfo();
        // add KrbCredInfo to the list of ticket-info
        encKrbCredPartContainer.getEncKrbCredPart().addTicketInfo( ticketInfo );

        // Update the expected length for the current TLV
        tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );
View Full Code Here

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
        }

        KrbCredInfo krbCredInfo = new KrbCredInfo();
        krbCredInfoContainer.setKrbCredInfo( krbCredInfo );

        if ( IS_DEBUG )
        {
            LOG.debug( "KrbCredInfo created" );
View Full Code Here

        int size = optionalFieldValueList.size();

        for ( int i = 0; i < size; i++ )
        {
            KrbCredInfo expected = new KrbCredInfo();
            expected.setKey( key );
            Map<String, Field> krbCredInfoFieldNameMap = getFieldMap( expected );

            List<FieldValueHolder> presentFieldList = new ArrayList<FieldValueHolder>();

            FieldValueHolder fieldValHolder = optionalFieldValueList.get( i );
            presentFieldList.add( fieldValHolder );

            Field f = krbCredInfoFieldNameMap.get( Strings.toLowerCase( fieldValHolder.fieldName ) );
            f.set( expected, fieldValHolder.value );

            for ( int j = i + 1; j < size; j++ )
            {
                fieldValHolder = optionalFieldValueList.get( j );
                presentFieldList.add( fieldValHolder );
                f = krbCredInfoFieldNameMap.get( Strings.toLowerCase( fieldValHolder.fieldName ) );
                f.set( expected, fieldValHolder.value );
            }

            ByteBuffer stream = ByteBuffer.allocate( expected.computeLength() );
            expected.encode( stream );
            stream.flip();

            Asn1Decoder decoder = new Asn1Decoder();
            KrbCredInfoContainer container = new KrbCredInfoContainer();
            container.setStream( stream );

            try
            {
                decoder.decode( stream, container );
            }
            catch ( DecoderException e )
            {
                // NOTE: keep this sysout for easy debugging (no need to setup a logger)
                System.out.println( "failed sequence:\n" + expected );
                throw e;
            }

            KrbCredInfo actual = container.getKrbCredInfo();
            assertValues( presentFieldList, actual );
        }

    }
View Full Code Here

        // start from the first mandatory element and add ONLY one OPTIONAL element and then test decoding

        int size = optionalFieldValueList.size();
        for ( int i = size - 1; i >= 0; i-- )
        {
            KrbCredInfo expected = new KrbCredInfo();
            expected.setKey( key );
            Map<String, Field> krbCredInfoFieldNameMap = getFieldMap( expected );

            List<FieldValueHolder> presentFieldList = new ArrayList<FieldValueHolder>();

            FieldValueHolder fieldValHolder = optionalFieldValueList.get( i );
            presentFieldList.add( fieldValHolder );

            Field f = krbCredInfoFieldNameMap.get( Strings.toLowerCase( fieldValHolder.fieldName ) );
            f.set( expected, fieldValHolder.value );

            ByteBuffer stream = ByteBuffer.allocate( expected.computeLength() );
            expected.encode( stream );
            stream.flip();

            Asn1Decoder decoder = new Asn1Decoder();
            KrbCredInfoContainer container = new KrbCredInfoContainer();
            container.setStream( stream );

            try
            {
                decoder.decode( stream, container );
            }
            catch ( DecoderException e )
            {
                // NOTE: keep this sysout for easy debugging (no need to setup a logger)
                System.out.println( "failed sequence:\n" + expected );
                throw e;
            }

            KrbCredInfo actual = container.getKrbCredInfo();
            assertValues( presentFieldList, actual );
        }
    }
View Full Code Here

    public void setup() throws Exception
    {
        optionalFieldValueList = new ArrayList<FieldValueHolder>();

        ticketInfo = new ArrayList<KrbCredInfo>();
        KrbCredInfo info1 = new KrbCredInfo();
        info1.setKey( new EncryptionKey( EncryptionType.DES3_CBC_MD5, new byte[]
            { 0, 1 } ) );
        ticketInfo.add( info1 );

        KrbCredInfo info2 = new KrbCredInfo();
        info2.setKey( new EncryptionKey( EncryptionType.AES128_CTS_HMAC_SHA1_96, new byte[]
            { 2, 3 } ) );
        ticketInfo.add( info2 );

        nonce = 100;
        optionalFieldValueList.add( new FieldValueHolder( "nonce", nonce ) );
View Full Code Here

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
        }

        KrbCredInfo krbCredInfo = new KrbCredInfo();
        krbCredInfoContainer.setKrbCredInfo( krbCredInfo );

        if ( IS_DEBUG )
        {
            LOG.debug( "KrbCredInfo created" );
View Full Code Here

        catch ( DecoderException e )
        {
            throw e;
        }

        KrbCredInfo ticketInfo = ticketInfoContainer.getKrbCredInfo();
        // add KrbCredInfo to the list of ticket-info
        encKrbCredPartContainer.getEncKrbCredPart().addTicketInfo( ticketInfo );

        // Update the expected length for the current TLV
        tlv.setExpectedLength( tlv.getExpectedLength() - tlv.getLength() );
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.kerberos.components.KrbCredInfo

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.