身份核心迁移到Java

huangapple go评论66阅读模式
英文:

Identity Core migration to Java

问题

我有一个使用.NET Core制作的Web API项目,我正在使用IdentityCore来进行用户密码注册和登录。然而,我需要将这个API迁移到Java。我如何在不丢失所有用户数据的情况下进行迁移?是否有办法复制IdentityCore使用的算法?

英文:

I have a Web API project made with .net core, I'm using IdentityCore for the user password sign up and log in. However, I need to migrate the API to Java. How can I do it without losing all my user data, is there any way to replicate the algorithm that IdentityCore uses?

答案1

得分: 1

你使用 .net core Identity 时,你的数据被保存在数据库中:https://learn.microsoft.com/en-us/aspnet/core/security/authentication/customize-identity-model?view=aspnetcore-3.1

因此,如果你已经在你的 API 中正确设置了 IdentityCore 授权,那么在你的配置中应该有一个连接字符串,类似这样:

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=(localdb)\\MSSQLLocalDB;Database= IdentityDB;Trusted_Connection=True;MultipleActiveResultSets=true"
  }
}

你可以按照这个配置,提取表和数据,然后就完成了。

源代码可以在这里找到:https://github.com/aspnet/Identity

哈希算法:https://andrewlock.net/exploring-the-asp-net-core-identity-passwordhasher/

ASP.NET Identity 版本 2:PBKDF2 with HMAC-SHA1,128 位盐,256 位子密钥,1000 次迭代

ASP.NET Core Identity 版本 3:PBKDF2 with HMAC-SHA256,128 位盐,256 位子密钥,10000 次迭代

英文:

Your data are saved in a database when you are using .net core Identity: https://learn.microsoft.com/en-us/aspnet/core/security/authentication/customize-identity-model?view=aspnetcore-3.1

So if you have correctly setup the IdentityCore authorization in your api, then there should be a connection string somewhere in your config like this:

{
  "ConnectionStrings": {
    "DefaultConnection": "Server=(localdb)\\MSSQLLocalDB;Database= IdentityDB;Trusted_Connection=True;MultipleActiveResultSets=true"
  }
}

You can follow it, extract the tables and the data and you are set.

The source code can be found here: https://github.com/aspnet/Identity

The hashing algorithms: https://andrewlock.net/exploring-the-asp-net-core-identity-passwordhasher/

> ASP.NET Identity Version 2: PBKDF2 with HMAC-SHA1, 128-bit salt, 256-bit subkey, 1000 iterations
>
> ASP.NET Core Identity Version 3: PBKDF2 with HMAC-SHA256, 128-bit salt, 256-bit subkey, 10000 iterations

huangapple
  • 本文由 发表于 2020年9月20日 13:35:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/63975844.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定