-
Notifications
You must be signed in to change notification settings - Fork 919
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[KYUUBI #6041] RESTful API supports isolated authentication enable co…
…nfiguration
- Loading branch information
wangjunbo
committed
Feb 4, 2024
1 parent
a2179cc
commit e0bc999
Showing
3 changed files
with
67 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...ver/src/test/scala/org/apache/kyuubi/operation/KyuubiRestDisableAuthenticationSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.kyuubi.operation | ||
|
||
import javax.servlet.http.HttpServletResponse | ||
|
||
import org.apache.kyuubi.config.KyuubiConf | ||
import org.apache.kyuubi.service.authentication.InternalSecurityAccessor | ||
|
||
class KyuubiRestDisableAuthenticationSuite extends KyuubiRestAuthenticationSuite { | ||
|
||
override protected val otherConfigs: Map[String, String] = { | ||
Map( | ||
KyuubiConf.RESTFUL_AUTHENTICATION.key -> "false", | ||
KyuubiConf.ENGINE_SECURITY_ENABLED.key -> "true", | ||
KyuubiConf.ENGINE_SECURITY_SECRET_PROVIDER.key -> "simple", | ||
KyuubiConf.SIMPLE_SECURITY_SECRET_PROVIDER_PROVIDER_SECRET.key -> "_KYUUBI_REST_", | ||
// allow to impersonate other users with spnego authentication | ||
s"hadoop.proxyuser.$clientPrincipalUser.groups" -> "*", | ||
s"hadoop.proxyuser.$clientPrincipalUser.hosts" -> "*") | ||
} | ||
|
||
override def beforeAll(): Unit = { | ||
super.beforeAll() | ||
InternalSecurityAccessor.initialize(conf, true) | ||
} | ||
|
||
test("test without authorization when disable kyuubi.restful.security.enabled") { | ||
val response = webTarget.path("api/v1/sessions/count") | ||
.request() | ||
.get() | ||
|
||
assert(HttpServletResponse.SC_OK == response.getStatus) | ||
} | ||
} |