【问题标题】:Enabling security for Swagger UI on Service Fabric Web API Services为 Service Fabric Web API 服务上的 Swagger UI 启用安全性
【发布时间】:2017-07-24 14:06:46
【问题描述】:

我们使用以下链接在 Azure Service Fabric 应用程序上启用了 Swagger。 Swagger for Azure Service Fabric Stateless Web API application

但是,我们无法使用 OAuth(Azure AAD 应用程序)保护 Swagger UI。谁能提供一些关于为 Service Fabric 上托管的应用程序启用 Swagger UI 安全性的指导。

非常感谢,Thirumalai M

【问题讨论】:

    标签: azure azure-service-fabric swagger-ui


    【解决方案1】:

    与“普通”应用服务或 IIS 托管的 Web Api 相比,Service Fabric 托管的 Web Api 处理此问题的方式没有任何真正的区别。

    以下文章很好地描述了如何使用 OAuth2 和 IdentityServer3 保护 Swagger UI: http://knowyourtoolset.com/2015/09/secure-web-apis-with-swagger-swashbuckle-and-oauth2-part-4/

    【讨论】:

    • 嗨。感谢您的回复。我遵循了该文件并提及了其他一些文件。我可以看到“可用授权”弹出窗口出现,并且 AAD 成功进行了身份验证。但是在身份验证之后,我看不到为身份验证而打开的浏览器关闭,并且令牌大摇大摆地回来了。我在浏览器选项卡中看到以下 url 用于身份验证,然后没有令牌返回到 swagger - [https://localhost:444/swagger/ui/o2c-html#access_token=&token_type=Bearer&expires_in=3599&state =oauth2&session_state=]
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-22
    • 2017-03-26
    • 1970-01-01
    • 2016-05-29
    • 2012-10-28
    • 2020-11-29
    相关资源
    最近更新 更多