Examples of ChangePasswordException


Examples of org.apache.directory.server.changepw.exceptions.ChangePasswordException

    {
        ChangePasswordRequest request = ( ChangePasswordRequest ) changepwContext.getRequest();

        if ( request.getVersionNumber() != 1 )
        {
            throw new ChangePasswordException( ErrorType.KRB5_KPASSWD_BAD_VERSION );
        }

        if ( request.getAuthHeader() == null || request.getAuthHeader().getTicket() == null )
        {
            throw new ChangePasswordException( ErrorType.KRB5_KPASSWD_AUTHERROR );
        }

        ApReq authHeader = request.getAuthHeader();
        Ticket ticket = authHeader.getTicket();
View Full Code Here

Examples of org.apache.directory.server.changepw.exceptions.ChangePasswordException

        ChangePasswordRequest request = ( ChangePasswordRequest ) changepwContext.getRequest();

        if ( request.getVersionNumber() == 1 && !ticket.getEncTicketPart().getFlags().isInitial() )
        {
            throw new ChangePasswordException( ErrorType.KRB5_KPASSWD_INITIAL_FLAG_NEEDED );
        }

        changepwContext.setAuthenticator( authenticator );
    }
View Full Code Here

Examples of org.apache.directory.server.changepw.exceptions.ChangePasswordException

            privatePart = ( EncKrbPrivPart ) cipherTextHandler.unseal( EncKrbPrivPart.class, subSessionKey,
                encReqPrivPart, KeyUsage.KRB_PRIV_ENC_PART_CHOSEN_KEY );
        }
        catch ( KerberosException ke )
        {
            throw new ChangePasswordException( ErrorType.KRB5_KPASSWD_SOFTERROR, ke );
        }

        ChangePasswordData passwordData = null;

        if ( request.getVersionNumber() == ( short ) 1 )
        {
            // Use protocol version 0x0001, the legacy Kerberos change password protocol
            ChangePasswordDataModifier modifier = new ChangePasswordDataModifier();
            modifier.setNewPassword( privatePart.getUserData() );
            passwordData = modifier.getChangePasswdData();
        }
        else
        {
            // Use protocol version 0xFF80, the backwards-compatible MS protocol
            ChangePasswordDataDecoder passwordDecoder = new ChangePasswordDataDecoder();
            passwordData = passwordDecoder.decodeChangePasswordData( privatePart.getUserData() );
        }

        try
        {
            changepwContext.setPassword( new String( passwordData.getPassword(), "UTF-8" ) );
        }
        catch ( UnsupportedEncodingException uee )
        {
            throw new ChangePasswordException( ErrorType.KRB5_KPASSWD_SOFTERROR, uee );
        }
    }
View Full Code Here

Examples of org.apache.directory.server.changepw.exceptions.ChangePasswordException

        {
            encPrivPart = cipherTextHandler.seal( subSessionKey, privPart, KeyUsage.KRB_PRIV_ENC_PART_CHOSEN_KEY );
        }
        catch ( KerberosException ke )
        {
            throw new ChangePasswordException( ErrorType.KRB5_KPASSWD_SOFTERROR, ke );
        }

        PrivateMessage privateMessage = new PrivateMessage( encPrivPart );

        // Begin AP_REP generation
        EncApRepPart repPart = new EncApRepPart();
        repPart.setCTime( authenticator.getCtime() );
        repPart.setCusec( authenticator.getCusec() );
        repPart.setSeqNumber( Integer.valueOf( authenticator.getSeqNumber() ) );
        repPart.setSubkey( authenticator.getSubKey() );

        EncryptedData encRepPart;

        try
        {
            encRepPart = cipherTextHandler.seal( ticket.getEncTicketPart().getSessionKey(), repPart, KeyUsage.AP_REP_ENC_PART_SESS_KEY );
        }
        catch ( KerberosException ke )
        {
            throw new ChangePasswordException( ErrorType.KRB5_KPASSWD_SOFTERROR, ke );
        }

        ApplicationReply appReply = new ApplicationReply( encRepPart );

        // return status message value object
View Full Code Here

Examples of org.apache.directory.server.changepw.exceptions.ChangePasswordException

        }
        catch ( Exception e )
        {
            log.error( I18n.err( I18n.ERR_152, e.getLocalizedMessage() ), e );

            session.write( getErrorMessage( config.getServicePrincipal(), new ChangePasswordException(
                ErrorType.KRB5_KPASSWD_UNKNOWN_ERROR ) ) );
        }
    }
View Full Code Here

Examples of org.apache.directory.server.kerberos.changepwd.exceptions.ChangePasswordException

        short pvno = request.getVersionNumber();
       
        if ( ( pvno != AbstractPasswordMessage.PVNO ) && ( pvno != AbstractPasswordMessage.OLD_PVNO ) )
        {
            throw new ChangePasswordException( ChangePasswdErrorType.KRB5_KPASSWD_BAD_VERSION );
        }

        if ( request.getAuthHeader() == null || request.getAuthHeader().getTicket() == null )
        {
            throw new ChangePasswordException( ChangePasswdErrorType.KRB5_KPASSWD_AUTHERROR );
        }

        ApReq authHeader = request.getAuthHeader();
        Ticket ticket = authHeader.getTicket();
View Full Code Here

Examples of org.apache.directory.server.kerberos.changepwd.exceptions.ChangePasswordException

            byte[] decryptedData = cipherTextHandler.decrypt( subSessionKey, encReqPrivPart, KeyUsage.KRB_PRIV_ENC_PART_CHOSEN_KEY );
            EncKrbPrivPart privatePart = KerberosDecoder.decodeEncKrbPrivPart( decryptedData );

            if( authenticator.getSeqNumber() != privatePart.getSeqNumber() )
            {
                throw new ChangePasswordException( ChangePasswdErrorType.KRB5_KPASSWD_MALFORMED );   
            }
           
            if ( request.getVersionNumber() == AbstractPasswordMessage.OLD_PVNO )
            {
                passwordData = new ChangePasswdData();
                passwordData.setNewPasswd( privatePart.getUserData() );
            }
            else
            {
                Asn1Decoder passwordDecoder = new Asn1Decoder();
                ByteBuffer stream = ByteBuffer.wrap( privatePart.getUserData() );
                ChangePasswdDataContainer container = new ChangePasswdDataContainer( stream );
                passwordDecoder.decode( stream, container );
                passwordData = container.getChngPwdData();
            }
        }
        catch ( KerberosException ke )
        {
            throw new ChangePasswordException( ChangePasswdErrorType.KRB5_KPASSWD_SOFTERROR, ke );
        }

        changepwContext.setChngPwdData( passwordData );
    }
View Full Code Here

Examples of org.apache.directory.server.kerberos.changepwd.exceptions.ChangePasswordException

        {
            encPrivPart = cipherTextHandler.seal( subSessionKey, privPart, KeyUsage.KRB_PRIV_ENC_PART_CHOSEN_KEY );
        }
        catch ( KerberosException ke )
        {
            throw new ChangePasswordException( ChangePasswdErrorType.KRB5_KPASSWD_SOFTERROR, ke );
        }

        KrbPriv privateMessage = new KrbPriv();
        privateMessage.setEncPart( encPrivPart );

        // Begin AP_REP generation
        EncApRepPart repPart = new EncApRepPart();
        repPart.setCTime( authenticator.getCtime() );
        repPart.setCusec( authenticator.getCusec() );
       
        if ( authenticator.getSeqNumber() != null )
        {
            repPart.setSeqNumber( authenticator.getSeqNumber() );
        }
       
        repPart.setSubkey( subSessionKey );

        EncryptedData encRepPart;

        try
        {
            encRepPart = cipherTextHandler.seal( ticket.getEncTicketPart().getKey(), repPart, KeyUsage.AP_REP_ENC_PART_SESS_KEY );
        }
        catch ( KerberosException ke )
        {
            throw new ChangePasswordException( ChangePasswdErrorType.KRB5_KPASSWD_SOFTERROR, ke );
        }

        ApRep appReply = new ApRep();
        appReply.setEncPart( encRepPart );
View Full Code Here

Examples of org.apache.directory.server.kerberos.changepwd.exceptions.ChangePasswordException

        }
        catch ( Exception e )
        {
            log.error( I18n.err( I18n.ERR_152, e.getLocalizedMessage() ), e );

            KrbError error = getErrorMessage( server.getConfig().getServicePrincipal(), new ChangePasswordException(
                ChangePasswdErrorType.KRB5_KPASSWD_UNKNOWN_ERROR ) );
            session.write( new ChangePasswordError( request.getVersionNumber(), error ) );
        }
    }
View Full Code Here

Examples of org.apache.directory.server.kerberos.changepwd.exceptions.ChangePasswordException

        {
            kerberosDecoder.decode( stream, encTgsRepPartContainer );
        }
        catch ( DecoderException de )
        {
            throw new ChangePasswordException( ChangePasswdErrorType.KRB5_KPASSWD_MALFORMED, de );
        }

        // get the decoded EncTgsRepPart
        EncTgsRepPart encTgsRepPart = ( ( EncTgsRepPartContainer ) encTgsRepPartContainer ).getEncTgsRepPart();
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.