From 877be134d212bfa753649fd32a71471cd2b1dc5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Cottinet?= Date: Wed, 10 Apr 2019 13:55:00 +0200 Subject: [PATCH] auth:checkToken: remove an erroneous and confusing precision (#274) # Description In our `auth:checkToken` documentation there is the following sentence: `This API route does not require the caller to be logged in.` After thinking hard about it I _think_ I understand what it means: "you don't need to have an authentication token active to verify a token". Which should be obvious, since we require the token to be checked to be set in the body part of the request. Moreover, even with a more explicit comment, that would still be confusing, because Kuzzle doesn't give any special treatment to this API route: administrators can remove rights to it to the anonymous role, meaning that you cannot use it without being logged in (or at all). That may sounds weird, but that's how it is. # Other changes - The CI was still referring to the `documentation-v2` repository name, so I fixed that. - The lint check wasn't executed in the CI, which is a mistake - Fixed a linter error to make the CI pass --- .ci/comment.html | 12 +++--- .ci/comment_pr.sh | 2 +- .travis.yml | 37 ++++++++++--------- README.md | 2 +- docker/js | 5 +-- index.js | 2 +- plugins/anchors.js | 2 +- run-snippet-tests.sh | 10 ++--- .../1/controller-auth/check-token/index.md | 12 +++--- .../js/6/auth/check-token/index.md | 2 - 10 files changed, 41 insertions(+), 45 deletions(-) diff --git a/.ci/comment.html b/.ci/comment.html index 00234da65..a2795dad9 100755 --- a/.ci/comment.html +++ b/.ci/comment.html @@ -9,7 +9,7 @@

Snippets tests reports

v6 @@ -29,7 +29,7 @@

Snippets tests reports

v5 @@ -49,7 +49,7 @@

Snippets tests reports

v1 @@ -69,7 +69,7 @@

Snippets tests reports

v1 @@ -89,7 +89,7 @@

Snippets tests reports

v1 @@ -109,7 +109,7 @@

Snippets tests reports

v1 diff --git a/.ci/comment_pr.sh b/.ci/comment_pr.sh index f11274de4..98b03f753 100755 --- a/.ci/comment_pr.sh +++ b/.ci/comment_pr.sh @@ -12,7 +12,7 @@ echo '{"prId": "'"$TRAVIS_PULL_REQUEST"'", "cppv1": "'"$cppv1"'", "javav1": "'"$ docker run --rm -it -v "$(pwd)":/mnt alexandrebouthinon/kuttlefish kuttlefish \ -template /mnt/.ci/comment.html \ -data /mnt/.ci/data.json \ - -repo documentation-v2 \ + -repo documentation \ -owner kuzzleio \ -token $GH_TOKEN\ -id $TRAVIS_PULL_REQUEST diff --git a/.travis.yml b/.travis.yml index 3c76f92e2..ab61a9e43 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,6 +45,7 @@ jobs: script: - npm install + - npm run lint - npm run build after_script: @@ -64,7 +65,7 @@ jobs: - "8" before_install: - - docker pull kuzzleio/documentation-v2:js + - docker pull kuzzleio/documentation:js - sysctl -w vm.max_map_count=262144 script: @@ -75,8 +76,8 @@ jobs: - | if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then mv reports/index.html reports/report.html && aws s3 cp reports/ s3://$REPORT_S3/reports/$TRAVIS_PULL_REQUEST/js/5/ --recursive --exclude "*.gitkeep" - cd .ci && aws s3 cp . s3://$TRAVIS_S3_BUCKET/documentation-v2/$TRAVIS_BUILD_NUMBER --recursive --exclude "*.sh" --exclude "*.html" --exclude "*.yml" --exclude ".gitignore" && cd - - cd .ci && aws s3 sync s3://$TRAVIS_S3_BUCKET/documentation-v2/$TRAVIS_BUILD_NUMBER . && cd - + cd .ci && aws s3 cp . s3://$TRAVIS_S3_BUCKET/documentation/$TRAVIS_BUILD_NUMBER --recursive --exclude "*.sh" --exclude "*.html" --exclude "*.yml" --exclude ".gitignore" && cd - + cd .ci && aws s3 sync s3://$TRAVIS_S3_BUCKET/documentation/$TRAVIS_BUILD_NUMBER . && cd - bash ./.ci/comment_pr.sh fi; @@ -88,7 +89,7 @@ jobs: - "8" before_install: - - docker pull kuzzleio/documentation-v2:js + - docker pull kuzzleio/documentation:js - sysctl -w vm.max_map_count=262144 script: @@ -99,8 +100,8 @@ jobs: - | if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then mv reports/index.html reports/report.html && aws s3 cp reports/ s3://$REPORT_S3/reports/$TRAVIS_PULL_REQUEST/js/6/ --recursive --exclude "*.gitkeep" - cd .ci && aws s3 cp . s3://$TRAVIS_S3_BUCKET/documentation-v2/$TRAVIS_BUILD_NUMBER --recursive --exclude "*.sh" --exclude "*.html" --exclude "*.yml" --exclude ".gitignore" && cd - - cd .ci && aws s3 sync s3://$TRAVIS_S3_BUCKET/documentation-v2/$TRAVIS_BUILD_NUMBER . && cd - + cd .ci && aws s3 cp . s3://$TRAVIS_S3_BUCKET/documentation/$TRAVIS_BUILD_NUMBER --recursive --exclude "*.sh" --exclude "*.html" --exclude "*.yml" --exclude ".gitignore" && cd - + cd .ci && aws s3 sync s3://$TRAVIS_S3_BUCKET/documentation/$TRAVIS_BUILD_NUMBER . && cd - bash ./.ci/comment_pr.sh fi; @@ -112,7 +113,7 @@ jobs: - "8" before_install: - - docker pull kuzzleio/documentation-v2:go + - docker pull kuzzleio/documentation:go - sysctl -w vm.max_map_count=262144 script: @@ -123,8 +124,8 @@ jobs: - | if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then mv reports/index.html reports/report.html && aws s3 cp reports/ s3://$REPORT_S3/reports/$TRAVIS_PULL_REQUEST/go/1/ --recursive --exclude "*.gitkeep" - cd .ci && aws s3 cp . s3://$TRAVIS_S3_BUCKET/documentation-v2/$TRAVIS_BUILD_NUMBER --recursive --exclude "*.sh" --exclude "*.html" --exclude "*.yml" --exclude ".gitignore" && cd - - cd .ci && aws s3 sync s3://$TRAVIS_S3_BUCKET/documentation-v2/$TRAVIS_BUILD_NUMBER . && cd - + cd .ci && aws s3 cp . s3://$TRAVIS_S3_BUCKET/documentation/$TRAVIS_BUILD_NUMBER --recursive --exclude "*.sh" --exclude "*.html" --exclude "*.yml" --exclude ".gitignore" && cd - + cd .ci && aws s3 sync s3://$TRAVIS_S3_BUCKET/documentation/$TRAVIS_BUILD_NUMBER . && cd - bash ./.ci/comment_pr.sh fi; @@ -136,7 +137,7 @@ jobs: - "8" before_install: - - docker pull kuzzleio/documentation-v2:java + - docker pull kuzzleio/documentation:java - sysctl -w vm.max_map_count=262144 script: @@ -147,8 +148,8 @@ jobs: - | if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then mv reports/index.html reports/report.html && aws s3 cp reports/ s3://$REPORT_S3/reports/$TRAVIS_PULL_REQUEST/java/1/ --recursive --exclude "*.gitkeep" - cd .ci && aws s3 cp . s3://$TRAVIS_S3_BUCKET/documentation-v2/$TRAVIS_BUILD_NUMBER --recursive --exclude "*.sh" --exclude "*.html" --exclude "*.yml" --exclude ".gitignore" && cd - - cd .ci && aws s3 sync s3://$TRAVIS_S3_BUCKET/documentation-v2/$TRAVIS_BUILD_NUMBER . && cd - + cd .ci && aws s3 cp . s3://$TRAVIS_S3_BUCKET/documentation/$TRAVIS_BUILD_NUMBER --recursive --exclude "*.sh" --exclude "*.html" --exclude "*.yml" --exclude ".gitignore" && cd - + cd .ci && aws s3 sync s3://$TRAVIS_S3_BUCKET/documentation/$TRAVIS_BUILD_NUMBER . && cd - bash ./.ci/comment_pr.sh fi; @@ -160,7 +161,7 @@ jobs: - "8" before_install: - - docker pull kuzzleio/documentation-v2:cpp + - docker pull kuzzleio/documentation:cpp - sysctl -w vm.max_map_count=262144 script: @@ -171,8 +172,8 @@ jobs: - | if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then mv reports/index.html reports/report.html && aws s3 cp reports/ s3://$REPORT_S3/reports/$TRAVIS_PULL_REQUEST/cpp/1/ --recursive --exclude "*.gitkeep" - cd .ci && aws s3 cp . s3://$TRAVIS_S3_BUCKET/documentation-v2/$TRAVIS_BUILD_NUMBER --recursive --exclude "*.sh" --exclude "*.html" --exclude "*.yml" --exclude ".gitignore" && cd - - cd .ci && aws s3 sync s3://$TRAVIS_S3_BUCKET/documentation-v2/$TRAVIS_BUILD_NUMBER . && cd - + cd .ci && aws s3 cp . s3://$TRAVIS_S3_BUCKET/documentation/$TRAVIS_BUILD_NUMBER --recursive --exclude "*.sh" --exclude "*.html" --exclude "*.yml" --exclude ".gitignore" && cd - + cd .ci && aws s3 sync s3://$TRAVIS_S3_BUCKET/documentation/$TRAVIS_BUILD_NUMBER . && cd - bash ./.ci/comment_pr.sh fi; @@ -184,7 +185,7 @@ jobs: - "8" before_install: - - docker pull kuzzleio/documentation-v2:csharp + - docker pull kuzzleio/documentation:csharp - sysctl -w vm.max_map_count=262144 script: @@ -195,8 +196,8 @@ jobs: - | if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then mv reports/index.html reports/report.html && aws s3 cp reports/ s3://$REPORT_S3/reports/$TRAVIS_PULL_REQUEST/csharp/1/ --recursive --exclude "*.gitkeep" - cd .ci && aws s3 cp . s3://$TRAVIS_S3_BUCKET/documentation-v2/$TRAVIS_BUILD_NUMBER --recursive --exclude "*.sh" --exclude "*.html" --exclude "*.yml" --exclude ".gitignore" && cd - - cd .ci && aws s3 sync s3://$TRAVIS_S3_BUCKET/documentation-v2/$TRAVIS_BUILD_NUMBER . && cd - + cd .ci && aws s3 cp . s3://$TRAVIS_S3_BUCKET/documentation/$TRAVIS_BUILD_NUMBER --recursive --exclude "*.sh" --exclude "*.html" --exclude "*.yml" --exclude ".gitignore" && cd - + cd .ci && aws s3 sync s3://$TRAVIS_S3_BUCKET/documentation/$TRAVIS_BUILD_NUMBER . && cd - bash ./.ci/comment_pr.sh fi; diff --git a/README.md b/README.md index d3d1f0eb0..ba4a1890f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Documentation-V2 +# Documentation ## Usage diff --git a/docker/js b/docker/js index c26a4a8b2..b063ab832 100644 --- a/docker/js +++ b/docker/js @@ -1,4 +1,4 @@ -FROM kuzzleio/puppeteer-light:latest +FROM buildkite/puppeteer:latest RUN apt-get update -y && apt-get install --no-install-recommends -y -q \ curl \ @@ -10,8 +10,7 @@ RUN mkdir /nodejs && curl http://nodejs.org/dist/v8.9.0/node-v8.9.0-linux-x64.ta ENV PATH $PATH:/nodejs/bin - -RUN npm i -g eslint eslint-plugin-import@latest eslint-plugin-node@latest eslint-plugin-promise@latest eslint-plugin-standard@latest +RUN npm i -g eslint eslint-plugin-import@latest eslint-plugin-node@latest eslint-plugin-promise@latest eslint-plugin-standard@latest RUN npm i -g puppeteer mqtt webpack@4.29.5 webpack-cli@3.2.3 html-webpack-plugin@3.2.0 --unsafe-perm=true WORKDIR /app diff --git a/index.js b/index.js index a1194e441..9e3e208a9 100644 --- a/index.js +++ b/index.js @@ -96,7 +96,7 @@ const metalsmith = _metalsmith(__dirname) site_title: 'Kuzzle documentation', site_url: options.build.host, site_base_path: options.build.path, - gh_repo: process.env.TRAVIS_REPO_SLUG || 'kuzzleio/documentation-V2', + gh_repo: process.env.TRAVIS_REPO_SLUG || 'kuzzleio/documentation', gh_branch: process.env.TRAVIS_BRANCH || 'master', algolia_projectId: options.algolia.projectId, algolia_publicKey: options.algolia.publicKey, diff --git a/plugins/anchors.js b/plugins/anchors.js index fe47b03c2..6b875baec 100644 --- a/plugins/anchors.js +++ b/plugins/anchors.js @@ -7,7 +7,7 @@ module.exports = { $ = cheerio.load(data.contents.toString()); $('h1, h2').each((i, el) => { - id = `${$(el) + const id = `${$(el) .text() .replace(/&.*?/g, '') .replace(/\s+/g, '-') diff --git a/run-snippet-tests.sh b/run-snippet-tests.sh index 50f348e41..3a373edcd 100755 --- a/run-snippet-tests.sh +++ b/run-snippet-tests.sh @@ -65,19 +65,19 @@ echo "SDK: $SDK version $SDK_VERSION" case $SDK in js) - docker run -it --name runner_js --rm -e DEV_MODE="$DEV_MODE" -e SDK_VERSION="$SDK_VERSION" -e LANGUAGE="$SDK" --network ci_default --link kuzzle -v "$(pwd)":/app kuzzleio/documentation-v2:js $SDK $SDK_VERSION $TESTS_PATH + docker run -it --name runner_js --rm -e DEV_MODE="$DEV_MODE" -e SDK_VERSION="$SDK_VERSION" -e LANGUAGE="$SDK" --network ci_default --link kuzzle -v "$(pwd)":/app kuzzleio/documentation:js $SDK $SDK_VERSION $TESTS_PATH ;; go) - docker run -it --name runner_go --rm -e DEV_MODE="$DEV_MODE" -e SDK_VERSION="$SDK_VERSION" -e LANGUAGE="$SDK" --network ci_default --link kuzzle -v "$(pwd)":/app -v "$(pwd)"/test/bin:/go/src/github.com/kuzzleio/go-test kuzzleio/documentation-v2:go $SDK $SDK_VERSION $TESTS_PATH + docker run -it --name runner_go --rm -e DEV_MODE="$DEV_MODE" -e SDK_VERSION="$SDK_VERSION" -e LANGUAGE="$SDK" --network ci_default --link kuzzle -v "$(pwd)":/app -v "$(pwd)"/test/bin:/go/src/github.com/kuzzleio/go-test kuzzleio/documentation:go $SDK $SDK_VERSION $TESTS_PATH ;; cpp) - docker run -it --name runner_cpp --rm -e DEV_MODE="$DEV_MODE" -e SDK_VERSION="$SDK_VERSION" -e LANGUAGE="$SDK" --network ci_default --link kuzzle -v "$(pwd)":/app kuzzleio/documentation-v2:cpp $SDK $SDK_VERSION $TESTS_PATH + docker run -it --name runner_cpp --rm -e DEV_MODE="$DEV_MODE" -e SDK_VERSION="$SDK_VERSION" -e LANGUAGE="$SDK" --network ci_default --link kuzzle -v "$(pwd)":/app kuzzleio/documentation:cpp $SDK $SDK_VERSION $TESTS_PATH ;; java) - docker run -it --name runner_java --rm -e DEV_MODE="$DEV_MODE" -e SDK_VERSION="$SDK_VERSION" -e LANGUAGE="$SDK" --network ci_default --link kuzzle -v "$(pwd)":/app kuzzleio/documentation-v2:java $SDK $SDK_VERSION $TESTS_PATH + docker run -it --name runner_java --rm -e DEV_MODE="$DEV_MODE" -e SDK_VERSION="$SDK_VERSION" -e LANGUAGE="$SDK" --network ci_default --link kuzzle -v "$(pwd)":/app kuzzleio/documentation:java $SDK $SDK_VERSION $TESTS_PATH ;; csharp) - docker run -it --name runner_csharp --rm -e DEV_MODE="$DEV_MODE" -e SDK_VERSION="$SDK_VERSION" -e LANGUAGE="$SDK" --network ci_default --link kuzzle -v "$(pwd)":/app kuzzleio/documentation-v2:csharp $SDK $SDK_VERSION $TESTS_PATH + docker run -it --name runner_csharp --rm -e DEV_MODE="$DEV_MODE" -e SDK_VERSION="$SDK_VERSION" -e LANGUAGE="$SDK" --network ci_default --link kuzzle -v "$(pwd)":/app kuzzleio/documentation:csharp $SDK $SDK_VERSION $TESTS_PATH ;; *) echo "$SDK is not a valid sdk" diff --git a/src/api/1/controller-auth/check-token/index.md b/src/api/1/controller-auth/check-token/index.md index 510a6c04a..8eb993530 100644 --- a/src/api/1/controller-auth/check-token/index.md +++ b/src/api/1/controller-auth/check-token/index.md @@ -7,9 +7,7 @@ title: checkToken {{{since "1.0.0"}}} -Checks a JWT validity. - -This API route does not require the caller to be logged in. +Checks the validity of an authentication token. --- @@ -23,7 +21,7 @@ Method: POST Body: ``` -```js +```json { "token": "" } @@ -31,7 +29,7 @@ Body: ### Other protocols -```js +```json { "controller": "auth", "action": "checkToken", @@ -45,7 +43,7 @@ Body: ## Body properties -* `token`: the JWT to be tested +* `token`: the authentication token to be tested --- @@ -59,7 +57,7 @@ The returned result contains the following properties: Example: -```js +```json { "status": 200, "error": null, diff --git a/src/sdk-reference/js/6/auth/check-token/index.md b/src/sdk-reference/js/6/auth/check-token/index.md index 1d55e226b..7a30ede88 100644 --- a/src/sdk-reference/js/6/auth/check-token/index.md +++ b/src/sdk-reference/js/6/auth/check-token/index.md @@ -8,8 +8,6 @@ description: Checks a JWT's validity. Checks a token validity. -This API route does not require the caller to be logged in. -
```javascript