pan3793 commented on code in PR #3838:
URL: https://github.com/apache/incubator-kyuubi/pull/3838#discussion_r1035706099
##########
extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/util/AuthZUtils.scala:
##########
@@ -175,4 +190,38 @@ private[authz] object AuthZUtils {
def quote(parts: Seq[String]): String = {
parts.map(quoteIfNeeded).mkString(".")
}
+
+ private def verifyKyuubiSessionUser(spark: SparkContext, user: String): Unit
= {
+ val isSessionUserVerifyEnabled =
+ spark.getConf.getBoolean(s"spark.kyuubi.session.user.sign.enabled",
defaultValue = false)
+ if (isSessionUserVerifyEnabled) {
+ val isVerified = {
+ try {
+ val userPubKeyStr =
spark.getLocalProperty("kyuubi.session.sign.publickey")
+ val userSign = spark.getLocalProperty("kyuubi.session.user.sign")
+ verifySignWithECDSA(user, userSign, userPubKeyStr)
+ } catch {
+ case _: Exception =>
+ false
+ }
+ }
+ if (!isVerified) {
+ throw new AccessControlException(s"Permission denied: user [$user] is
not verified")
+ }
+ }
+ }
+
+ private def verifySignWithECDSA(
+ plainText: String,
+ signature: String,
+ publicKeyStr: String): Boolean = {
Review Comment:
publicKeyBase64
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]