简体   繁体   English

用户模型和 Auth0

[英]User models and Auth0

I am developing an app in Aurelia which has a .net core backend.我正在 Aurelia 开发一个应用程序,它有一个 .net 核心后端。 I have already implemented user Authentication with Auth0 in the frontend.我已经在前端使用 Auth0 实现了用户身份验证。 The problem comes as I am not sure if its good practice to implement a way so that users from auth0 database are linked with my user model in .net core and in my database.问题来了,因为我不确定实施一种方法是否是好的做法,以便 auth0 数据库中的用户在 .net 核心和我的数据库中与我的用户 model 链接。 When a user registers/logs in I can get the corresponding user model from my database.当用户注册/登录时,我可以从我的数据库中获取相应的用户 model。 Basically I would be using the auth0 database jsut for logging in and my database for the user details.基本上,我将使用 auth0 数据库 jsut 进行登录,并使用我的数据库获取用户详细信息。 If it is good practice how should I go around and doing it?如果是好的做法,我应该如何在 go 周围做呢? Is a 'post user registration' action good? “发布用户注册”操作好吗? Any help appreciated:)任何帮助表示赞赏:)

It is a common approach to let the Authentication Service keep only the minimum amount of data it needs to authenticate a user, and then have additional, business-related data in a separate service.一种常见的方法是让身份验证服务只保留对用户进行身份验证所需的最少量数据,然后在单独的服务中拥有额外的与业务相关的数据。 These should be linked upon user registration.这些应该在用户注册时链接。

Note, that if that data in the separate service would be used to perform authorization decisions, then the Authorization Server (Auth0 in your case) should be able to read that data when issuing tokens, and relevant information about the user should end up in the signed token in form of claims.请注意,如果单独服务中的该数据将用于执行授权决策,那么授权服务器(在您的情况下为 Auth0)应该能够在发布令牌时读取该数据,并且有关用户的相关信息应该最终出现在以声明形式签名的令牌。 This gives you the assurance that this data is not tampered with.这使您可以确保这些数据不会被篡改。

Have a look at this article that my colleague wrote: https://curity.io/resources/learn/integrate-identity-business-data/ as it describes in more detail what you need.看看我同事写的这篇文章: https://curity.io/resources/learn/integrate-identity-business-data/ ,因为它更详细地描述了您的需求。

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

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