Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KYUUBI #6041] RESTful API supports isolated authentication configuration #6042

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

beryllw
Copy link
Contributor

@beryllw beryllw commented Feb 4, 2024

🔍 Description

Issue References 🔗

This pull request fixes #6041

Describe Your Solution 🔧

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Types of changes 🔖

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Test Plan 🧪

Behavior Without This Pull Request ⚰️

Behavior With This Pull Request 🎉

Related Unit Tests


Checklist 📝

Be nice. Be informative.

@@ -797,6 +797,14 @@ object KyuubiConf {
.checkValues(AuthTypes)
.createWithDefault(Seq(AuthTypes.NONE.toString))

val RESTFUL_AUTHENTICATION: ConfigEntry[Boolean] =
buildConf("kyuubi.restful.security.enabled")
Copy link
Member

Choose a reason for hiding this comment

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

such a flag is too crude

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree. Now I just turn off RESTful API authentication. Is there anything else I need to consider or implement?

Copy link
Member

@pan3793 pan3793 Feb 4, 2024

Choose a reason for hiding this comment

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

THRIFT-HTTP and RESTful are different things, your change affects both.

We should make the configuration intuitive

kyuubi.authentication=
// fallback to `kyuubi.authentication` if not configure
kyuubi.frontend.mysql.authentication=
kyuubi.frontend.rest.authentication=

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree 👍. Isolated authentication method configuration is better.

@github-actions github-actions bot added the kind:documentation Documentation is a feature! label Feb 4, 2024
@@ -246,6 +246,7 @@ You can configure the Kyuubi properties in `$KYUUBI_HOME/conf/kyuubi-defaults.co
| kyuubi.frontend.mysql.worker.keepalive.time | PT1M | Time(ms) that an idle async thread of the command execution thread pool will wait for a new task to arrive before terminating in MySQL frontend service | duration | 1.4.0 |
| kyuubi.frontend.protocols | THRIFT_BINARY,REST | A comma-separated list for all frontend protocols <ul> <li>THRIFT_BINARY - HiveServer2 compatible thrift binary protocol.</li> <li>THRIFT_HTTP - HiveServer2 compatible thrift http protocol.</li> <li>REST - Kyuubi defined REST API(experimental).</li> <li>MYSQL - MySQL compatible text protocol(experimental).</li> <li>TRINO - Trino compatible http protocol(experimental).</li> </ul> | seq | 1.4.0 |
| kyuubi.frontend.proxy.http.client.ip.header | X-Real-IP | The HTTP header to record the real client IP address. If your server is behind a load balancer or other proxy, the server will see this load balancer or proxy IP address as the client IP address, to get around this common issue, most load balancers or proxies offer the ability to record the real remote IP address in an HTTP header that will be added to the request for other devices to use. Note that, because the header value can be specified to any IP address, so it will not be used for authentication. | string | 1.6.0 |
| kyuubi.frontend.rest.authentication | NONE | A comma-separated list of client authentication types. It fallback to `kyuubi.authentication` if not configure. | seq | 1.9.0 |
Copy link
Contributor Author

Choose a reason for hiding this comment

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

mysql and other forntend protocols would implement in another PR.

@beryllw beryllw requested a review from pan3793 February 5, 2024 08:09
@beryllw beryllw changed the title [KYUUBI #6041] RESTful API supports isolated authentication eable configuration [KYUUBI #6041] RESTful API supports isolated authentication configuration Feb 6, 2024
@beryllw
Copy link
Contributor Author

beryllw commented Feb 6, 2024

@pan3793 @turboFei cc

@beryllw
Copy link
Contributor Author

beryllw commented Feb 20, 2024

Look like MYSQL, TRINO, THRIFT_BINARY(KyuubiTBinaryFrontendService) and THRIFT_HTTP(KyuubiTHttpFrontendService) are not required to support isolated authentication configuration at this time, so I only support RESTful API.

Not sure if I've missed anything, could you help me review this code? @pan3793 @turboFei cc

@codecov-commenter
Copy link

codecov-commenter commented Feb 20, 2024

Codecov Report

Attention: Patch coverage is 92.50000% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 61.08%. Comparing base (a2179cc) to head (8ab6c16).
Report is 21 commits behind head on master.

Files Patch % Lines
...authentication/AuthenticationProviderFactory.scala 80.00% 0 Missing and 1 partial ⚠️
...che/kyuubi/server/KyuubiTHttpFrontendService.scala 50.00% 0 Missing and 1 partial ⚠️
...ver/http/authentication/AuthenticationFilter.scala 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master    #6042   +/-   ##
=========================================
  Coverage     61.07%   61.08%           
  Complexity       23       23           
=========================================
  Files           623      623           
  Lines         37160    37231   +71     
  Branches       5038     5042    +4     
=========================================
+ Hits          22696    22742   +46     
- Misses        12014    12019    +5     
- Partials       2450     2470   +20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

.version("1.9.0")
.serverOnly
.fallbackConf(AUTHENTICATION_METHOD)

val AUTHENTICATION_CUSTOM_CLASS: OptionalConfigEntry[String] =
buildConf("kyuubi.authentication.custom.class")
Copy link
Member

@pan3793 pan3793 Feb 20, 2024

Choose a reason for hiding this comment

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

should we make it isolated too?

Copy link
Contributor Author

@beryllw beryllw Feb 21, 2024

Choose a reason for hiding this comment

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

agree.

@beryllw
Copy link
Contributor Author

beryllw commented Feb 21, 2024

AUTHENTICATION_METHOD and AUTHENTICATION_CUSTOM_CLASS related to FrontendProtocol, i only support rest api isolated authentication for this time. Other FrontendProtocol also can support, if necessary we can implement it.

@beryllw beryllw requested a review from pan3793 February 22, 2024 09:51
@beryllw
Copy link
Contributor Author

beryllw commented Feb 22, 2024

@pan3793 @turboFei cc

@pan3793
Copy link
Member

pan3793 commented Feb 22, 2024

Have a quick look, overall LGTM.

As many community users request to use Web UI while enabling security on Thrift Binary protocol, would you mind doing a manual test to make sure everything goes well in a such case?

Additionally, if you are interested in the Web UI tech stack, we may want basic authN support for Web UI - that means, when LDAP/JDBC/CUSTOM auth method is configured, pop something like below to allow user login via username and password

image

@beryllw
Copy link
Contributor Author

beryllw commented Feb 23, 2024

As many community users request to use Web UI while enabling security on Thrift Binary protocol, would you mind doing a manual test to make sure everything goes well in a such case?

backported to kyuubi 1.8.0, with following configuration, rest api/v1 and thrift binary authentication test OK.

kyuubi.authentication   KERBEROS
kyuubi.frontend.rest.authentication     NONE
kyuubi.authentication   KERBEROS
kyuubi.frontend.rest.authentication     JDBC

Is there anything else need to do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Improvement] RESTful API supports isolated authentication configuration
3 participants