【问题标题】:How can I hide endpoints from Swagger UI in Servicestack?如何在 Servicestack 中隐藏 Swagger UI 的端点?
【发布时间】:2013-10-02 17:27:46
【问题描述】:

我正在为 ServiceStack 3.9.59.0 使用 Swagger 插件。我的 ServiceStack API 中有一些端点,例如 /selfchecknode,我不想在 Swagger UI 中显示。

是否有一种声明方式(可能是通过契约属性),我可以使用它来隐藏特定端点,使其不显示在 Swagger 中?

【问题讨论】:

    标签: servicestack swagger-ui


    【解决方案1】:

    Security docs 展示了如何限制对 ServiceStack 的可见性和访问。因此,您可以通过以下方式将其隐藏起来,使其不可见:

    [Restrict(VisibleInternalOnly = true)]
    public class InternalAdmin { }
    

    【讨论】:

    • 这太棒了,也适用于 Swagger!我相信我的 NGinx 代理与 IIS 在同一个机器上运行,它使请求看起来对 ServiceStack 来说是本地的。
    猜你喜欢
    • 2014-11-26
    • 1970-01-01
    • 2015-02-18
    • 1970-01-01
    • 2019-07-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多