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

Examples of org.apache.directory.server.kerberos.shared.messages.ErrorMessageModifier


    }


    protected ErrorMessage getErrorMessage( KerberosPrincipal principal, KerberosException exception )
    {
        ErrorMessageModifier modifier = new ErrorMessageModifier();

        KerberosTime now = new KerberosTime();

        modifier.setErrorCode( exception.getErrorCode() );
        modifier.setExplanatoryText( exception.getLocalizedMessage() );
        modifier.setServerPrincipal( principal );
        modifier.setServerTime( now );
        modifier.setServerMicroSecond( 0 );
        modifier.setExplanatoryData( exception.getExplanatoryData() );

        return modifier.getErrorMessage();
    }
View Full Code Here


     e-data          [12] OCTET STRING OPTIONAL
     }
     */
    private ErrorMessage decodeErrorMessageSequence( DERSequence sequence )
    {
        ErrorMessageModifier errorModifier = new ErrorMessageModifier();
        KerberosPrincipalModifier clientModifier = new KerberosPrincipalModifier();
        KerberosPrincipalModifier serverModifier = new KerberosPrincipalModifier();

        for ( Enumeration<DEREncodable> e = sequence.getObjects(); e.hasMoreElements(); )
        {
            DERTaggedObject object = ( DERTaggedObject ) e.nextElement();
            int tag = object.getTagNo();
            DEREncodable derObject = object.getObject();

            switch ( tag )
            {
                case 0:
                    // DERInteger tag0 = ( DERInteger ) derObject;
                    // int pvno = tag0.intValue();
                    break;
                case 1:
                    // DERInteger tag1 = ( DERInteger ) derObject;
                    // msgType = MessageType.getTypeByOrdinal( tag1.intValue() );
                    break;
                case 2:
                    DERGeneralizedTime tag2 = ( DERGeneralizedTime ) derObject;
                    errorModifier.setClientTime( KerberosTimeDecoder.decode( tag2 ) );
                    break;
                case 3:
                    DERInteger tag3 = ( DERInteger ) derObject;
                    errorModifier.setClientMicroSecond( tag3.intValue() );
                    break;
                case 4:
                    DERGeneralizedTime tag4 = ( DERGeneralizedTime ) derObject;
                    errorModifier.setServerTime( KerberosTimeDecoder.decode( tag4 ) );
                    break;
                case 5:
                    DERInteger tag5 = ( DERInteger ) derObject;
                    errorModifier.setServerMicroSecond( tag5.intValue() );
                    break;
                case 6:
                    DERInteger tag6 = ( DERInteger ) derObject;
                    errorModifier.setErrorCode( tag6.intValue() );
                    break;
                case 7:
                    DERGeneralString tag7 = ( DERGeneralString ) derObject;
                    clientModifier.setRealm( tag7.getString() );
                    break;
                case 8:
                    DERSequence tag8 = ( DERSequence ) derObject;
                    clientModifier.setPrincipalName( PrincipalNameDecoder.decode( tag8 ) );
                    break;
                case 9:
                    DERGeneralString tag9 = ( DERGeneralString ) derObject;
                    serverModifier.setRealm( tag9.getString() );
                    break;
                case 10:
                    DERSequence tag10 = ( DERSequence ) derObject;
                    serverModifier.setPrincipalName( PrincipalNameDecoder.decode( tag10 ) );
                    break;
                case 11:
                    DERGeneralString tag11 = ( DERGeneralString ) derObject;
                    errorModifier.setExplanatoryText( tag11.getString() );
                    break;
                case 12:
                    DEROctetString tag12 = ( DEROctetString ) derObject;
                    errorModifier.setExplanatoryData( tag12.getOctets() );
                    break;
            }
        }

        errorModifier.setClientPrincipal( clientModifier.getKerberosPrincipal() );
        errorModifier.setServerPrincipal( serverModifier.getKerberosPrincipal() );

        return errorModifier.getErrorMessage();
    }
View Full Code Here

    }


    private ErrorMessage getErrorMessage( KerberosPrincipal principal, KerberosException exception )
    {
        ErrorMessageModifier modifier = new ErrorMessageModifier();

        KerberosTime now = new KerberosTime();

        modifier.setErrorCode( exception.getErrorCode() );
        modifier.setExplanatoryText( exception.getLocalizedMessage() );
        modifier.setServerPrincipal( principal );
        modifier.setServerTime( now );
        modifier.setServerMicroSecond( 0 );
        modifier.setExplanatoryData( buildExplanatoryData( exception ) );

        return modifier.getErrorMessage();
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.server.kerberos.shared.messages.ErrorMessageModifier

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.