0

I am using swagger UI for my APIs which are pointed to mongo database-1, where I am able to access all the data from my database-1 But I want my swagger UI to access mongo database-2 as I want only authorized people to access my data from database-1, anyone else can access data from database-2

In a nutshell, my swagger UI is open to all, I just want to restrict the access

Authorized will access database-1

Unauthorized will access database-2

I went through some documentations but I don't found them useful,

I am not sure this is even possible, but if it is please help

  • Does this answer your question? [How to configure Spring Security to allow Swagger URL to be accessed without authentication](https://stackoverflow.com/questions/37671125/how-to-configure-spring-security-to-allow-swagger-url-to-be-accessed-without-aut) – Valijon Dec 22 '21 at 10:52
  • Thanks but its a different issue, my concern is related to database I just want to use 2 different databases one for authorized users and one for all other users, So its not answer of my question, though thanks for the efforts @Valijon – Onkar Jadhav Dec 22 '21 at 11:08
  • Swagger UI does not talk to the database directly, it sends requests to your API endpoints. This means you need to change your API code to fetch data from the corresponding database based on whether the request is authenticated or not. – Helen Dec 22 '21 at 11:42
  • Thanks @Helen , Its possible with API code changes I just wanted to look for another ways but if there are not any, I think I have to go with API changes then – Onkar Jadhav Dec 23 '21 at 10:28

0 Answers0