@Override
    public void execute(@Nonnull final SessionData data, Element command) {
        final Locale preferredLocale = SessionManager.getInstance().getLocaleForSession(data.getOwner());

        Element note = command.addElement("note");
        JID account;
        try {
            account = new JID(data.getData().get("accountjid").get(0));
        }
        catch (IllegalArgumentException e) {
            note.addAttribute("type", "error");
            note.setText(LocaleUtils.getLocalizedString("commands.admin.user.authenticateuser.note.jid-invalid", preferredLocale));
            return;
        }
        catch (NullPointerException ne) {
            note.addAttribute("type", "error");
            note.setText(LocaleUtils.getLocalizedString("commands.admin.user.authenticateuser.note.jid-required", preferredLocale));
            return;
        }
        if (!XMPPServer.getInstance().isLocal(account)) {
            note.addAttribute("type", "error");
            note.setText(LocaleUtils.getLocalizedString("commands.admin.user.authenticateuser.note.jid-not-local", preferredLocale));
            return;
        }
        String password = data.getData().get("password").get(0);
        // Get requested user
        User user;
        try {
            user = UserManager.getInstance().getUser(account.getNode());
        }
        catch (UserNotFoundException e) {
            // User not found
            note.addAttribute("type", "error");
            note.setText(LocaleUtils.getLocalizedString("commands.admin.user.authenticateuser.note.user-does-not-exist", preferredLocale));
            return;
        }

        try {
            AuthFactory.authenticate(user.getUsername(), password);
        }
        catch (UnauthorizedException | ConnectionException | InternalUnauthenticatedException e) {
            // Auth failed
            note.addAttribute("type", "error");
            note.setText(LocaleUtils.getLocalizedString("commands.admin.user.authenticateuser.note.authentication-failed", preferredLocale));
            return;
        }
        // Answer that the operation was successful
        note.addAttribute("type", "info");
        note.setText(LocaleUtils.getLocalizedString("commands.global.operation.finished.success", preferredLocale));
    }
Takes a user's username and password to authenticate them against the Openfire authprovider.

@author Alexander Wenckus
xmppserver/src/main/java/org/jivesoftware/openfire/commands/admin/user/AuthenticateUser.java