This is an automated email from the ASF dual-hosted git repository.
feiwang pushed a commit to branch branch-1.9
in repository https://gitbox.apache.org/repos/asf/kyuubi.git
The following commit(s) were added to refs/heads/branch-1.9 by this push:
new 0fbab6568 [KYUUBI #6591] Support authorization on swagger UI
0fbab6568 is described below
commit 0fbab6568d265266b32894afbd1a13bf6bc57db8
Author: Wang, Fei <[email protected]>
AuthorDate: Wed Aug 7 11:27:30 2024 -0700
[KYUUBI #6591] Support authorization on swagger UI
# :mag: Description
## Issue References ๐
Support authorization on swagger UI.
## 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)
- [x] 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 ๐
- [x] This patch was not authored or co-authored using [Generative
Tooling](https://www.apache.org/legal/generative-tooling.html)
**Be nice. Be informative.**
Closes #6591 from turboFei/swagger_auth.
Closes #6591
28010bd99 [Wang, Fei] Support authorization on swagger UI
Authored-by: Wang, Fei <[email protected]>
Signed-off-by: Wang, Fei <[email protected]>
(cherry picked from commit aaef76cc168bf629768e0a3372687fdc210edf59)
Signed-off-by: Wang, Fei <[email protected]>
---
.../apache/kyuubi/server/api/v1/KyuubiOpenApiResource.scala | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git
a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/KyuubiOpenApiResource.scala
b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/KyuubiOpenApiResource.scala
index a8d350114..37025eace 100644
---
a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/KyuubiOpenApiResource.scala
+++
b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/KyuubiOpenApiResource.scala
@@ -28,8 +28,9 @@ import
io.swagger.v3.jaxrs2.integration.JaxrsOpenApiContextBuilder
import io.swagger.v3.jaxrs2.integration.resources.BaseOpenApiResource
import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.integration.api.OpenApiContext
-import io.swagger.v3.oas.models.OpenAPI
+import io.swagger.v3.oas.models.{Components, OpenAPI}
import io.swagger.v3.oas.models.info.{Contact, Info, License}
+import io.swagger.v3.oas.models.security.{SecurityRequirement, SecurityScheme}
import io.swagger.v3.oas.models.servers.Server
import io.swagger.v3.oas.models.tags.Tag
import org.apache.commons.lang3.StringUtils
@@ -99,6 +100,13 @@ class KyuubiOpenApiResource extends BaseOpenApiResource
with ApiRequestContext {
.url("https://www.apache.org/licenses/LICENSE-2.0.txt")))
.tags(List(new Tag().name("Session"), new
Tag().name("Operation")).asJava)
.servers(List(new Server().url(apiUrl)).asJava)
+ .components(Option(openApi.getComponents).getOrElse(new Components())
+ .addSecuritySchemes(
+ "BasicAuth",
+ new SecurityScheme()
+ .`type`(SecurityScheme.Type.HTTP)
+ .scheme("Basic")))
+ .addSecurityItem(new SecurityRequirement().addList("BasicAuth"))
}
}