Skip to content

feat: add authorize to UserProvider trait#879

Merged
sunng87 merged 17 commits intoGreptimeTeam:developfrom
shuiyisong:feat/schema_validator
Jan 18, 2023
Merged

feat: add authorize to UserProvider trait#879
sunng87 merged 17 commits intoGreptimeTeam:developfrom
shuiyisong:feat/schema_validator

Conversation

@shuiyisong
Copy link
Copy Markdown
Contributor

@shuiyisong shuiyisong commented Jan 16, 2023

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

  • change method name from auth to authenticate in UserProvider
  • add authorize method to UserProvider to check user request's access permission to database(framework logic, no implementation yet)
  • extract MysqlRuntimeOption to aggregate mysql pass-through options
  • BREAK: rename database to db in http's SqlQuery to better align with InfluxDB and promethues
  • add and modify necessary unit test

todo

  • rename UserProvider

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.

Refer to a related PR or issue link (optional)

Comment thread src/servers/src/http.rs Outdated
Comment thread src/servers/src/http/authorize.rs Outdated
Comment thread src/servers/src/http/authorize.rs Outdated
Comment thread src/servers/src/postgres/auth_handler.rs Outdated
Comment thread src/servers/src/postgres/auth_handler.rs Outdated
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 16, 2023

Codecov Report

Merging #879 (313b8a6) into develop (ecb71f8) will decrease coverage by 0.13%.
The diff coverage is 79.87%.

@@             Coverage Diff             @@
##           develop     #879      +/-   ##
===========================================
- Coverage    86.31%   86.19%   -0.13%     
===========================================
  Files          427      427              
  Lines        57294    57280      -14     
===========================================
- Hits         49456    49371      -85     
- Misses        7838     7909      +71     
Flag Coverage Δ
rust 86.19% <79.87%> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/common/error/src/status_code.rs 100.00% <ø> (ø)
src/frontend/src/frontend.rs 41.17% <0.00%> (+2.28%) ⬆️
src/frontend/src/server.rs 0.00% <0.00%> (ø)
src/servers/src/http.rs 79.26% <ø> (ø)
src/servers/src/auth.rs 44.44% <33.33%> (-26.99%) ⬇️
src/servers/src/auth/user_provider.rs 82.24% <66.66%> (-0.47%) ⬇️
src/servers/src/postgres/auth_handler.rs 87.43% <68.42%> (-3.60%) ⬇️
src/servers/src/mysql/handler.rs 67.18% <83.33%> (+0.52%) ⬆️
src/servers/src/http/authorize.rs 93.86% <90.90%> (-1.06%) ⬇️
src/servers/src/mysql/server.rs 97.00% <96.00%> (+0.03%) ⬆️
... and 16 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@shuiyisong shuiyisong force-pushed the feat/schema_validator branch from ba74393 to 15d87f6 Compare January 17, 2023 02:42
@shuiyisong shuiyisong force-pushed the feat/schema_validator branch from e56bc4f to c60d49a Compare January 17, 2023 03:10
Copy link
Copy Markdown
Contributor

@fengys1996 fengys1996 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sunng87 PTAL content about pg

@shuiyisong shuiyisong changed the title feat: add schema_validator framework to authorize request feat: add authorize to UserProvider trait Jan 17, 2023
@shuiyisong shuiyisong requested a review from fengys1996 January 17, 2023 11:14
Comment thread src/servers/src/postgres/auth_handler.rs Outdated
Comment thread src/servers/src/postgres/auth_handler.rs Outdated
Comment thread src/servers/src/http/authorize.rs Outdated
@sunng87 sunng87 merged commit 6960739 into GreptimeTeam:develop Jan 18, 2023
@shuiyisong shuiyisong deleted the feat/schema_validator branch January 18, 2023 06:03
paomian pushed a commit to paomian/greptimedb that referenced this pull request Oct 19, 2023
* feat: add SchemaValidator

* feat: add schema validator to mysql shim

* chore: pass schema validator to http auth layer

* feat: add schema validator to http

* feat: add schema validator to pg

* feat: add schema validator to pg

* feat: add schema validator test

* chore: remove println in test

* chore: use !matches

* refactor: refac authenticate and authorize in http auth

* refactor: refac authenticate and authorize in http auth

* chore: typo

* chore: minor change

* refactor: merge schema_validator into user_providier

* chore: fix license issue

* refactor: change http query param from database to db

* chore: fix cr issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants