Search in sources :

Example 1 with AuthenticatedActionExecutor

use of edu.stanford.bmir.protege.web.client.auth.AuthenticatedActionExecutor in project webprotege by protegeproject.

the class ChangePasswordPresenter method executeChangePassword.

private void executeChangePassword(final ChangePasswordData data, final WebProtegeDialogCloser closer) {
    AuthenticatedActionExecutor executor = new AuthenticatedActionExecutor(dispatchServiceManager, new PasswordDigestAlgorithm(new Md5DigestAlgorithmProvider()), new ChapResponseDigestAlgorithm(new Md5DigestAlgorithmProvider()));
    String currentPassword = data.getOldPassword();
    String newPassword = data.getNewPassword();
    ChangePasswordActionFactory actionFactory = new ChangePasswordActionFactory(newPassword, new SaltProvider());
    executor.execute(userId, currentPassword, actionFactory, new AuthenticatedDispatchServiceCallback<ChangePasswordResult>() {

        @Override
        public void handleAuthenticationResponse(@Nonnull AuthenticationResponse response) {
            if (response == AuthenticationResponse.SUCCESS) {
                MessageBox.showMessage("Your password has been changed");
                closer.hide();
            } else {
                handleIncorrectCurrentPassword();
            }
        }

        @Override
        public String getProgressDisplayTitle() {
            return "Changing password";
        }

        @Override
        public String getProgressDisplayMessage() {
            return "Please wait.";
        }
    });
}
Also used : AuthenticatedActionExecutor(edu.stanford.bmir.protege.web.client.auth.AuthenticatedActionExecutor) SaltProvider(edu.stanford.bmir.protege.web.shared.auth.SaltProvider)

Aggregations

AuthenticatedActionExecutor (edu.stanford.bmir.protege.web.client.auth.AuthenticatedActionExecutor)1 SaltProvider (edu.stanford.bmir.protege.web.shared.auth.SaltProvider)1