WebAPI& ASP.NET Core项目上的IdentityServer [英] WebAPI & IdentityServer on ASP.NET Core Project

查看:174
本文介绍了WebAPI& ASP.NET Core项目上的IdentityServer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.NET Core项目,该项目托管在Azure上,并且有许多注册用户. 我想创建一个移动应用程序,并且需要一个API,该API可提供对相同用户帐户和身份系统的访问. 我发现IdentityServer可以提供帮助,但是我仍然不了解如何在同一项目中将Identityserver与WebAPI一起使用,因为我想为webapi创建一个新项目并允许移动客户端使用存储在数据库中的相同凭据进行身份验证.

I have an ASP.NET Core project which is hosted on Azure and has many registered users. I want to create a mobile app and I need an API which provides access to same users accounts and Identity system. I found out that IdentityServer can help but I still don't understand how to use identityserver with WebAPI in the same project as I want to create a new project for webapi and allow the mobile client to authenticate using the same credentials stored in the database.

谢谢:)

推荐答案

在这种情况下,我认为不必将API(资源)和Identity Server放在同一项目中,您可以将它们分开放置项目.

In this instance I don't believe it should be necessary to have your API (resource) and Identity Server in the same project, you can have them in separate projects.

为了配置Identity Server 4以使其与现有用户存储一起使用,我相信您需要IProfileService的实现-

In order to configure Identity Server 4 to work with your existing user store, I believe you need an implementation of IProfileService - brief comment at the bottom of http://docs.identityserver.io/en/release/quickstarts/3_interactive_login.html?highlight=IProfileService%20 confirms this.

一旦您将Identity Server实例连接到自己的数据存储,就应该能够使用Identity Server实例来保护您的API.有多种方法可以实现这一目标,但是我建议您按照以下快速入门指南进行操作: http://docs.identityserver.io/zh-CN/release/quickstarts/0_overview.html 将为您提供一个很好的示例,说明如何使用Identity Server保护API.

Once you have your Identity Server instance hooked up to your own data store, you should then be able to protect your API with your Identity Server instance. There are a number of ways to achieve this, but I would suggest following the quick starts at http://docs.identityserver.io/en/release/quickstarts/0_overview.html will give you a good example of how to protect an API with Identity Server.

这篇关于WebAPI& ASP.NET Core项目上的IdentityServer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆