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

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


        newTicketPart.setCRealm( tgt.getEncTicketPart().getCRealm() );

        if ( request.getKdcReqBody().getEncAuthorizationData() != null )
        {
            byte[] authorizationData = cipherTextHandler.decrypt( authenticator.getSubKey(), request.getKdcReqBody().getEncAuthorizationData(), KeyUsage.TGS_REQ_KDC_REQ_BODY_AUTHZ_DATA_ENC_WITH_TGS_SESS_KEY );
            AuthorizationData authData = KerberosDecoder.decodeAuthorizationData( authorizationData );
            authData.addEntry( tgt.getEncTicketPart().getAuthorizationData().getCurrentAD() );
            newTicketPart.setAuthorizationData( authData );
        }

        processTransited( newTicketPart, tgt );
View Full Code Here


        {
            throw new KerberosException( ErrorType.KRB_AP_ERR_BAD_INTEGRITY, de );
        }

        // get the decoded AuthorizationData
        AuthorizationData authorizationData = ( ( AuthorizationDataContainer ) authorizationDataContainer ).getAuthorizationData();

        return authorizationData;
    }
View Full Code Here

        if ( request.getKdcReqBody().getEncAuthorizationData() != null )
        {
            byte[] authorizationData = cipherTextHandler.decrypt( authenticator.getSubKey(), request.getKdcReqBody()
                .getEncAuthorizationData(), KeyUsage.TGS_REQ_KDC_REQ_BODY_AUTHZ_DATA_ENC_WITH_TGS_SESS_KEY );
            AuthorizationData authData = KerberosDecoder.decodeAuthorizationData( authorizationData );
            authData.addEntry( tgt.getEncTicketPart().getAuthorizationData().getCurrentAD() );
            newTicketPart.setAuthorizationData( authData );
        }

        processTransited( newTicketPart, tgt );
View Full Code Here

        if ( request.getKdcReqBody().getEncAuthorizationData() != null )
        {
            byte[] authorizationData = cipherTextHandler.decrypt( authenticator.getSubKey(), request.getKdcReqBody()
                .getEncAuthorizationData(), KeyUsage.TGS_REQ_KDC_REQ_BODY_AUTHZ_DATA_ENC_WITH_TGS_SESS_KEY );
            AuthorizationData authData = KerberosDecoder.decodeAuthorizationData( authorizationData );
            authData.addEntry( tgt.getEncTicketPart().getAuthorizationData().getCurrentAD() );
            newTicketPart.setAuthorizationData( authData );
        }

        processTransited( newTicketPart, tgt );
View Full Code Here

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

        AuthorizationData authData = authDataContainer.getAuthorizationData();

        assertNotNull( authData.getAuthorizationData().size() );
        assertEquals( 2, authData.getAuthorizationData().size() );

        String[] expected = new String[]
            { "abcdef", "ghi" };
        int i = 0;

        for ( AuthorizationDataEntry ad : authData.getAuthorizationData() )
        {
            assertEquals( AuthorizationType.AD_INTENDED_FOR_SERVER, ad.getAdType() );
            assertTrue( Arrays.equals( Strings.getBytesUtf8( expected[i++] ), ad.getAdData() ) );

        }

        // Check the encoding
        ByteBuffer bb = ByteBuffer.allocate( authData.computeLength() );

        try
        {
            bb = authData.encode( bb );

            // Check the length
            assertEquals( 0x21, bb.limit() );

            String encodedPdu = Strings.dumpBytes( bb.array() );
View Full Code Here

public class AuthorizationDataTest
{
    @Test
    public void testAuthorizationDataOneAD() throws Exception
    {
        AuthorizationData ad = new AuthorizationData();
        ad.addEntry( new AuthorizationDataEntry( AuthorizationType.AD_KDC_ISSUED, new byte[]
            { 0x01, 0x02, 0x03, 0x04 } ) );

        ByteBuffer encoded = ByteBuffer.allocate( ad.computeLength() );

        ad.encode( encoded );

        byte[] expectedResult = new byte[]
            {
                0x30, 0x0F,
                0x30, 0x0d,
View Full Code Here


    @Test
    public void testAuthorizationDataThreeAD() throws Exception
    {
        AuthorizationData ad = new AuthorizationData();
        ad.addEntry( new AuthorizationDataEntry( AuthorizationType.AD_KDC_ISSUED, new byte[]
            { 0x01, 0x02, 0x03, 0x04 } ) );
        ad.addEntry( new AuthorizationDataEntry( AuthorizationType.AD_IF_RELEVANT, new byte[]
            { 0x05, 0x06, 0x07, 0x08 } ) );
        ad.addEntry( new AuthorizationDataEntry( AuthorizationType.AD_MANDATORY_TICKET_EXTENSIONS, new byte[]
            { 0x09, 0x0A, 0x0B, 0x0C } ) );

        ByteBuffer encoded = ByteBuffer.allocate( ad.computeLength() );

        ad.encode( encoded );

        byte[] expectedResult = new byte[]
            {
                0x30, 0x2D,
                0x30, 0x0d,
View Full Code Here

        {
            throw new KerberosException( ErrorType.KRB_AP_ERR_BAD_INTEGRITY, de );
        }

        // get the decoded AuthorizationData
        AuthorizationData authorizationData = ( ( AuthorizationDataContainer ) authorizationDataContainer )
            .getAuthorizationData();

        return authorizationData;
    }
View Full Code Here

        assertNotNull( principalName );
        assertEquals( PrincipalNameType.KRB_NT_PRINCIPAL, principalName.getNameType() );
        assertTrue( principalName.getNames().contains( "hnelson" ) );

        AuthorizationData authData = adKdcIssued.getElements();

        assertNotNull( authData.getAuthorizationData().size() );
        assertEquals( 2, authData.getAuthorizationData().size() );

        String[] expected = new String[]
            { "abcdef", "ghijkl" };
        int i = 0;

        for ( AuthorizationDataEntry ad : authData.getAuthorizationData() )
        {
            assertEquals( AuthorizationType.AD_INTENDED_FOR_SERVER, ad.getAdType() );
            assertTrue( Arrays.equals( Strings.getBytesUtf8( expected[i++] ), ad.getAdData() ) );

        }
View Full Code Here

        // The sname
        assertNull( adKdcIssued.getISName() );

        // the elements
        AuthorizationData authData = adKdcIssued.getElements();

        assertNotNull( authData.getAuthorizationData().size() );
        assertEquals( 2, authData.getAuthorizationData().size() );

        String[] expected = new String[]
            { "abcdef", "ghijkl" };
        int i = 0;

        for ( AuthorizationDataEntry ad : authData.getAuthorizationData() )
        {
            assertEquals( AuthorizationType.AD_INTENDED_FOR_SERVER, ad.getAdType() );
            assertTrue( Arrays.equals( Strings.getBytesUtf8( expected[i++] ), ad.getAdData() ) );

        }
View Full Code Here

TOP

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

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.