mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2025-03-12 16:11:43 +01:00
Currently only contains basic auth definitions to keep it simple stupid. Mostly just following https://swagger.io/docs/specification/v3_0/authentication/basic-authentication/ Document can be printed via new command: openapi print
25 lines
724 B
Rust
25 lines
724 B
Rust
use utoipa::openapi;
|
|
use utoipa::openapi::security::HttpAuthScheme;
|
|
use utoipa::openapi::security::HttpBuilder;
|
|
use utoipa::openapi::security::SecurityScheme;
|
|
use utoipa::Modify;
|
|
|
|
pub(crate) struct SecurityAddon;
|
|
|
|
impl Modify for SecurityAddon {
|
|
fn modify(&self, openapi: &mut openapi::OpenApi) {
|
|
openapi.components = Some(
|
|
utoipa::openapi::ComponentsBuilder::new()
|
|
.security_scheme(
|
|
"basicAuth",
|
|
SecurityScheme::Http(
|
|
HttpBuilder::new()
|
|
.scheme(HttpAuthScheme::Basic)
|
|
.build(),
|
|
),
|
|
)
|
|
.build(),
|
|
)
|
|
}
|
|
}
|