public void setPassword(String password) throws UnsupportedOperationException {
        if (UserManager.getUserProvider().isReadOnly()) {
            throw new UnsupportedOperationException("User provider is read-only.");
        }

        try {
            AuthFactory.setPassword(username, password);

            // Fire event.
            Map<String,Object> params = new HashMap<>();
            params.put("type", "passwordModified");
            UserEventDispatcher.dispatchEvent(this, UserEventDispatcher.EventType.user_modified,
                    params);
        }
        catch (UserNotFoundException | ConnectionException | InternalUnauthenticatedException e) {
            Log.error(e.getMessage(), e);
        }
    }
Sets a new password for this user.

@param password the new password for the user.
@throws UnsupportedOperationException exception
xmppserver/src/main/java/org/jivesoftware/openfire/user/User.java