apache / kvrocks-controller

Apache Kvrocks Controller is a cluster management tool for Apache Kvrocks.
https://kvrocks.apache.org/
Apache License 2.0
85 stars 42 forks source link

add api basic auth support #201

Closed ninuxer closed 2 months ago

ninuxer commented 2 months ago

Implement basic auth for api interface base on gin middleware.

Although gin has its own gin.BasicAuth() middleware, but I still implemented it by myself for future expansion.

torwig commented 2 months ago

How to prove that the implementation is correct without tests?

ninuxer commented 2 months ago

I will fix it, thanks

How to prove that the implementation is correct without tests?

ninuxer commented 2 months ago

already fix and commit,my test case see image

codecov-commenter commented 2 months ago

Codecov Report

Attention: Patch coverage is 0% with 81 lines in your changes missing coverage. Please review.

Project coverage is 42.27%. Comparing base (6c56470) to head (6f89f6d). Report is 2 commits behind head on unstable.

Files Patch % Lines
server/middleware/middleware.go 0.00% 39 Missing :warning:
cmd/client/command/client.go 0.00% 7 Missing :warning:
config/config.go 0.00% 5 Missing :warning:
server/route.go 0.00% 5 Missing :warning:
cmd/client/main.go 0.00% 4 Missing :warning:
cmd/client/command/create.go 0.00% 3 Missing :warning:
cmd/client/command/delete.go 0.00% 3 Missing :warning:
cmd/client/command/failover.go 0.00% 3 Missing :warning:
cmd/client/command/get.go 0.00% 3 Missing :warning:
cmd/client/command/import.go 0.00% 3 Missing :warning:
... and 2 more
Additional details and impacted files ```diff @@ Coverage Diff @@ ## unstable #201 +/- ## ============================================ - Coverage 43.38% 42.27% -1.11% ============================================ Files 37 37 Lines 2971 3049 +78 ============================================ Hits 1289 1289 - Misses 1544 1622 +78 Partials 138 138 ``` | [Flag](https://app.codecov.io/gh/apache/kvrocks-controller/pull/201/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/apache/kvrocks-controller/pull/201/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `42.27% <0.00%> (-1.11%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

ninuxer commented 2 months ago

Close the pr as it did not take into account the authentication of the web UI.