[KYUUBI #6623] Support bearer token authentication on swagger UI

# 🔍 Description
## Issue References 🔗

This pull request fixes #6623

## Describe Your Solution 🔧

This is a subtask of #6590
Followup of #6591

## 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 #6625 from George314159/swagger.

Closes #6623

d94f950c9 [George314159] retest
7c38c63fb [George314159] Support authorization on swagger UI

Authored-by: George314159 <hua16732@gmail.com>
Signed-off-by: Wang, Fei <fwang12@ebay.com>
This commit is contained in:
George314159 2024-08-16 21:33:45 -07:00 committed by Wang, Fei
parent a4390a785a
commit 0165d5e3a2

View File

@ -105,8 +105,16 @@ class KyuubiOpenApiResource extends BaseOpenApiResource with ApiRequestContext {
"BasicAuth",
new SecurityScheme()
.`type`(SecurityScheme.Type.HTTP)
.scheme("Basic")))
.addSecurityItem(new SecurityRequirement().addList("BasicAuth"))
.scheme("Basic"))
.addSecuritySchemes(
"BearerAuth",
new SecurityScheme()
.`type`(SecurityScheme.Type.HTTP)
.scheme("Bearer")
.bearerFormat("JWT")))
.addSecurityItem(new SecurityRequirement()
.addList("BasicAuth")
.addList("BearerAuth"))
}
}