From a909f8f1a384abcf0ee65c701330fbe46573ed0e Mon Sep 17 00:00:00 2001 From: hengyunabc Date: Thu, 4 Mar 2021 23:34:55 +0800 Subject: [PATCH] update doc. #1655 --- site/src/site/sphinx/auth.md | 11 ++++++++++- site/src/site/sphinx/en/auth.md | 10 +++++++++- site/src/site/sphinx/en/http-api.md | 4 ++++ site/src/site/sphinx/http-api.md | 4 ++++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/site/src/site/sphinx/auth.md b/site/src/site/sphinx/auth.md index b8aeb6206..d67f662a3 100644 --- a/site/src/site/sphinx/auth.md +++ b/site/src/site/sphinx/auth.md @@ -43,4 +43,13 @@ Authentication result: true 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) \ No newline at end of file +* 参考:[https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication) + + +例如,用户名是:`admin`,密码是 `admin`,则组合为字符串: `admin:admin`,base64结果是: `YWRtaW46YWRtaW4='`,则HTTP 请求增加`Authorization` header: + +```bash +curl 'http://localhost:8563/api' \ + -H 'Authorization: Basic YWRtaW46YWRtaW4=' \ + --data-raw '{"action":"exec","command":"version"}' +``` \ No newline at end of file diff --git a/site/src/site/sphinx/en/auth.md b/site/src/site/sphinx/en/auth.md index b50cdcb72..ca932f2fe 100644 --- a/site/src/site/sphinx/en/auth.md +++ b/site/src/site/sphinx/en/auth.md @@ -42,4 +42,12 @@ After success, you can directly connect to the web console. 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) \ No newline at end of file +* Reference: [https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication) + +For example, if the user name is: `admin` and the password is `admin`, the combination is a string: `admin:admin`, the base64 result is: `YWRtaW46YWRtaW4='`, then the HTTP request adds the `Authorization` header: + +```bash +curl 'http://localhost:8563/api' \ + -H 'Authorization: Basic YWRtaW46YWRtaW4=' \ + --data-raw '{"action":"exec","command":"version"}' +``` \ No newline at end of file diff --git a/site/src/site/sphinx/en/http-api.md b/site/src/site/sphinx/en/http-api.md index 4c95844b7..af386f35c 100644 --- a/site/src/site/sphinx/en/http-api.md +++ b/site/src/site/sphinx/en/http-api.md @@ -492,6 +492,10 @@ curl -Ss -XPOST http://localhost:8563/api -d ''' } ``` +### Authentication + +* Reference: [auth](auth.md) + ### Web UI ![](../_static/arthas-web-ui.png "arthas web ui") diff --git a/site/src/site/sphinx/http-api.md b/site/src/site/sphinx/http-api.md index 4ff6e0ece..f092656ee 100644 --- a/site/src/site/sphinx/http-api.md +++ b/site/src/site/sphinx/http-api.md @@ -434,6 +434,10 @@ curl -Ss -XPOST http://localhost:8563/api -d ''' } ``` +### 鉴权 + +参考: [auth](auth.md) + ### Web UI ![](_static/arthas-web-ui.png "arthas web ui")