英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论