Search code examples
c#asp.net-mvcswagger-ui

How to lock swagger ui with login screen to only give access to the API end points to only the Authorised users


how do you lock the swagger ui on the asp.net so that only authenticated users gets to see the API end points.


Solution

  • Swagger does not support user based visuals, if you want to do this you would have to include something in middleware to look for the /swagger url and check for any authenticated sessions.

    Another possible work around can be found here;

    Swashbuckle Hide unreferenced model