具有多层体系结构的ASP.NET身份

时间:2021-02-13 02:10:05

I have a web application into which I would like to utilize asp.net identity. The setup itself within my asp.net MVC project with the provided templates is rather straightforward. However it uses EF in the web "tier". Our company requires us to use a "n" tier architecture approach whereby all data access and business logic is physically separated onto a separate server and all logic is exposed via REST apis. I want to utilize the .net identity framework as it has everything I need but how can i extend it to access the database via a REST api? It appears to be very tightly coupled and I dont see how to separate it out. I have seen similiar questions asked but they lead no where and with no resolution. Any samples or guidance is appreciated.

我有一个Web应用程序,我想利用它的asp.net身份。使用提供的模板在我的asp.net MVC项目中的设置本身非常简单。但是它在Web“层”中使用EF。我们公司要求我们使用“n”层架构方法,将所有数据访问和业务逻辑物理分离到一个单独的服务器上,并通过REST apis公开所有逻辑。我想利用.net身份框架,因为它拥有我需要的一切,但我如何通过REST api扩展它以访问数据库?它看起来非常紧密耦合,我不知道如何将它分开。我已经看到了类似的问题,但他们没有领导,也没有解决方案。任何样品或指导表示赞赏。

1 个解决方案

#1


0  

This is an opinion, but you have three basic sets of functionality in your description.

这是一个意见,但您的描述中有三组基本功能。

  1. UI (MVC, Angular, React)
  2. UI(MVC,Angular,React)

  3. Data Tier (Web API)
  4. 数据层(Web API)

  5. Authentication/Authorization (IdentityServer)

Your front-end (1) authenticates with the id tier (3) and gets back a token with your user claims (Authorization). Front end (1) passes token with request to data tier (2) which checks with id server (3) to make sure token is valid and then services the request.

您的前端(1)使用id层(3)进行身份验证,并使用您的用户声明(授权)获取令牌。前端(1)通过请求将令牌传递给数据层(2),数据层(2)与id服务器(3)进行检查以确保令牌有效,然后为请求提供服务。

Edit: EF would go in the Data tier, just to be Cap'n Obvious.

编辑:EF将进入数据层,只是为了成为Cap'n Obvious。

#1


0  

This is an opinion, but you have three basic sets of functionality in your description.

这是一个意见,但您的描述中有三组基本功能。

  1. UI (MVC, Angular, React)
  2. UI(MVC,Angular,React)

  3. Data Tier (Web API)
  4. 数据层(Web API)

  5. Authentication/Authorization (IdentityServer)

Your front-end (1) authenticates with the id tier (3) and gets back a token with your user claims (Authorization). Front end (1) passes token with request to data tier (2) which checks with id server (3) to make sure token is valid and then services the request.

您的前端(1)使用id层(3)进行身份验证,并使用您的用户声明(授权)获取令牌。前端(1)通过请求将令牌传递给数据层(2),数据层(2)与id服务器(3)进行检查以确保令牌有效,然后为请求提供服务。

Edit: EF would go in the Data tier, just to be Cap'n Obvious.

编辑:EF将进入数据层,只是为了成为Cap'n Obvious。