Base solution for your next web application
Open Closed

Swagger UI publicly available without requiring authentication #11375


User avatar
0
alexanderpilhar created

11.4.0, Angular

I have a question about Swagger UI: On my project I can see Swagger UI is publicly available for everyone... I think I remember it requiring authentication a couple of years ago. When has this been changed? How do I change it back to requiring authentication? Are there any other consequences (like public endpoints also requiring authentication then)?


3 Answer(s)
  • User Avatar
    0
    m.aliozkaya created
    Support Team

    Hi @alexanderpilhar

    It's still requieres authentication.

  • User Avatar
    0
    alexanderpilhar created

    Hi @m.aliozkaya

    It doesn't require authentication on my project (tried using browser's private mode, also tried on phone where I never ever logged in to swagger ui for sure)... I need to figure out why. Any ideas?

    UPDATE

    ~~It does require authentication in development environment - but it does NOT require authentication in production environment...~~

    What I mean is that I can open https://mydomain/swagger/index.html without any authentication / authorization. I want Swagger UI to be available only when authorized.

    This seems to do what i want to achieve: Swagger UI with login form and role-based api visibility

  • User Avatar
    0
    m.aliozkaya created
    Support Team

    Hi @alexanderpilhar

    I created an issue about this. You can follow https://github.com/aspnetzero/aspnet-zero-core/issues/4658