> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ValidateUser

> ABBYY FlexiCapture ユーザー管理 API の ValidateUser メソッドは、ユーザー名とパスワード ハッシュが保存されている認証情報と一致するかどうかを検証します。ハッシュ化のサンプル付きです。

<div id="what-it-does">
  ## 機能
</div>

ユーザー名とパスワードがデータベース内の値と一致するかどうかを確認します。

<div id="definition">
  ## 定義
</div>

```
bool ValidateUser( string userName, string passwordHash );
```

<div id="parameters">
  ## パラメーター
</div>

| **Name**     | **型**  | **説明**     |
| ------------ | ------ | ---------- |
| userName     | string | ユーザー名      |
| passwordHash | 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;
        }
```

<div id="returned-value">
  ## 戻り値
</div>

<table width="100%"><tbody><tr><td><p><strong>型</strong></p></td><td><p><strong>説明</strong></p></td></tr><tr><td><p>bool</p></td><td><ul><li>値が一致する場合は "true"</li><li>それ以外の場合は "false"</li></ul></td></tr></tbody></table>
