Package org.apache.directory.shared.kerberos.messages

Examples of org.apache.directory.shared.kerberos.messages.TgsReq


        Asn1Decoder kdcReqDecoder = new Asn1Decoder();

        KdcReqContainer kdcReqContainer = new KdcReqContainer( tgsReqContainer.getStream() );

        // Store the created TGS-REQ object into the KDC-REQ container
        TgsReq tgsReq = new TgsReq();
        kdcReqContainer.setKdcReq( tgsReq );

        // Decode the KDC_REQ PDU
        try
        {
            kdcReqDecoder.decode( tgsReqContainer.getStream(), kdcReqContainer );
        }
        catch ( DecoderException de )
        {
            throw de;
        }

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

        // Update the parent
        tgsReqContainer.updateParent();

        if ( tgsReq.getMessageType() != KerberosMessageType.TGS_REQ )
        {
            throw new DecoderException( "Bad message type" );
        }

        tgsReqContainer.setTgsReq( tgsReq );
View Full Code Here


            KerberosUtils.getKerberosPrincipal( tgt.getEncTicketPart().getCName(), tgt.getEncTicketPart().getCRealm() ),
            kdcReqBody, checksumType );

        PaData[] paDatas = getPreAuthenticationData( tgt, authenticator );

        KdcReq message = new TgsReq();
        message.setKdcReqBody( kdcReqBody );

        for ( PaData paData : paDatas )
        {
            message.addPaData( paData );
        }

        return message;
    }
View Full Code Here

        tgsReqBody.setEType( config.getEncryptionTypes() );
       
        PrincipalName principalName = new PrincipalName( KdcClientUtil.extractName( serverPrincipal ), KerberosPrincipal.KRB_NT_SRV_HST );
        tgsReqBody.setSName( principalName );
       
        TgsReq tgsReq = new TgsReq();
        tgsReq.setKdcReqBody( tgsReqBody );
       
        PaData authnHeader = new PaData();
        authnHeader.setPaDataType( PaDataType.PA_TGS_REQ );
        authnHeader.setPaDataValue( getEncoded( apReq ) );
       
        tgsReq.addPaData( authnHeader );
       
        // Get the result from the future
        try
        {
            connect();
View Full Code Here

        catch ( DecoderException de )
        {
            fail( de.getMessage() );
        }

        TgsReq tgsReq = tgsReqContainer.getTgsReq();

        assertTrue( tgsReq instanceof TgsReq );

        // Check the encoding
        int length = tgsReq.computeLength();

        // Check the length
        assertEquals( 0x193, length );

        // Check the encoding
        ByteBuffer encodedPdu = ByteBuffer.allocate( length );

        try
        {
            encodedPdu = tgsReq.encode( encodedPdu );

            // Check the length
            assertEquals( 0x193, encodedPdu.limit() );
        }
        catch ( EncoderException ee )
View Full Code Here

        catch ( DecoderException de )
        {
            fail( de.getMessage() );
        }

        TgsReq tgsReq = tgsReqContainer.getTgsReq();

        assertTrue( tgsReq instanceof TgsReq );

        // Check the encoding
        length = tgsReq.computeLength();

        // Check the length
        assertEquals( 0x193, length );

        // Check the encoding
        encodedPdu = ByteBuffer.allocate( length );

        try
        {
            encodedPdu = tgsReq.encode( encodedPdu );

            // Check the length
            assertEquals( 0x193, encodedPdu.limit() );
        }
        catch ( EncoderException ee )
View Full Code Here

        KdcReqBody kdcReqBody = new KdcReqBody();
        kdcReqBody.setSName( getPrincipalName( "hnelson" ) );
        kdcReqBody.setRealm( "EXAMPLE.COM" );
        kdcReqBody.setEType( config.getEncryptionTypes() );

        KdcReq message = new TgsReq();
        message.setProtocolVersionNumber( 4 );
        message.setKdcReqBody( kdcReqBody );

        handler.messageReceived( session, message );

        Object msg = session.getMessage();
        assertEquals( "session.getMessage() instanceOf", KrbError.class, msg.getClass() );
View Full Code Here

        // Generate a new sequence number.
        sequenceNumber = random.nextInt();
        now = new KerberosTime();

        KdcReq message = new TgsReq();
        message.setKdcReqBody( kdcReqBody );

        handler.messageReceived( session, message );

        Object msg = session.getMessage();
        assertEquals( "session.getMessage() instanceOf", KrbError.class, msg.getClass() );
View Full Code Here

        long now = System.currentTimeMillis();

        KerberosTime requestedEndTime = new KerberosTime( now + KerberosTime.DAY );
        kdcReqBody.setTill( requestedEndTime );

        KdcReq message = new TgsReq();
        message.setKdcReqBody( kdcReqBody );

        handler.messageReceived( session, message );

        Object msg = session.getMessage();
        assertEquals( "session.getMessage() instanceOf", KrbError.class, msg.getClass() );
View Full Code Here

        catch ( DecoderException de )
        {
            fail( de.getMessage() );
        }

        TgsReq tgsReq = tgsReqContainer.getTgsReq();
       
        assertTrue( tgsReq instanceof TgsReq );
       
        // Check the encoding
        length = tgsReq.computeLength();

        // Check the length
        assertEquals( 0x193, length );
       
        // Check the encoding
        encodedPdu = ByteBuffer.allocate( length );
       
        try
        {
            encodedPdu = tgsReq.encode( encodedPdu );
   
            // Check the length
            assertEquals( 0x193, encodedPdu.limit() );
        }
        catch ( EncoderException ee )
View Full Code Here

        tgsReqBody.setEType( config.getEncryptionTypes() );
       
        PrincipalName principalName = new PrincipalName( KdcClientUtil.extractName( serverPrincipal ), KerberosPrincipal.KRB_NT_SRV_HST );
        tgsReqBody.setSName( principalName );
       
        TgsReq tgsReq = new TgsReq();
        tgsReq.setKdcReqBody( tgsReqBody );
       
        PaData authnHeader = new PaData();
        authnHeader.setPaDataType( PaDataType.PA_TGS_REQ );
        authnHeader.setPaDataValue( getEncoded( apReq ) );
       
        tgsReq.addPaData( authnHeader );
       
        // Get the result from the future
        try
        {
            connect();
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.kerberos.messages.TgsReq

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.