Fix: @SecurityScheme in=HEADER — Swagger UI не клал ключ в заголовок #5

Merged
pjandro merged 1 commits from fix/security-scheme-in-header into main 2026-10-16 00:26:30 +03:00
2 changed files with 2 additions and 0 deletions
Showing only changes of commit f83703286c - Show all commits
@@ -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());