mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-16 19:33:11 +02:00
Fix: Access to Swagger UI when login enabled (#5194)
Fixes for /swagger-ui/index.html & /v1/api-docs endpoints not being accessible when login was enabled. - `UserAuthenticationFilter.isPublicAuthEndpoint()` had gaps in its check, missing `/v1/api-docs` - Refactored `UserAuthenticationFilter` to use `RequestUriUtils.isPublicAuthEndpoint()` instead of its own incorrect method Closes #5125 & #5028 --- ### Testing (if applicable) - [x] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing) for more details.
This commit is contained in:
@@ -62,10 +62,14 @@ public class OpenApiConfig {
|
||||
|
||||
// Add server configuration from environment variable
|
||||
String swaggerServerUrl = System.getenv("SWAGGER_SERVER_URL");
|
||||
Server server;
|
||||
if (swaggerServerUrl != null && !swaggerServerUrl.trim().isEmpty()) {
|
||||
Server server = new Server().url(swaggerServerUrl).description("API Server");
|
||||
openAPI.addServersItem(server);
|
||||
server = new Server().url(swaggerServerUrl).description("API Server");
|
||||
} else {
|
||||
// Use relative path so Swagger uses the current browser origin to avoid CORS issues when accessing via different ports
|
||||
server = new Server().url("/").description("Current Server");
|
||||
}
|
||||
openAPI.addServersItem(server);
|
||||
|
||||
// Add ErrorResponse schema to components
|
||||
Schema<?> errorResponseSchema =
|
||||
|
||||
Reference in New Issue
Block a user