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