[KYUUBI #6591] Support authorization on swagger UI
# 🔍 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 🔖 - [ ] 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 ⚰️ #### Behavior With This Pull Request 🎉 #### 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 <fwang12@ebay.com> Signed-off-by: Wang, Fei <fwang12@ebay.com>
This commit is contained in:
parent
d643e35310
commit
aaef76cc16
@ -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"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user