Fix: @SecurityScheme in=HEADER — Swagger UI не клал ключ в заголовок #5
@@ -14,6 +14,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
@SecurityScheme(
|
||||
name = OpenApiConfig.SCHEME,
|
||||
type = SecuritySchemeType.APIKEY,
|
||||
in = SecuritySchemeIn.HEADER,
|
||||
paramName = ApiKeyFilter.HEADER,
|
||||
description = "Ключ доступа (свойство сервера wordpdf.api-key, прод — env WORDPDF_API_KEY)")
|
||||
class OpenApiConfig {
|
||||
|
||||
@@ -94,6 +94,7 @@ class ApiKeyFilterTest {
|
||||
mockMvc.perform(get("/v3/api-docs"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.components.securitySchemes.ApiKey.type").value("apiKey"))
|
||||
.andExpect(jsonPath("$.components.securitySchemes.ApiKey.in").value("header"))
|
||||
.andExpect(jsonPath("$.components.securitySchemes.ApiKey.name").value("X-API-Key"));
|
||||
mockMvc.perform(get("/swagger-ui/index.html"))
|
||||
.andExpect(status().isOk());
|
||||
|
||||
Reference in New Issue
Block a user