简体   繁体   English

使用Windows身份验证保护Service Fabric无状态WebAPI端点

[英]Securing the Service Fabric Stateless WebAPI Endpoint with Windows Authentication

I'm planning to use Service Fabric as a cache tool for my web applications. 我打算将Service Fabric用作Web应用程序的缓存工具。

Within Service Fabric, I have: 在Service Fabric中,我有:

  • A stateful application to store my cache objects 一个有状态的应用程序来存储我的缓存对象
  • A stateless WebAPI application to act as an endpoint for other applications to talk to the stateful application. 无状态WebAPI应用程序充当其他应用程序与有状态应用程序对话的端点。 The WebAPI uses OWIN self-host. WebAPI使用OWIN自托管。 ( see screenshot ) 请参见屏幕截图

Both are in the same cluster. 两者都在同一群集中。 The stateless WebAPI will act as an endpoint for exposure. 无状态WebAPI将充当暴露的终结点。 The idea is for my external applications to hit the API to GET/POST/DELETE cache onto the stateful application. 这个想法是让我的外部应用程序点击API以将GET / POST / DELETE缓存缓存到有状态的应用程序上。

I'm trying to secure the WebAPI using Windows Authentication ( see screenshot ) so only users on my domain can call the API. 我正在尝试使用Windows身份验证来保护WebAPI( 请参见屏幕截图 ),因此只有我域中的用户才能调用API。 Is this feature even possible within Service Fabric because I'm not using IIS? 因为我没有使用IIS,所以甚至可以在Service Fabric中使用此功能吗? Should I include something else in the App.config? 我是否应该在App.config中包含其他内容?

<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
  <providers>
    <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientWindowsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" connectionStringName="DefaultConnection" credentialsProvider="" />
  </providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
  <providers>
    <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" connectionStringName="DefaultConnection" />
  </providers>
</roleManager>

You can configure windows authentication in OWIN. 您可以在OWIN中配置Windows身份验证。 Read this . 阅读

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM