Examples of ChangePasswordException


Examples of com.finiac.exception.ChangePasswordException

 
  private void changePassword(User user, String currentPassword, String newPassword1, String newPassword2) throws Exception
  {
    String cryptCurPassword = DigestUtils.sha256Hex(currentPassword +passwordHashPadding);
    if(!user.getPassword().equals(cryptCurPassword))
      throw new ChangePasswordException();
    if(!newPassword1.equals(newPassword2))
      throw new ChangePasswordException();
    if(newPassword1.length()<6)
      throw new ChangePasswordException();
    String cryptNewPassword = DigestUtils.sha256Hex(newPassword1 +passwordHashPadding);
    user.setPassword(cryptNewPassword);
    userDAO.updateUser(user);
  }
View Full Code Here

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

            String principalName = store.changePassword( clientPrincipal, newPassword );
            LOG.debug( "Successfully modified principal {}.", principalName );
        }
        catch ( NamingException ne )
        {
            throw new ChangePasswordException( ErrorType.KRB5_KPASSWD_SOFTERROR, ne.getExplanation().getBytes(), ne );
        }
        catch ( Exception e )
        {
            throw new ChangePasswordException( ErrorType.KRB5_KPASSWD_HARDERROR, e );
        }
    }
View Full Code Here

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 );
        }

        ApplicationRequest 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.NUMBER13 );
        }
        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.NUMBER13 );
        }
        catch ( KerberosException ke )
        {
            throw new ChangePasswordException( ErrorType.KRB5_KPASSWD_SOFTERROR, ke );
        }

        PrivateMessage privateMessage = new PrivateMessage( encPrivPart );

        // Begin AP_REP generation
        EncApRepPartModifier encApModifier = new EncApRepPartModifier();
        encApModifier.setClientTime( authenticator.getClientTime() );
        encApModifier.setClientMicroSecond( authenticator.getClientMicroSecond() );
        encApModifier.setSequenceNumber( new Integer( authenticator.getSequenceNumber() ) );
        encApModifier.setSubSessionKey( authenticator.getSubSessionKey() );

        EncApRepPart repPart = encApModifier.getEncApRepPart();

        EncryptedData encRepPart;

        try
        {
            encRepPart = cipherTextHandler.seal( ticket.getEncTicketPart().getSessionKey(), repPart, KeyUsage.NUMBER12 );
        }
        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

            String explanation = buildErrorMessage( username, password, passwordLength, categoryCount, tokenSize );
            log.error( explanation );

            byte[] explanatoryData = explanation.getBytes( "UTF-8" );

            throw new ChangePasswordException( ErrorType.KRB5_KPASSWD_SOFTERROR, explanatoryData );
        }

        next.execute( session, message );
    }
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.changepw.exceptions.ChangePasswordException

            String explanation = buildErrorMessage( username, password, passwordLength, categoryCount, tokenSize );
            log.error( explanation );

            byte[] explanatoryData = explanation.getBytes( "UTF-8" );

            throw new ChangePasswordException( ErrorType.KRB5_KPASSWD_SOFTERROR, explanatoryData );
        }

        next.execute( session, message );
    }
View Full Code Here

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

            String principalName = store.changePassword( clientPrincipal, newPassword );
            LOG.debug( "Successfully modified principal {}.", principalName );
        }
        catch ( NamingException ne )
        {
            throw new ChangePasswordException( ErrorType.KRB5_KPASSWD_SOFTERROR, ne.getExplanation().getBytes(), ne );
        }
        catch ( Exception e )
        {
            throw new ChangePasswordException( ErrorType.KRB5_KPASSWD_HARDERROR, e );
        }
    }
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.