-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathCredential.cs
More file actions
29 lines (25 loc) · 831 Bytes
/
Credential.cs
File metadata and controls
29 lines (25 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
namespace SimpleAuthentication.BasicAuthentication;
/// <summary>
/// Store credentials used for Basic Authentication.
/// </summary>
/// <param name="UserName">The user name</param>
/// <param name="Password">The password</param>
/// <param name="Roles">The list of roles to assign to the user</param>
public record class Credential(string UserName, string Password, IEnumerable<string>? Roles = null)
{
/// <inheritdoc />
public virtual bool Equals(Credential? other)
{
if (other is null)
{
return false;
}
if (ReferenceEquals(this, other))
{
return true;
}
return UserName == other.UserName && Password == other.Password;
}
/// <inheritdoc />
public override int GetHashCode() => HashCode.Combine(UserName, Password);
}