新しいユーザーを作成します。
int CreateUser( string userName, string fullName, string password, string email, string tenantName );
| Name | 型 | 説明 |
|---|
| userName | string | ユーザー名 |
| fullName | string | ユーザーのフルネーム |
| password | string | ユーザーパスワードのハッシュ値 |
| email | string | ユーザーのメールアドレス |
| tenantName | string | テナント名 |
パスワード ハッシュを計算するコード例:
public static string GetPasswordHashWithSalt( string login, string password )
{
string salt = GetPasswordSha256Hash(login.ToUpper());
return GetPasswordSha256Hash(password + salt);
}
private static string GetPasswordSha256Hash( string password )
{
Encoding enc = Encoding.GetEncoding("UTF-16");
byte[] buffer = enc.GetBytes(password);
var cryptoTransformSHA256 = new SHA256CryptoServiceProvider();
string hash = BitConverter.ToString(cryptoTransformSHA256.ComputeHash(buffer)).Replace("-", "");
return hash;
}
パスワードが正しく暗号化されているかを確認するための T-SQL コード:
Select Convert( nvarchar(255), HASHBYTES( 'SHA2_256', N'myPassword' + Convert( nvarchar(64), HASHBYTES('SHA2_256', UPPER(name) ), 2) ), 2)