{"action":"created","comment":{"url":"https://api.github.com/repos/arangodb/arangodb/pulls/comments/178552983","pull_request_review_id":108620853,"id":178552983,"diff_hunk":"@@ -114,58 +133,106 @@ void ClientFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {\n     _authentication = true;\n   }\n \n+  if (_askJwtSecret) {\n+    _authentication = false;\n+  }\n+\n   // check timeouts\n   if (_connectionTimeout < 0.0) {\n-    LOG_TOPIC(FATAL, arangodb::Logger::FIXME) << \"invalid value for --server.connect-timeout, must be >= 0\";\n+    LOG_TOPIC(FATAL, arangodb::Logger::FIXME)\n+        << \"invalid value for --server.connect-timeout, must be >= 0\";\n     FATAL_ERROR_EXIT();\n   } else if (_connectionTimeout == 0.0) {\n     _connectionTimeout = LONG_TIMEOUT;\n   }\n \n   if (_requestTimeout < 0.0) {\n-    LOG_TOPIC(FATAL, arangodb::Logger::FIXME) << \"invalid value for --server.request-timeout, must be positive\";\n+    LOG_TOPIC(FATAL, arangodb::Logger::FIXME)\n+        << \"invalid value for --server.request-timeout, must be positive\";\n     FATAL_ERROR_EXIT();\n   } else if (_requestTimeout == 0.0) {\n     _requestTimeout = LONG_TIMEOUT;\n   }\n \n   if (_maxPacketSize < 1 * 1024 * 1024) {\n-    LOG_TOPIC(FATAL, arangodb::Logger::FIXME) << \"invalid value for --server.max-packet-size, must be at least 1 MB\";\n+    LOG_TOPIC(FATAL, arangodb::Logger::FIXME)\n+        << \"invalid value for --server.max-packet-size, must be at least 1 MB\";\n     FATAL_ERROR_EXIT();\n   }\n \n   // username must be non-empty\n   if (_username.empty()) {\n-    LOG_TOPIC(FATAL, arangodb::Logger::FIXME) << \"no value specified for --server.username\";\n+    LOG_TOPIC(FATAL, arangodb::Logger::FIXME)\n+        << \"no value specified for --server.username\";\n     FATAL_ERROR_EXIT();\n   }\n \n   _haveServerPassword = !options->processingResult().touched(\"server.password\");\n \n+  if (_askJwtSecret && options->processingResult().touched(\"server.password\")) {\n+    LOG_TOPIC(FATAL, arangodb::Logger::FIXME)\n+        << \"cannot specify both --server.password and --server.ask-jwt-token\";\n+    FATAL_ERROR_EXIT();\n+  }\n+\n+  if (_askJwtSecret && options->processingResult().touched(\"server.username\")) {\n+    LOG_TOPIC(FATAL, arangodb::Logger::FIXME)\n+        << \"cannot specify both --server.username and --server.ask-jwt-token\";\n+    FATAL_ERROR_EXIT();\n+  }\n+\n   SimpleHttpClientParams::setDefaultMaxPacketSize(_maxPacketSize);\n }\n \n-void ClientFeature::prepare() {\n-  // ask for a password\n-  if (_authentication &&\n-      isEnabled() &&\n-      _haveServerPassword) {\n-    usleep(10 * 1000);\n-\n-    try {\n-      ConsoleFeature* console =\n-          ApplicationServer::getFeature<ConsoleFeature>(\"Console\");\n-\n-      if (console->isEnabled()) {\n-        _password = console->readPassword(\"Please specify a password: \");\n-        return;\n-      }\n-    } catch (...) {\n+void ClientFeature::readPassword() {\n+  usleep(10 * 1000);\n+\n+  try {\n+    ConsoleFeature* console =\n+        ApplicationServer::getFeature<ConsoleFeature>(\"Console\");\n+\n+    if (console->isEnabled()) {\n+      _password = console->readPassword(\"Please specify a password: \");\n+      return;\n     }\n+  } catch (...) {\n+  }\n+\n+  std::cout << \"Please specify a password: \" << std::flush;\n+  _password = ConsoleFeature::readPassword();\n+  std::cout << std::endl << std::flush;\n+}\n \n-    std::cout << \"Please specify a password: \" << std::flush;\n-    _password = ConsoleFeature::readPassword();\n-    std::cout << std::endl << std::flush;\n+void ClientFeature::readJwtSecret() {\n+  usleep(10 * 1000);\n+\n+  try {\n+    ConsoleFeature* console =\n+        ApplicationServer::getFeature<ConsoleFeature>(\"Console\");\n+\n+    if (console->isEnabled()) {\n+      _jwtSecret = console->readPassword(\"Please specify the JWT secret: \");\n+      return;\n+    }\n+  } catch (...) {\n+  }\n+\n+  std::cout << \"Please specify the JWT secret: \" << std::flush;\n+  _password = ConsoleFeature::readPassword();","path":"arangosh/Shell/ClientFeature.cpp","position":201,"original_position":201,"commit_id":"6e062576c046a10c917f5eb5f9431fb60ff31fd7","original_commit_id":"6e062576c046a10c917f5eb5f9431fb60ff31fd7","user":{"login":"jsteemann","id":1423118,"avatar_url":"https://avatars0.githubusercontent.com/u/1423118?v=4","gravatar_id":"","url":"https://api.github.com/users/jsteemann","html_url":"https://github.com/jsteemann","followers_url":"https://api.github.com/users/jsteemann/followers","following_url":"https://api.github.com/users/jsteemann/following{/other_user}","gists_url":"https://api.github.com/users/jsteemann/gists{/gist_id}","starred_url":"https://api.github.com/users/jsteemann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsteemann/subscriptions","organizations_url":"https://api.github.com/users/jsteemann/orgs","repos_url":"https://api.github.com/users/jsteemann/repos","events_url":"https://api.github.com/users/jsteemann/events{/privacy}","received_events_url":"https://api.github.com/users/jsteemann/received_events","type":"User","site_admin":false},"body":"shouldn't this be `_jwtSecret` here instead of `_password`?","created_at":"2018-04-02T14:20:39Z","updated_at":"2018-04-02T14:50:06Z","html_url":"https://github.com/arangodb/arangodb/pull/5004#discussion_r178552983","pull_request_url":"https://api.github.com/repos/arangodb/arangodb/pulls/5004","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/arangodb/arangodb/pulls/comments/178552983"},"html":{"href":"https://github.com/arangodb/arangodb/pull/5004#discussion_r178552983"},"pull_request":{"href":"https://api.github.com/repos/arangodb/arangodb/pulls/5004"}}},"pull_request":{"url":"https://api.github.com/repos/arangodb/arangodb/pulls/5004","id":178745019,"html_url":"https://github.com/arangodb/arangodb/pull/5004","diff_url":"https://github.com/arangodb/arangodb/pull/5004.diff","patch_url":"https://github.com/arangodb/arangodb/pull/5004.patch","issue_url":"https://api.github.com/repos/arangodb/arangodb/issues/5004","number":5004,"state":"open","locked":false,"title":"added --server.ask-jwt-secret to arangosh","user":{"login":"fceller","id":392005,"avatar_url":"https://avatars2.githubusercontent.com/u/392005?v=4","gravatar_id":"","url":"https://api.github.com/users/fceller","html_url":"https://github.com/fceller","followers_url":"https://api.github.com/users/fceller/followers","following_url":"https://api.github.com/users/fceller/following{/other_user}","gists_url":"https://api.github.com/users/fceller/gists{/gist_id}","starred_url":"https://api.github.com/users/fceller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fceller/subscriptions","organizations_url":"https://api.github.com/users/fceller/orgs","repos_url":"https://api.github.com/users/fceller/repos","events_url":"https://api.github.com/users/fceller/events{/privacy}","received_events_url":"https://api.github.com/users/fceller/received_events","type":"User","site_admin":false},"body":"Still missing: tests","created_at":"2018-04-01T20:02:29Z","updated_at":"2018-04-02T14:50:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2e390209b6d6d086a9d8338b577e22d8be15e9c7","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/arangodb/arangodb/pulls/5004/commits","review_comments_url":"https://api.github.com/repos/arangodb/arangodb/pulls/5004/comments","review_comment_url":"https://api.github.com/repos/arangodb/arangodb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/arangodb/arangodb/issues/5004/comments","statuses_url":"https://api.github.com/repos/arangodb/arangodb/statuses/6e062576c046a10c917f5eb5f9431fb60ff31fd7","head":{"label":"arangodb:feature-3.3/allow-jwt-in-arangosh","ref":"feature-3.3/allow-jwt-in-arangosh","sha":"6e062576c046a10c917f5eb5f9431fb60ff31fd7","user":{"login":"arangodb","id":5547849,"avatar_url":"https://avatars0.githubusercontent.com/u/5547849?v=4","gravatar_id":"","url":"https://api.github.com/users/arangodb","html_url":"https://github.com/arangodb","followers_url":"https://api.github.com/users/arangodb/followers","following_url":"https://api.github.com/users/arangodb/following{/other_user}","gists_url":"https://api.github.com/users/arangodb/gists{/gist_id}","starred_url":"https://api.github.com/users/arangodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arangodb/subscriptions","organizations_url":"https://api.github.com/users/arangodb/orgs","repos_url":"https://api.github.com/users/arangodb/repos","events_url":"https://api.github.com/users/arangodb/events{/privacy}","received_events_url":"https://api.github.com/users/arangodb/received_events","type":"Organization","site_admin":false},"repo":{"id":2649214,"name":"arangodb","full_name":"arangodb/arangodb","owner":{"login":"arangodb","id":5547849,"avatar_url":"https://avatars0.githubusercontent.com/u/5547849?v=4","gravatar_id":"","url":"https://api.github.com/users/arangodb","html_url":"https://github.com/arangodb","followers_url":"https://api.github.com/users/arangodb/followers","following_url":"https://api.github.com/users/arangodb/following{/other_user}","gists_url":"https://api.github.com/users/arangodb/gists{/gist_id}","starred_url":"https://api.github.com/users/arangodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arangodb/subscriptions","organizations_url":"https://api.github.com/users/arangodb/orgs","repos_url":"https://api.github.com/users/arangodb/repos","events_url":"https://api.github.com/users/arangodb/events{/privacy}","received_events_url":"https://api.github.com/users/arangodb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/arangodb/arangodb","description":"🥑 ArangoDB is a native multi-model database with flexible data models for documents, graphs, and key-values. Build high performance applications using a convenient SQL-like query language or JavaScript extensions.","fork":false,"url":"https://api.github.com/repos/arangodb/arangodb","forks_url":"https://api.github.com/repos/arangodb/arangodb/forks","keys_url":"https://api.github.com/repos/arangodb/arangodb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/arangodb/arangodb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/arangodb/arangodb/teams","hooks_url":"https://api.github.com/repos/arangodb/arangodb/hooks","issue_events_url":"https://api.github.com/repos/arangodb/arangodb/issues/events{/number}","events_url":"https://api.github.com/repos/arangodb/arangodb/events","assignees_url":"https://api.github.com/repos/arangodb/arangodb/assignees{/user}","branches_url":"https://api.github.com/repos/arangodb/arangodb/branches{/branch}","tags_url":"https://api.github.com/repos/arangodb/arangodb/tags","blobs_url":"https://api.github.com/repos/arangodb/arangodb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/arangodb/arangodb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/arangodb/arangodb/git/refs{/sha}","trees_url":"https://api.github.com/repos/arangodb/arangodb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/arangodb/arangodb/statuses/{sha}","languages_url":"https://api.github.com/repos/arangodb/arangodb/languages","stargazers_url":"https://api.github.com/repos/arangodb/arangodb/stargazers","contributors_url":"https://api.github.com/repos/arangodb/arangodb/contributors","subscribers_url":"https://api.github.com/repos/arangodb/arangodb/subscribers","subscription_url":"https://api.github.com/repos/arangodb/arangodb/subscription","commits_url":"https://api.github.com/repos/arangodb/arangodb/commits{/sha}","git_commits_url":"https://api.github.com/repos/arangodb/arangodb/git/commits{/sha}","comments_url":"https://api.github.com/repos/arangodb/arangodb/comments{/number}","issue_comment_url":"https://api.github.com/repos/arangodb/arangodb/issues/comments{/number}","contents_url":"https://api.github.com/repos/arangodb/arangodb/contents/{+path}","compare_url":"https://api.github.com/repos/arangodb/arangodb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/arangodb/arangodb/merges","archive_url":"https://api.github.com/repos/arangodb/arangodb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/arangodb/arangodb/downloads","issues_url":"https://api.github.com/repos/arangodb/arangodb/issues{/number}","pulls_url":"https://api.github.com/repos/arangodb/arangodb/pulls{/number}","milestones_url":"https://api.github.com/repos/arangodb/arangodb/milestones{/number}","notifications_url":"https://api.github.com/repos/arangodb/arangodb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/arangodb/arangodb/labels{/name}","releases_url":"https://api.github.com/repos/arangodb/arangodb/releases{/id}","deployments_url":"https://api.github.com/repos/arangodb/arangodb/deployments","created_at":"2011-10-26T06:42:00Z","updated_at":"2018-04-02T14:11:58Z","pushed_at":"2018-04-02T14:15:27Z","git_url":"git://github.com/arangodb/arangodb.git","ssh_url":"git@github.com:arangodb/arangodb.git","clone_url":"https://github.com/arangodb/arangodb.git","svn_url":"https://github.com/arangodb/arangodb","homepage":"https://www.arangodb.com","size":815145,"stargazers_count":5406,"watchers_count":5406,"language":"C++","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":406,"mirror_url":null,"archived":false,"open_issues_count":431,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":406,"open_issues":431,"watchers":5406,"default_branch":"devel"}},"base":{"label":"arangodb:3.3","ref":"3.3","sha":"3f737e7648369f305b7f91d27327256071ec5d8a","user":{"login":"arangodb","id":5547849,"avatar_url":"https://avatars0.githubusercontent.com/u/5547849?v=4","gravatar_id":"","url":"https://api.github.com/users/arangodb","html_url":"https://github.com/arangodb","followers_url":"https://api.github.com/users/arangodb/followers","following_url":"https://api.github.com/users/arangodb/following{/other_user}","gists_url":"https://api.github.com/users/arangodb/gists{/gist_id}","starred_url":"https://api.github.com/users/arangodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arangodb/subscriptions","organizations_url":"https://api.github.com/users/arangodb/orgs","repos_url":"https://api.github.com/users/arangodb/repos","events_url":"https://api.github.com/users/arangodb/events{/privacy}","received_events_url":"https://api.github.com/users/arangodb/received_events","type":"Organization","site_admin":false},"repo":{"id":2649214,"name":"arangodb","full_name":"arangodb/arangodb","owner":{"login":"arangodb","id":5547849,"avatar_url":"https://avatars0.githubusercontent.com/u/5547849?v=4","gravatar_id":"","url":"https://api.github.com/users/arangodb","html_url":"https://github.com/arangodb","followers_url":"https://api.github.com/users/arangodb/followers","following_url":"https://api.github.com/users/arangodb/following{/other_user}","gists_url":"https://api.github.com/users/arangodb/gists{/gist_id}","starred_url":"https://api.github.com/users/arangodb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arangodb/subscriptions","organizations_url":"https://api.github.com/users/arangodb/orgs","repos_url":"https://api.github.com/users/arangodb/repos","events_url":"https://api.github.com/users/arangodb/events{/privacy}","received_events_url":"https://api.github.com/users/arangodb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/arangodb/arangodb","description":"🥑 ArangoDB is a native multi-model database with flexible data models for documents, graphs, and key-values. Build high performance applications using a convenient SQL-like query language or JavaScript extensions.","fork":false,"url":"https://api.github.com/repos/arangodb/arangodb","forks_url":"https://api.github.com/repos/arangodb/arangodb/forks","keys_url":"https://api.github.com/repos/arangodb/arangodb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/arangodb/arangodb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/arangodb/arangodb/teams","hooks_url":"https://api.github.com/repos/arangodb/arangodb/hooks","issue_events_url":"https://api.github.com/repos/arangodb/arangodb/issues/events{/number}","events_url":"https://api.github.com/repos/arangodb/arangodb/events","assignees_url":"https://api.github.com/repos/arangodb/arangodb/assignees{/user}","branches_url":"https://api.github.com/repos/arangodb/arangodb/branches{/branch}","tags_url":"https://api.github.com/repos/arangodb/arangodb/tags","blobs_url":"https://api.github.com/repos/arangodb/arangodb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/arangodb/arangodb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/arangodb/arangodb/git/refs{/sha}","trees_url":"https://api.github.com/repos/arangodb/arangodb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/arangodb/arangodb/statuses/{sha}","languages_url":"https://api.github.com/repos/arangodb/arangodb/languages","stargazers_url":"https://api.github.com/repos/arangodb/arangodb/stargazers","contributors_url":"https://api.github.com/repos/arangodb/arangodb/contributors","subscribers_url":"https://api.github.com/repos/arangodb/arangodb/subscribers","subscription_url":"https://api.github.com/repos/arangodb/arangodb/subscription","commits_url":"https://api.github.com/repos/arangodb/arangodb/commits{/sha}","git_commits_url":"https://api.github.com/repos/arangodb/arangodb/git/commits{/sha}","comments_url":"https://api.github.com/repos/arangodb/arangodb/comments{/number}","issue_comment_url":"https://api.github.com/repos/arangodb/arangodb/issues/comments{/number}","contents_url":"https://api.github.com/repos/arangodb/arangodb/contents/{+path}","compare_url":"https://api.github.com/repos/arangodb/arangodb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/arangodb/arangodb/merges","archive_url":"https://api.github.com/repos/arangodb/arangodb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/arangodb/arangodb/downloads","issues_url":"https://api.github.com/repos/arangodb/arangodb/issues{/number}","pulls_url":"https://api.github.com/repos/arangodb/arangodb/pulls{/number}","milestones_url":"https://api.github.com/repos/arangodb/arangodb/milestones{/number}","notifications_url":"https://api.github.com/repos/arangodb/arangodb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/arangodb/arangodb/labels{/name}","releases_url":"https://api.github.com/repos/arangodb/arangodb/releases{/id}","deployments_url":"https://api.github.com/repos/arangodb/arangodb/deployments","created_at":"2011-10-26T06:42:00Z","updated_at":"2018-04-02T14:11:58Z","pushed_at":"2018-04-02T14:15:27Z","git_url":"git://github.com/arangodb/arangodb.git","ssh_url":"git@github.com:arangodb/arangodb.git","clone_url":"https://github.com/arangodb/arangodb.git","svn_url":"https://github.com/arangodb/arangodb","homepage":"https://www.arangodb.com","size":815145,"stargazers_count":5406,"watchers_count":5406,"language":"C++","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":406,"mirror_url":null,"archived":false,"open_issues_count":431,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":406,"open_issues":431,"watchers":5406,"default_branch":"devel"}},"_links":{"self":{"href":"https://api.github.com/repos/arangodb/arangodb/pulls/5004"},"html":{"href":"https://github.com/arangodb/arangodb/pull/5004"},"issue":{"href":"https://api.github.com/repos/arangodb/arangodb/issues/5004"},"comments":{"href":"https://api.github.com/repos/arangodb/arangodb/issues/5004/comments"},"review_comments":{"href":"https://api.github.com/repos/arangodb/arangodb/pulls/5004/comments"},"review_comment":{"href":"https://api.github.com/repos/arangodb/arangodb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/arangodb/arangodb/pulls/5004/commits"},"statuses":{"href":"https://api.github.com/repos/arangodb/arangodb/statuses/6e062576c046a10c917f5eb5f9431fb60ff31fd7"}},"author_association":"OWNER"}}
{"actor":{"display_login":"jsteemann"}}