micronaut-core
micronaut-core copied to clipboard
Micronaut swagger ui not working with micronaut-security dependencies
Expected Behavior
Swagger UI to work.
Actual Behaviour
Swagger UI not working when micronaut security modules added as dependency.
Steps To Reproduce
-
Created a simple app with micronaut jaxrs + swagger. And Swagger UI Working at http://localhost:8080/swagger/views/swagger-ui
-
Now Add micronaut security jwt dependencies.
-
Try mvn mn:run and access swagger ui again. Swagger ui not showing up.
Seems some dependency conflict that prevents jaxrs swagger module getting registered. Hence UI not working.
Environment Information
JDK 11.
Example Application
https://github.com/subash89/public-samples/tree/main/hellojaxrs
Version
3.8.4
probably the UI is locked down and secured hence you can't access it?
@graemerocher In the example application I provided, first thing I did was to get swagger UI working on a simple micronaut cli generated jaxrs project. And I can access the swagger UI without any issue.
Then only thing I just did was add micronaut-security-jwt dependency and annotation processor to the pom. That's it. And swagger ui not showing up.
In this reference project to reproduce the issue https://github.com/subash89/public-samples/tree/main/hellojaxrs You can take out micronaut security dependency and its annotation processor. And swagger ui will come up without any issue on http://localhost:8080/swagger/views/swagger-ui
@graemerocher I just corrected https to http in swagger ui url, which was a typo to make sure if that's what you meant. Looks like a dependency conflict or one overpower the other. Any thoughts?
@graemerocher I corrected something in steps to reproduce from "now" to "not" which I think is the one mislead you. My bad. So issue stands as originally in the subject and above comments.
I'm too this problem. Some return about this issue?
I was able to allow the access by defining these values, especially the intercept-url-map
. The full source code can be found here (application.yaml)
swagger-ui:
enabled: true
micronaut:
openapi:
views:
spec: rapidoc.enabled=true
router:
static-resources:
swagger:
paths: classpath:META-INF/swagger
mapping: /swagger/**
swagger-ui:
paths: classpath:META-INF/swagger/views/swagger-ui
mapping: /swagger-ui/**
intercept-url-map:
- pattern: /swagger/**
http-method: GET
access:
- isAnonymous()
- pattern: /swagger-ui/**
http-method: GET
access:
- isAnonymous()
Documentation about intercept-url-map
Swagger UI working image
@graemerocher You can close it, it's not a bug
@graemerocher ping