swagger-ui.html authentification - maven

I got some java spring-boot existing project.
When I try to go to the swagger-ui.html page, I got a popin asking me my login/password.
Any idea how to disable it? What are the default value?

Related

I just started to run spring boot application and the browser is showing this error

Please explain me what is wrong here, why am I getting this type of error?
error message is : Unable to infer base url. This is common when using dynamic servlet registration or when the API is behind an API Gateway. The base url is the root of where all the swagger resources are served. For e.g. if the api is available at http://example.org/api/v2/api-docs then the base url is http://example.org/api/. Please enter the location manually:
I am new to asking questions in stack overflow , please suggest me on how to structure this question properly
[1]: https://i.stack.imgur.com/wXxnS.png
You forgot to add this annotation, please add this to main class.
#EnableSwagger2

How to hide Models section from swagger UI in spring boot?

I have a spring boot project in which I have integrated the swagger, for API documentation.
Now the problem is by default it is displaying the Models section, which is a security concern. I have tried, but unable to hide it. Also have gone through this link here
How to hide the Models section in Swagger UI?
But in this also, they are refering to some index.html file, but I only have backend with no frontend. So how to achieve the same, please help.
Thanks
Found it, Look at this github link.
https://github.com/eugenp/tutorials/blob/master/spring-boot-modules/spring-boot-mvc/src/main/java/com/baeldung/swagger2boot/configuration/SpringFoxConfig.java

Spring Initializr Error in Intellij Idea and STS on mac os

I have installed Intellij Idea on my macbook. When I going to create a Spring project using Spring Initializr and press "next" button, it prompts an alert window with the heading "Spring Initilizr Error", and with message body -
"Initialisation failed for 'https://start.spring.io'
Please check URL, Network and Proxy settings
Error Message
Cannot download 'https://start.spring.io':
Status 403".
I have used https://start.spring.io as Spring Initializr url, which is being set by default in Intellij Idea. I have also tried the url changing as http://start.spring.io, but it also haven't worked too.
I have tried to use Spring Tool Suit (STS) to create Spring Initializr project and got this message: "IOException: Server returned HTTP response code: 403 for URL: https://start.spring.io".
My network connection is ok and firewall is turned off too. If someone have already faced this issue, please help me with your overcoming steps. I am struggling too much with this problem and wasted enough time with it. Thanks in advance.
press Ctrl+Alt+S and search for proxy. This will show you the proxies you have set for IntelliJ; try to remove or add any.
Remember spring website will block tor.

How to set up a swagger-ui standalone server/application?

I would like to set up a standalone swagger-ui application, to view the different APIs from different servers in one central place.
In a second step I would like to customise swagger-ui to show multiple APIs at once.
I don't want to add swagger-ui to all the servers that provide swagger api-docs though.
To do so I would like to use spring boot and thought this should be an easy task. However, I have trouble getting it to work.
Here is what I did:
Generated a Spring Boot application using https://start.spring.io
included spring-boot-starter-web
added io.springfox:springfox-swagger-ui:2.3.1 dependency
When opening http://localhost:8080/swagger-ui.html I see a 404 error and UI seems broken:
Is there any reason for using Spring-boot instead of a simple web server for this?
See for example here with Nginx, including some basic authentication (pretty old link but still looking alright), or in the ReadMe of the swagger-ui github reposiory directly for easily serving with Connect/gulp-serve inside Docker (the setup can also be reproduced directly without Docker if wanted).
Also I have no idea why you're getting resources requested by the page on a different port... Just ask in case you still need help now on this topic.

How to change url of Swagger SpringMVC UI

I use swagger-springmvc in a spring-boot project and everything works fine but when I add the swagger-spring-mvc-ui dependency to my project, swagger-ui overloads my request mapping for the base url. I'm pretty shure there's a way to point the UI to another url. Does anybody know how to change the default-path of swagger-ui?
You are using old version 0.8.8 which from com.mangofactory
I recommend you to use version 2.3.1 from io.springfox
Note: If you follow the tutorial you can access swagger without having to download Swagger-UI manually
http://localhost:8080/your-app-root/swagger-ui.html
Document Url is now available at
http://localhost:8080/your-app-root/v2/api-docs
You can change document url by specifying a property source in appication.properties file using
springfox.documentation.swagger.v2.path
reference to the changes
spring boot demo
tutorial

Resources