From 93743ca834c7896f1abc63e53398941e8ea806b4 Mon Sep 17 00:00:00 2001 From: hengyunabc Date: Mon, 8 Mar 2021 19:02:16 +0800 Subject: [PATCH] update auth.md --- site/src/site/sphinx/auth.md | 14 +++++++++++++- site/src/site/sphinx/en/auth.md | 11 +++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/site/src/site/sphinx/auth.md b/site/src/site/sphinx/auth.md index 07d758df2..f82e43141 100644 --- a/site/src/site/sphinx/auth.md +++ b/site/src/site/sphinx/auth.md @@ -46,6 +46,8 @@ Authentication result: true ### http api验证 + +#### Authorization Header方式(推荐) Arthas 采用的是 HTTP 标准的 Basic Authorization,客户端请求时增加对应的header即可。 * 参考:[https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication) @@ -57,4 +59,14 @@ Arthas 采用的是 HTTP 标准的 Basic Authorization,客户端请求时增 curl 'http://localhost:8563/api' \ -H 'Authorization: Basic YWRtaW46YWRtaW4=' \ --data-raw '{"action":"exec","command":"version"}' -``` \ No newline at end of file +``` + +#### URL 参数传递方式 + +为了方便各种特殊情况,支持了以 parameters 方式传递username和password。比如: + +```bash +curl 'http://localhost:8563/api?password=admin' \ + --data-raw '{"action":"exec","command":"version"}' +``` + diff --git a/site/src/site/sphinx/en/auth.md b/site/src/site/sphinx/en/auth.md index ab98e562a..937e3aa9e 100644 --- a/site/src/site/sphinx/en/auth.md +++ b/site/src/site/sphinx/en/auth.md @@ -45,6 +45,8 @@ After success, you can directly connect to the web console. ### HTTP API Authentication +#### HTTP Authorization Header(recommended) + Arthas uses the HTTP standard Basic Authorization. * Reference: [https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication) @@ -55,4 +57,13 @@ For example, if the user name is: `admin` and the password is `admin`, the combi curl 'http://localhost:8563/api' \ -H 'Authorization: Basic YWRtaW46YWRtaW4=' \ --data-raw '{"action":"exec","command":"version"}' +``` + +#### URL parameters + +It supports passing username and password in parameters. such as: + +```bash +curl 'http://localhost:8563/api?password=admin' \ + --data-raw '{"action":"exec","command":"version"}' ``` \ No newline at end of file