Skip to content

Commit

Permalink
For Spring applications, newly added support basic-auth. (#2241)
Browse files Browse the repository at this point in the history
Co-authored-by: Logic <[email protected]>
  • Loading branch information
kerwin612 and zqr10159 authored Jul 8, 2024
1 parent 9a3a2f0 commit a4db859
Show file tree
Hide file tree
Showing 3 changed files with 178 additions and 0 deletions.
66 changes: 66 additions & 0 deletions manager/src/main/resources/define/app-spring_gateway.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,32 @@ params:
required: true
# hide-true or false
hide: true
# field-param field key
- field: username
# name-param field display i18n name
name:
zh-CN: Basic Auth Username
en-US: Basic Auth Username
# type-param field type(most mapping the html input type)
type: text
# when type is text, use limit to limit string length
limit: 50
# required-true or false
required: false
# hide param-true or false
hide: true
# field-param field key
- field: password
# name-param field display i18n name
name:
zh-CN: Basic Auth Password
en-US: Basic Auth Password
# type-param field type(most mapping the html input tag)
type: password
# required-true or false
required: false
# hide param-true or false
hide: true
# collect metrics config list
metrics:
# metrics - available
Expand Down Expand Up @@ -106,6 +132,12 @@ metrics:
method: GET
# enable SSL/TLS, that is, whether it is http or https, the default is false
ssl: ^_^ssl^_^
# http auth
authorization:
# http auth type: Basic Auth, Digest Auth, Bearer Token
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
# http response data parse type: default-hertzbeat rule, jsonpath-jsonpath script, website-api availability monitoring
parseType: default

Expand Down Expand Up @@ -155,6 +187,12 @@ metrics:
method: GET
# enable SSL/TLS, that is, whether it is http or https, the default is false
ssl: ^_^ssl^_^
# http auth
authorization:
# http auth type: Basic Auth, Digest Auth, Bearer Token
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
# http response data parse type: default-hertzbeat rule, jsonpath-jsonpath script, website-api availability monitoring
parseType: jsonPath
# http response data parse script
Expand All @@ -173,6 +211,10 @@ metrics:
url: ^_^base_path^_^/metrics/jvm.threads.states
method: GET
ssl: ^_^ssl^_^
authorization:
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
parseType: jsonPath
parseScript: '$.availableTags[?(@.tag == "state")].values[*]'

Expand All @@ -196,6 +238,10 @@ metrics:
url: ^_^base_path^_^/metrics/jvm.threads.states?tag=state:^o^state^o^
method: GET
ssl: ^_^ssl^_^
authorization:
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
parseType: jsonPath
parseScript: '$'

Expand All @@ -212,6 +258,10 @@ metrics:
url: ^_^base_path^_^/metrics/jvm.memory.used
method: GET
ssl: ^_^ssl^_^
authorization:
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
parseType: jsonPath
parseScript: '$.availableTags[?(@.tag == "id")].values[*]'

Expand All @@ -238,6 +288,10 @@ metrics:
url: ^_^base_path^_^/metrics/jvm.memory.used?tag=id:^o^id^o^
method: GET
ssl: ^_^ssl^_^
authorization:
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
parseType: jsonPath
parseScript: '$'

Expand All @@ -253,6 +307,10 @@ metrics:
url: ^_^base_path^_^/health
method: GET
ssl: ^_^ssl^_^
authorization:
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
parseType: default

- name: route_id
Expand All @@ -268,6 +326,10 @@ metrics:
url: ^_^base_path^_^/gateway/routes
method: GET
ssl: ^_^ssl^_^
authorization:
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
parseType: jsonPath
parseScript: '$[*].route_id'

Expand Down Expand Up @@ -299,5 +361,9 @@ metrics:
url: ^_^base_path^_^/gateway/routes/^o^name^o^
method: GET
ssl: ^_^ssl^_^
authorization:
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
parseType: jsonPath
parseScript: '$'
60 changes: 60 additions & 0 deletions manager/src/main/resources/define/app-springboot2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,32 @@ params:
required: true
# hide-true or false
hide: true
# field-param field key
- field: username
# name-param field display i18n name
name:
zh-CN: Basic Auth Username
en-US: Basic Auth Username
# type-param field type(most mapping the html input type)
type: text
# when type is text, use limit to limit string length
limit: 50
# required-true or false
required: false
# hide param-true or false
hide: true
# field-param field key
- field: password
# name-param field display i18n name
name:
zh-CN: Basic Auth Password
en-US: Basic Auth Password
# type-param field type(most mapping the html input tag)
type: password
# required-true or false
required: false
# hide param-true or false
hide: true
# collect metrics config list
metrics:
# metrics - available
Expand Down Expand Up @@ -106,6 +132,12 @@ metrics:
method: GET
# enable SSL/TLS, that is, whether it is http or https, the default is false
ssl: ^_^ssl^_^
# http auth
authorization:
# http auth type: Basic Auth, Digest Auth, Bearer Token
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
# http response data parse type: default-hertzbeat rule, jsonpath-jsonpath script, website-api availability monitoring
parseType: default
# metrics - environment
Expand Down Expand Up @@ -156,6 +188,12 @@ metrics:
method: GET
# enable SSL/TLS, that is, whether it is http or https, the default is false
ssl: ^_^ssl^_^
# http auth
authorization:
# http auth type: Basic Auth, Digest Auth, Bearer Token
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
# http response data parse type: default-hertzbeat rule, jsonpath-jsonpath script, website-api availability monitoring
parseType: jsonPath
# http response data parse script
Expand All @@ -181,6 +219,12 @@ metrics:
method: GET
# Whether to enable ssl/tls, that is, whether it is http or https, the default is false
ssl: ^_^ssl^_^
# http auth
authorization:
# http auth type: Basic Auth, Digest Auth, Bearer Token
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
# Response data parsing method: default-system rules, jsonPath-jsonPath script, website-api availability monitoring
parseType: jsonPath
parseScript: '$.availableTags[?(@.tag == "state")].values[*]'
Expand All @@ -205,6 +249,10 @@ metrics:
url: ^_^base_path^_^/metrics/jvm.threads.states?tag=state:^o^state^o^
method: GET
ssl: ^_^ssl^_^
authorization:
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
parseType: jsonPath
parseScript: '$'

Expand All @@ -221,6 +269,10 @@ metrics:
url: ^_^base_path^_^/metrics/jvm.memory.used
method: GET
ssl: ^_^ssl^_^
authorization:
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
parseType: jsonPath
parseScript: '$.availableTags[?(@.tag == "id")].values[*]'

Expand All @@ -247,6 +299,10 @@ metrics:
url: ^_^base_path^_^/metrics/jvm.memory.used?tag=id:^o^id^o^
method: GET
ssl: ^_^ssl^_^
authorization:
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
parseType: jsonPath
parseScript: '$'

Expand All @@ -262,5 +318,9 @@ metrics:
url: ^_^base_path^_^/health
method: GET
ssl: ^_^ssl^_^
authorization:
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
successCodes: [200, 503]
parseType: default
52 changes: 52 additions & 0 deletions manager/src/main/resources/define/app-springboot3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,32 @@ params:
required: true
# hide-true or false
hide: true
# field-param field key
- field: username
# name-param field display i18n name
name:
zh-CN: Basic Auth Username
en-US: Basic Auth Username
# type-param field type(most mapping the html input type)
type: text
# when type is text, use limit to limit string length
limit: 50
# required-true or false
required: false
# hide param-true or false
hide: true
# field-param field key
- field: password
# name-param field display i18n name
name:
zh-CN: Basic Auth Password
en-US: Basic Auth Password
# type-param field type(most mapping the html input tag)
type: password
# required-true or false
required: false
# hide param-true or false
hide: true
# collect metrics config list
metrics:
# metrics - available
Expand Down Expand Up @@ -113,6 +139,12 @@ metrics:
method: GET
# enable SSL/TLS, that is, whether it is http or https, the default is false
ssl: ^_^ssl^_^
# http auth
authorization:
# http auth type: Basic Auth, Digest Auth, Bearer Token
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
# http response data parse type: default-hertzbeat rule, jsonpath-jsonpath script, website-api availability monitoring
parseType: default

Expand All @@ -133,6 +165,10 @@ metrics:
url: ^_^base_path^_^/metrics/jvm.threads.states
method: GET
ssl: ^_^ssl^_^
authorization:
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
parseType: jsonPath
parseScript: '$.availableTags[?(@.tag == "state")].values[*]'

Expand Down Expand Up @@ -165,6 +201,10 @@ metrics:
url: ^_^base_path^_^/metrics/jvm.threads.states?tag=state:^o^state^o^
method: GET
ssl: ^_^ssl^_^
authorization:
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
parseType: jsonPath
parseScript: '$'

Expand All @@ -187,6 +227,10 @@ metrics:
url: ^_^base_path^_^/metrics/jvm.memory.used
method: GET
ssl: ^_^ssl^_^
authorization:
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
parseType: jsonPath
parseScript: '$.availableTags[?(@.tag == "id")].values[*]'

Expand Down Expand Up @@ -222,6 +266,10 @@ metrics:
url: ^_^base_path^_^/metrics/jvm.memory.used?tag=id:^o^id^o^
method: GET
ssl: ^_^ssl^_^
authorization:
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
parseType: jsonPath
parseScript: '$'

Expand All @@ -243,4 +291,8 @@ metrics:
url: ^_^base_path^_^/health
method: GET
ssl: ^_^ssl^_^
authorization:
type: Basic Auth
basicAuthUsername: ^_^username^_^
basicAuthPassword: ^_^password^_^
parseType: default

0 comments on commit a4db859

Please sign in to comment.