Explorar el Código

[manager]feature:[api, website] support basic auth, digest auth (#60)

tomsun28 hace 3 años
padre
commit
8dd2c1e47f

+ 5 - 1
manager/src/main/resources/define/app/api.yml

@@ -26,6 +26,8 @@ configmap:
     type: 1
   - key: payload
     type: 1
+  - key: authType
+    type: 1
   - key: headers
     type: 3
   - key: params
@@ -69,9 +71,11 @@ metrics:
       # 认证
       authorization:
         # 认证方式: Basic Auth, Digest Auth, Bearer Token
-        type: Basic Auth
+        type: ^_^authType^_^
         basicAuthUsername: ^_^username^_^
         basicAuthPassword: ^_^password^_^
+        digestAuthUsername: ^_^username^_^
+        digestAuthPassword: ^_^password^_^
       # 响应数据解析方式: default-系统规则,jsonPath-jsonPath脚本,website-网站可用性指标监控
       # todo xmlPath-xmlPath脚本,prometheus-Prometheus数据规则
       parseType: website

+ 13 - 0
manager/src/main/resources/define/app/website.yml

@@ -12,6 +12,12 @@ configmap:
     type: 1
   - key: ssl
     type: 1
+  - key: authType
+    type: 1
+  - key: username
+    type: 1
+  - key: password
+    type: 2
 # 指标组列表
 metrics:
   # 第一个监控指标组 cpu
@@ -40,6 +46,13 @@ metrics:
       method: GET
       # 是否启用ssl/tls,即是http还是https,默认false
       ssl: ^_^ssl^_^
+      authorization:
+        # 认证方式: Basic Auth, Digest Auth, Bearer Token
+        type: ^_^authType^_^
+        basicAuthUsername: ^_^username^_^
+        basicAuthPassword: ^_^password^_^
+        digestAuthUsername: ^_^username^_^
+        digestAuthPassword: ^_^password^_^
       # 响应数据解析方式: default-系统规则,jsonPath-jsonPath脚本,website-网站可用性指标监控
       # todo xmlPath-xmlPath脚本,prometheus-Prometheus数据规则
       parseType: website

+ 10 - 0
manager/src/main/resources/define/param/api.yml

@@ -65,6 +65,16 @@ param:
     type: textarea
     placeholder: 'POST PUT请求时有效'
     required: false
+  - field: authType
+    name: 认证方式
+    type: radio
+    required: false
+    # 当type为radio单选框,checkbox复选框时,option表示可选项值列表 {name1:value1,name2:value2}
+    options:
+      - label: Basic Auth
+        value: Basic Auth
+      - label: Digest Auth
+        value: Digest Auth
   - field: username
     name: 用户名
     type: text

+ 21 - 1
manager/src/main/resources/define/param/website.yml

@@ -28,4 +28,24 @@ param:
     name: 启用HTTPS
     # 当type为boolean时,前端用switch展示开关
     type: boolean
-    required: true
+    required: true
+  - field: authType
+    name: 认证方式
+    type: radio
+    required: false
+    # 当type为radio单选框,checkbox复选框时,option表示可选项值列表 {name1:value1,name2:value2}
+    options:
+      - label: Basic Auth
+        value: Basic Auth
+      - label: Digest Auth
+        value: Digest Auth
+  - field: username
+    name: 用户名
+    type: text
+    # 当type为text时,用limit表示字符串限制大小
+    limit: 20
+    required: false
+  - field: password
+    name: 密码
+    type: password
+    required: false