Skip to content

Instantly share code, notes, and snippets.

@sabljakovich
Created December 30, 2020 00:53
Show Gist options
  • Save sabljakovich/9d9e3f187e4f8dfb65fba4ac3b49d1e2 to your computer and use it in GitHub Desktop.
Save sabljakovich/9d9e3f187e4f8dfb65fba4ac3b49d1e2 to your computer and use it in GitHub Desktop.
Adds basic auth UI to OpenAPI / Swagger docs
@Configuration
@SecurityScheme(
name = "basicAuth", // can be set to anything
type = SecuritySchemeType.HTTP,
scheme = "basic"
)
@OpenAPIDefinition(
info = @Info(title = "Sample API", version = "v1"),
security = @SecurityRequirement(name = "basicAuth") // references the name defined in the line 3
)
class OpenAPIConfiguration {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment