ionic2 - IdentityServer4 - 用户创建

标签 ionic2 ionic3 identityserver4 asp.net-core-2.0

我目前正在使用 ionic2+ 和 .net 核心后端创建网络和移动应用程序。从 identityserver4 文档(包括身份 + Entity Framework )实现快速入门后,我意识到我无法从移动应用程序创建用户。

我的解决方案由以下项目组成:

  • 项目.Api
  • Project.Web
  • 项目.IdentityServer

第三个实现身份,我可以从网络重定向到 identityServer 进行登录和注册。 在 api 中,我已经配置了身份服务器项目的权限,如果我从身份服务器获取 token 并将其附加到我的 http 请求的授权 header ,我就完全能够访问 protected 端点。 但我必须直接在数据库中创建用户。

有没有办法直接在identityServer项目中注册用户?

最佳答案

我建议你实现自己的用户管理,有一些选项可以很容易地与 IdentityServer4 一起使用。

例如,您可以创建自己的用户存储并在 IdentityServer4 中使用它。

这是一个关于如何操作的快速演示。 https://github.com/IdentityServer/IdentityServer4.Quickstart.UI

基本上您需要做的就是:

  • 直接在帐户 Controller 上实现身份验证。

  • 实现 IProfileService 以返回 token 声明

此外,如果您已经熟悉 ASP.NET Identity,IdentityServer 支持它,请查看:

http://docs.identityserver.io/en/latest/reference/aspnet_identity.html

IdentityServer4 还支持 windows 身份验证(如果您想使用您的域用户)并且实现起来非常简单,请查看:

http://docs.identityserver.io/en/latest/topics/windows.html

关于ionic2 - IdentityServer4 - 用户创建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47535521/

相关文章:

ionic-framework - ionic 2中的水平滚动

angular - ionic View 不是已知元素

javascript - 如何在一个请求中上传多个文件?

ionic-framework - Ionic 将图像与 ion-col 底部对齐

android - 使用 ionic-v3 和 cordova 6.3.0 警告 Android API 级别 28

asp.net-core - IdentityServer4,WindowsCryptographicException : The system cannot find the file specified

javascript - 存储网页供离线查看 ionic 3

ionic2 - 我可以取消从我的 Ionic 2 应用程序加载 InAppBrowser Cordova 插件中的 URL 吗?

asp.net-core - 如何在配置文件更新后从 Identity Server 4 刷新声明?

identityserver4 - 更新 IdentityServer4 的客户端数据库