Skip to content

Commit d78c1e8

Browse files
committed
added [JsonIgnore] attribute to password prop on user entity and removed WithoutPassword() extension methods
1 parent e7df016 commit d78c1e8

File tree

3 files changed

+7
-20
lines changed

3 files changed

+7
-20
lines changed

Entities/User.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using System.Text.Json.Serialization;
2+
13
namespace WebApi.Entities
24
{
35
public class User
@@ -6,7 +8,10 @@ public class User
68
public string FirstName { get; set; }
79
public string LastName { get; set; }
810
public string Username { get; set; }
11+
12+
[JsonIgnore]
913
public string Password { get; set; }
14+
1015
public string Token { get; set; }
1116
}
1217
}

Helpers/ExtensionMethods.cs

Lines changed: 0 additions & 18 deletions
This file was deleted.

Services/UserService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ public User Authenticate(string username, string password)
5555
var token = tokenHandler.CreateToken(tokenDescriptor);
5656
user.Token = tokenHandler.WriteToken(token);
5757

58-
return user.WithoutPassword();
58+
return user;
5959
}
6060

6161
public IEnumerable<User> GetAll()
6262
{
63-
return _users.WithoutPasswords();
63+
return _users;
6464
}
6565
}
6666
}

0 commit comments

Comments
 (0)