From 0648340c09196cbf3112ead328a76a4ab908e147 Mon Sep 17 00:00:00 2001 From: "Johnny.Ratton" Date: Thu, 21 Mar 2024 11:22:34 +0100 Subject: [PATCH] =?UTF-8?q?Changement=20de=20l'algorithme=20de=20hashage?= =?UTF-8?q?=20de=20mot=20de=20passe=20pour=20correspondre=20=C3=A0=20celui?= =?UTF-8?q?=20utilis=C3=A9=20en=20PHP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StubbedContextLib/StubbedContext.cs | 26 ++++++++++++------- .../StubbedContextLib.csproj | 1 + 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/API_SQLuedo/StubbedContextLib/StubbedContext.cs b/API_SQLuedo/StubbedContextLib/StubbedContext.cs index aca9691..b015ebc 100644 --- a/API_SQLuedo/StubbedContextLib/StubbedContext.cs +++ b/API_SQLuedo/StubbedContextLib/StubbedContext.cs @@ -1,5 +1,6 @@ using System.Security.Cryptography; using DbContextLib; +using DevOne.Security.Cryptography.BCrypt; using Entities; using Microsoft.AspNetCore.Cryptography.KeyDerivation; using Microsoft.EntityFrameworkCore; @@ -20,12 +21,13 @@ public class StubbedContext : UserDbContext { Id = 1, Username = "johnny", - Password = Convert.ToBase64String(KeyDerivation.Pbkdf2( + /*Password = Convert.ToBase64String(KeyDerivation.Pbkdf2( password: "Motdepasse", salt: RandomNumberGenerator.GetBytes(128 / 8), prf: KeyDerivationPrf.HMACSHA256, iterationCount: 100000, - numBytesRequested: 256 / 8)), + numBytesRequested: 256 / 8)),*/ + Password = BCryptHelper.HashPassword("Motdepasse", BCryptHelper.GenerateSalt()), Email = "Johnny.RATTON@etu.uca.fr", IsAdmin = true }, @@ -33,12 +35,13 @@ public class StubbedContext : UserDbContext { Id = 2, Username = "maxime", - Password = Convert.ToBase64String(KeyDerivation.Pbkdf2( + /*Password = Convert.ToBase64String(KeyDerivation.Pbkdf2( password: "Motdepasse", salt: RandomNumberGenerator.GetBytes(128 / 8), prf: KeyDerivationPrf.HMACSHA256, iterationCount: 100000, - numBytesRequested: 256 / 8)), + numBytesRequested: 256 / 8)),*/ + Password = BCryptHelper.HashPassword("Motdepasse", BCryptHelper.GenerateSalt()), Email = "Maxime.SAPOUNTZIS@etu.uca.fr", IsAdmin = true }, @@ -46,12 +49,13 @@ public class StubbedContext : UserDbContext { Id = 3, Username = "clement", - Password = Convert.ToBase64String(KeyDerivation.Pbkdf2( + /*Password = Convert.ToBase64String(KeyDerivation.Pbkdf2( password: "Motdepasse", salt: RandomNumberGenerator.GetBytes(128 / 8), prf: KeyDerivationPrf.HMACSHA256, iterationCount: 100000, - numBytesRequested: 256 / 8)), + numBytesRequested: 256 / 8)),*/ + Password = BCryptHelper.HashPassword("Motdepasse", BCryptHelper.GenerateSalt()), Email = "Clement.CHIEU@etu.uca.fr", IsAdmin = true }, @@ -59,12 +63,13 @@ public class StubbedContext : UserDbContext { Id = 4, Username = "erwan", - Password = Convert.ToBase64String(KeyDerivation.Pbkdf2( + /*Password = Convert.ToBase64String(KeyDerivation.Pbkdf2( password: "Motdepasse", salt: RandomNumberGenerator.GetBytes(128 / 8), prf: KeyDerivationPrf.HMACSHA256, iterationCount: 100000, - numBytesRequested: 256 / 8)), + numBytesRequested: 256 / 8)),*/ + Password = BCryptHelper.HashPassword("Motdepasse", BCryptHelper.GenerateSalt()), Email = "Erwan.MENAGER@etu.uca.fr", IsAdmin = true }, @@ -72,12 +77,13 @@ public class StubbedContext : UserDbContext { Id = 5, Username = "victor", - Password = Convert.ToBase64String(KeyDerivation.Pbkdf2( + /*Password = Convert.ToBase64String(KeyDerivation.Pbkdf2( password: "Motdepasse", salt: RandomNumberGenerator.GetBytes(128 / 8), prf: KeyDerivationPrf.HMACSHA256, iterationCount: 100000, - numBytesRequested: 256 / 8)), + numBytesRequested: 256 / 8)),*/ + Password = BCryptHelper.HashPassword("Motdepasse", BCryptHelper.GenerateSalt()), Email = "Victor.GABORIT@etu.uca.fr", IsAdmin = true }); diff --git a/API_SQLuedo/StubbedContextLib/StubbedContextLib.csproj b/API_SQLuedo/StubbedContextLib/StubbedContextLib.csproj index c87b24a..8600f45 100644 --- a/API_SQLuedo/StubbedContextLib/StubbedContextLib.csproj +++ b/API_SQLuedo/StubbedContextLib/StubbedContextLib.csproj @@ -11,6 +11,7 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive