diff --git a/Back/skydiveLogs-api.DomainBusiness/UserService.cs b/Back/skydiveLogs-api.DomainBusiness/UserService.cs index d5c5272..d2b2508 100644 --- a/Back/skydiveLogs-api.DomainBusiness/UserService.cs +++ b/Back/skydiveLogs-api.DomainBusiness/UserService.cs @@ -23,6 +23,11 @@ namespace skydiveLogs_api.DomainBusiness #region Public Methods + /// + /// Adds a new user to the system. + /// + /// The User entity containing the new user data. + /// Whether the new user should have admin privileges. public bool AddNewUser(User newUser, bool isAdmin = false) { newUser.Password = EncryptPassword(newUser.Password); @@ -45,11 +50,22 @@ namespace skydiveLogs_api.DomainBusiness return result; } + /// + /// Retrieves a user by their ID. + /// + /// The user ID to retrieve. + /// A User entity containing the user details. public User GetById(int userId) { return _userRepository.GetById(userId); } + /// + /// Retrieves a user by their login and password. + /// + /// The login name of the user. + /// The password to verify the user. + /// A User entity containing the user details. public User GetByLogin(string login, string password) { return _userRepository.GetByLogin(login, EncryptPassword(password)); @@ -69,7 +85,7 @@ namespace skydiveLogs_api.DomainBusiness { Rfc2898DeriveBytes pdb = new Rfc2898DeriveBytes(encryptionKey, new byte[] { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76 }, - 3, + 3, HashAlgorithmName.SHA256); encryptor.Key = pdb.GetBytes(32); encryptor.IV = pdb.GetBytes(16); @@ -97,4 +113,4 @@ namespace skydiveLogs_api.DomainBusiness #endregion Private Fields } -} \ No newline at end of file +}