Called when the server requests keyboard interactive authentication
976521
def getGenericAnswers(self, name, instruction, prompts):
        
        responses = []
        for prompt, _echo in prompts:
            password = self.getPassword(prompt)
            responses.append(password)

        return defer.succeed(responses)
811682
private void requestAuthorization(HttpServletResponse resp) throws IOException {

        // Authorisation is required for the requested action.
        resp.setHeader(CmsRequestUtil.HEADER_WWW_AUTHENTICATE, "Basic realm=\"" + BASIC_REALM + "\"");

        resp.sendError(HttpServletResponse.SC_UNAUTHORIZED);
    }
799188
def interactive(self):
        """"""
        while True:
            line = sys.stdin.readline().strip()
            if line == 'quit':
                sys.exit()
            elif line == 'validate':
                self.check_syntax()
                self.check_imports()
                self.check_install_json()
                self.check_layout_json()
                self.print_json()

            # reset validation_data
            self.validation_data = self._validation_data
245414
def authenticate(self, user, password):
        """"""
        assert user['password_hash'] == '_'.join((password, 'hash'))
        self.logger.debug('User %s has been successfully authenticated',
                          user['uid'])
400591
def basic_authentication_ie(title, username, password, options = {})
      default_options = {:textctrl_username => "Edit2",
                         :textctrl_password => "Edit3",
                         :button_ok => 'Button1'
      }

      options = default_options.merge(options)

      title ||= ""      
      if title =~ /^Connect\sto/
        full_title = title
      else
        full_title = "Connect to #{title}"
      end
      require 'rformspec'
      login_win = RFormSpec::Window.new(full_title)
      login_win.send_control_text(options[:textctrl_username], username)
      login_win.send_control_text(options[:textctrl_password], password)
      login_win.click_button("OK")
    end
802156
function (event) {
            if (this._subTplModuleCtrl) {
                if (!event.isSpecialKey && event.charCode != event.KC_SPACE) {
                    this.sendKey(event);
                }
            }
        }
298061
def handle_user_input
      while true
        begin
          break if !wait_for_prompt
          input = $stdin.gets.chomp!
          execute_action(input, true)
        rescue SignalException => e
          return false
        end
      end
      wait
    end
900952
def authenticationReject():
    """"""
    a = TpPd(pd=0x5)
    b = MessageType(mesType=0x11)  # 00010001
    packet = a / b
    return packet
1011654
function (event) {
            var browser = ariaCoreBrowser;
            if (browser.isAndroid && browser.isChrome && !event.isSpecialKey && event.keyCode == 229) {
                event.charCode = 0;
                this._handleKey(event);
            }
            this.$TextInput._dom_onkeyup.call(this, event);
        }
130760
public void authenticate(AuthenticationProtocol authentication,
			String servicename) throws SshException, AuthenticationResult {

		ByteArrayWriter baw = new ByteArrayWriter();

		try {
			if (getPublicKey() == null) {
				throw new SshException("Public key not set!",
						SshException.BAD_API_USAGE);
			}
			if ((getPrivateKey() == null && generator == null)
					&& isAuthenticating()) {
				throw new SshException(
						"Private key or signature generator not set!",
						SshException.BAD_API_USAGE);
			}
			if (getUsername() == null) {
				throw new SshException("Username not set!",
						SshException.BAD_API_USAGE);
			}

			// Generate the data to sign

			baw.writeBinaryString(authentication.getSessionIdentifier());
			baw.write(AuthenticationProtocol.SSH_MSG_USERAUTH_REQUEST);
			baw.writeString(getUsername());
			baw.writeString(servicename);
			baw.writeString("publickey");
			baw.writeBoolean(isAuthenticating());

			byte[] encoded;

			/**
			 * Try an SSH1 key over SSH2, not sure whether this actually works
			 * in practice but it stops the authentication from falling over
			 * with EOFException and allows a normal failure.
			 */
			try {
				if (getPublicKey() instanceof SshRsaPublicKey
						&& ((SshRsaPublicKey) getPublicKey()).getVersion() == 1) {

					SshRsaPublicKey pk = (SshRsaPublicKey) getPublicKey();
					baw.writeString("ssh-rsa");
					ByteArrayWriter baw2 = new ByteArrayWriter();

					try {
						baw2.writeString("ssh-rsa");
						baw2.writeBigInteger(pk.getPublicExponent());
						baw2.writeBigInteger(pk.getModulus());

						baw.writeBinaryString(encoded = baw2.toByteArray());
					} finally {
						baw2.close();
					}
				} else {
					baw.writeString(getPublicKey().getAlgorithm());
					baw.writeBinaryString(encoded = getPublicKey().getEncoded());
				}
			} catch (Throwable t) {
				throw new SshException("Unsupported public key type "
						+ getPublicKey().getAlgorithm(),
						SshException.BAD_API_USAGE); // SSHException
			}

			ByteArrayWriter baw2 = new ByteArrayWriter();

			try {
				// Generate the authentication request
				baw2.writeBoolean(isAuthenticating());
				baw2.writeString(getPublicKey().getAlgorithm());
				baw2.writeBinaryString(encoded);

				if (isAuthenticating()) {

					byte[] signature;
					if (generator != null) {
						signature = generator.sign(getPublicKey(),
								baw.toByteArray());
					} else {
						signature = getPrivateKey().sign(baw.toByteArray());
					}
					// Format the signature correctly
					ByteArrayWriter sig = new ByteArrayWriter();

					try {
						sig.writeString(getPublicKey().getAlgorithm());
						sig.writeBinaryString(signature);
						baw2.writeBinaryString(sig.toByteArray());
					} finally {
						sig.close();
					}
				}

				authentication.sendRequest(getUsername(), servicename,
						"publickey", baw2.toByteArray());

				// We need to read the response since we may have password
				// change.
				byte[] response = authentication.readMessage();

				if (response[0] == SSH_MSG_USERAUTH_PK_OK) {
					throw new AuthenticationResult(PUBLIC_KEY_ACCEPTABLE);
				}
				authentication.transport.disconnect(
						TransportProtocol.PROTOCOL_ERROR, "Unexpected message "
								+ response[0] + " received");
				throw new SshException("Unexpected message " + response[0]
						+ " received", SshException.PROTOCOL_VIOLATION);
			} finally {
				baw2.close();
			}
		} catch (IOException ex) {
			throw new SshException(ex, SshException.INTERNAL_ERROR);
		} finally {
			try {
				baw.close();
			} catch (IOException e) {
			}
		}

	}
1223067
function basicLogin(sock, data, cb) {
  if (data && _.isString(data.username) && !_.isEmpty(data.username)) {
    cb && cb(null, data.username);
  } else {
    cb && cb('invalid identifier ' + data);
  }
}
136231
private void handleDone() {
        // Attempt to complete the current token token
        performCompletion();

        // Hide the keyboard
        InputMethodManager imm = (InputMethodManager) getContext().getSystemService(
                Context.INPUT_METHOD_SERVICE);
        if (imm != null) {
            imm.hideSoftInputFromWindow(getWindowToken(), 0);
        }
    }
213550
def validate_user(user,
                  device,
                  token):
    '''
    
    '''
    res = {
            'message': 'User key is invalid',
            'result': False
           }

    parameters = dict()
    parameters['user'] = user
    parameters['token'] = token
    if device:
        parameters['device'] = device

    response = query(function='validate_user',
                     method='POST',
                     header_dict={'Content-Type': 'application/x-www-form-urlencoded'},
                     data=_urlencode(parameters))

    if response['res']:
        if 'message' in response:
            _message = response.get('message', '')
            if 'status' in _message:
                if _message.get('dict', {}).get('status', None) == 1:
                    res['result'] = True
                    res['message'] = 'User key is valid.'
                else:
                    res['result'] = False
                    res['message'] = ''.join(_message.get('dict', {}).get('errors'))
    return res
208622
function( key, character, shiftKey, altKey, ctrlKey, metaKey )
        {
            // submit form on enter-key
            if( interceptenter && key == 13 && ! shiftKey && ! altKey && ! ctrlKey && ! metaKey )
            {
                commands.sync();
                if( interceptenter() )
                {
                    commands.closePopup();
                    return false; // swallow enter
                }
            }
            // Exec hotkey (onkeydown because e.g. CTRL+B would oben the bookmarks)
            if( character && !shiftKey && !altKey && ctrlKey && !metaKey )
            {
                var hotkey = character.toLowerCase();
                if( hotkeys[hotkey] )
                {
                    hotkeys[hotkey]();
                    return false; // prevent default
                }
            }
            // Handle suggester
            if( suggester )
                return suggester_keydown( key, character, shiftKey, altKey, ctrlKey, metaKey );
        }
1004024
def _authenticate(self, client):
        """"""
        yield client.authenticate(
            self._username, self._password, mechanism=self._auth_mechanism)
        returnValue(client)
571816
def _on_auth(self, sock, authenticated):  # pylint: disable=unused-argument
        """"""
        def ack(eventname, error, data):  # pylint: disable=unused-argument
            """Ack"""
            if error:
                self.log.error(f"""OnAuth: {error}""")
            else:
                self.connect_channels(self.channels)
                self.post_conn_cb()

        sock.emitack("auth", self.creds, ack)
187741
void onConnect(BootstrapServer server) {
        // store selected server
        new BootstrapServerStore().storeSelection(server);

        if (dialog != null) {
            dialog.hide();
            LoadingPanel.get().on();
        }
        String serverUrl = getServerUrl(server);
        context.setSameOrigin(serverUrl.equals(getBaseUrl()));
        if (!serverUrl.endsWith("/")) {
            serverUrl += "/";
        }

        // Trigger authentication using a hidden iframe. This way also Safari will show the login dialog
        setUrls(serverUrl);
        andThen.execute();
    }