You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by fe...@apache.org on 2024/08/29 21:47:22 UTC
(kyuubi) branch master updated: [KYUUBI #6619][FOLLOWUP] Do not log auth audit log for thrift http cookie auth
This is an automated email from the ASF dual-hosted git repository.
feiwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi.git
The following commit(s) were added to refs/heads/master by this push:
new c9b4512668 [KYUUBI #6619][FOLLOWUP] Do not log auth audit log for thrift http cookie auth
c9b4512668 is described below
commit c9b4512668ab54664aec829746ce8eaef320133e
Author: Wang, Fei <fw...@ebay.com>
AuthorDate: Thu Aug 29 14:47:15 2024 -0700
[KYUUBI #6619][FOLLOWUP] Do not log auth audit log for thrift http cookie auth
# :mag: Description
## Issue References ๐
Follow up for #6619, I found that, there are many duplicate auth audit logs for thrift http.
We shall only log when make authentication with auth handler, and skip it for cookie auth.
## 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 :bookmark:
- [ ] 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 :coffin:
#### Behavior With This Pull Request :tada:
#### Related Unit Tests
---
# Checklist ๐
- [ ] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html)
**Be nice. Be informative.**
Closes #6632 from turboFei/need_to_auth.
Closes #6619
3a25a3dd3 [Wang, Fei] do auth
Authored-by: Wang, Fei <fw...@ebay.com>
Signed-off-by: Wang, Fei <fw...@ebay.com>
---
.../org/apache/kyuubi/server/http/ThriftHttpServlet.scala | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/http/ThriftHttpServlet.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/http/ThriftHttpServlet.scala
index 4df3c427ec..29c50d0a9b 100644
--- a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/http/ThriftHttpServlet.scala
+++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/http/ThriftHttpServlet.scala
@@ -80,6 +80,7 @@ class ThriftHttpServlet(
override def doPost(request: HttpServletRequest, response: HttpServletResponse): Unit = {
var clientUserName: String = null
var requireNewCookie: Boolean = false
+ var doAuth: Boolean = false
try {
if (conf.get(KyuubiConf.FRONTEND_THRIFT_HTTP_XSRF_FILTER_ENABLED)) {
val continueProcessing = doXsrfFilter(request, response)
@@ -111,6 +112,7 @@ class ThriftHttpServlet(
// If the cookie based authentication is not enabled or the request does not have a valid
// cookie, use authentication depending on the server setup.
if (clientUserName == null) {
+ doAuth = true
clientUserName = authenticate(request, response)
}
@@ -143,7 +145,7 @@ class ThriftHttpServlet(
error("Error: ", e)
throw e
} finally {
- AuthenticationAuditLogger.audit(request, response)
+ if (doAuth) AuthenticationAuditLogger.audit(request, response)
AuthenticationFilter.HTTP_CLIENT_USER_NAME.remove()
AuthenticationFilter.HTTP_CLIENT_IP_ADDRESS.remove()
AuthenticationFilter.HTTP_PROXY_HEADER_CLIENT_IP_ADDRESS.remove()
@@ -275,8 +277,10 @@ class ThriftHttpServlet(
private def authenticate(request: HttpServletRequest, response: HttpServletResponse): String = {
val authorization = request.getHeader(AUTHORIZATION_HEADER)
- authenticationFilter.getMatchedHandler(authorization).map(
- _.authenticate(request, response)).orNull
+ authenticationFilter.getMatchedHandler(authorization).map { authHandler =>
+ AuthenticationFilter.HTTP_AUTH_TYPE.set(authHandler.authScheme.toString)
+ authHandler.authenticate(request, response)
+ }.orNull
}
private def getDoAsQueryParam(queryString: String): String = {