tgstation-server 6.17.0
The /tg/station 13 server suite
|
Public Member Functions | |||||||
CryptographySuite (IPasswordHasher< User > passwordHasher) | |||||||
Initializes a new instance of the CryptographySuite class. | |||||||
byte[] | GetSecureBytes (uint amount) | ||||||
Generates a secure set of bytes.
| |||||||
void | SetUserPassword (User user, string newPassword, bool newUser) | ||||||
Sets a User.PasswordHash for a given user .
| |||||||
bool | CheckUserPassword (User user, string password) | ||||||
Checks a given password matches a given user 's User.PasswordHash. This may result in User.PasswordHash being modified and this should be persisted.
| |||||||
string | GetSecureString () | ||||||
Generates a 40-length secure ascii string.
| |||||||
Private Attributes | |
readonly IPasswordHasher< User > | passwordHasher |
The IPasswordHasher<TUser> for the CryptographySuite. | |
Static Private Attributes | |
const uint | SecureStringLength = 30 |
Length in bytes of generated base64 secure string. | |
Definition at line 12 of file CryptographySuite.cs.
Tgstation.Server.Host.Security.CryptographySuite.CryptographySuite | ( | IPasswordHasher< User > | passwordHasher | ) |
Initializes a new instance of the CryptographySuite class.
passwordHasher | The value of passwordHasher. |
Definition at line 28 of file CryptographySuite.cs.
References Tgstation.Server.Host.Security.CryptographySuite.passwordHasher.
bool Tgstation.Server.Host.Security.CryptographySuite.CheckUserPassword | ( | User | user, |
string | password | ||
) |
Checks a given password matches a given user 's User.PasswordHash. This may result in User.PasswordHash being modified and this should be persisted.
user | The User to check. |
password | The password to check. |
true
if password matches the hash, false
otherwise.Implements Tgstation.Server.Host.Security.ICryptographySuite.
Definition at line 53 of file CryptographySuite.cs.
References Tgstation.Server.Host.Models.User.PasswordHash, Tgstation.Server.Host.Security.CryptographySuite.passwordHasher, and Tgstation.Server.Host.Security.CryptographySuite.SetUserPassword().
byte[] Tgstation.Server.Host.Security.CryptographySuite.GetSecureBytes | ( | uint | amount | ) |
Generates a secure set of bytes.
amount | The amount of bytes to generate. |
Implements Tgstation.Server.Host.Security.ICryptographySuite.
Definition at line 34 of file CryptographySuite.cs.
string Tgstation.Server.Host.Security.CryptographySuite.GetSecureString | ( | ) |
Generates a 40-length secure ascii string.
Implements Tgstation.Server.Host.Security.ICryptographySuite.
void Tgstation.Server.Host.Security.CryptographySuite.SetUserPassword | ( | User | user, |
string | newPassword, | ||
bool | newUser | ||
) |
Sets a User.PasswordHash for a given user .
user | The User whos User.PasswordHash is to be set. |
newPassword | The new password for the User. |
newUser | If the user is just being created. |
Implements Tgstation.Server.Host.Security.ICryptographySuite.
Definition at line 43 of file CryptographySuite.cs.
References Tgstation.Server.Host.Security.CryptographySuite.passwordHasher.
Referenced by Tgstation.Server.Host.Security.CryptographySuite.CheckUserPassword().
|
private |
The IPasswordHasher<TUser> for the CryptographySuite.
Definition at line 22 of file CryptographySuite.cs.
Referenced by Tgstation.Server.Host.Security.CryptographySuite.CheckUserPassword(), Tgstation.Server.Host.Security.CryptographySuite.CryptographySuite(), and Tgstation.Server.Host.Security.CryptographySuite.SetUserPassword().
|
staticprivate |
Length in bytes of generated base64 secure string.
Definition at line 17 of file CryptographySuite.cs.