[comment]: # ({43f8bc43-43f8bc43})
# user.checkAuthentication

[comment]: # ({/43f8bc43-43f8bc43})

[comment]: # ({3c28b1f2-a9b9d697})
### 説明

`object user.checkAuthentication`

このメソッドはユーザーセッションをチェックし、延長します。

::: noteimportant
`sessionid`パラメータを使用して`user.checkAuthentication`メソッドを呼び出すと、デフォルトでユーザーセッションが延長されます。
:::

[comment]: # ({/3c28b1f2-a9b9d697})

[comment]: # ({22aef924-49a0b391})
### パラメータ

このメソッドは以下のパラメータを受け付けます。

|パラメータ|[型](/manual/api/reference_commentary#data-types)|説明|
|--|--|------|
|extend|boolean|ユーザーセッションを延長するかどうか。<br><br>デフォルト値: "true"。<br>値を "false" に設定すると、延長せずにユーザーセッションを確認できます。<br><br>[パラメータの動作](/manual/api/reference_commentary#parameter-behavior):<br>- `sessionid` が設定されている場合は *supported*|
|sessionid|string|ユーザーの[認証トークン](/manual/api#authentication)。<br><br>[パラメータの動作](/manual/api/reference_commentary#parameter-behavior):<br>- `token` が設定されていない場合は *required*|
|token|string|ユーザーの[APIトークン](/manual/api#authentication)。<br><br>[パラメータの動作](/manual/api/reference_commentary#parameter-behavior):<br>- `sessionid` が設定されていない場合は *required*|

[comment]: # ({/22aef924-49a0b391})

[comment]: # ({b0d25373-a8544e3e})
### 戻り値

`(object)` ユーザーに関する情報を含むオブジェクトを返します。

[標準のユーザープロパティ](object#user)に加えて、以下の情報が返されます。

|プロパティ|[Type](/manual/api/reference_commentary#data-types)|説明|
|--|--|------|
|auth\_type|integer|ユーザーのデフォルト認証。<br><br>指定可能な値の一覧については、[Authentication object](/manual/api/reference/authentication/object#authentication-object) の `authentication_type` プロパティを参照してください。|
|debug\_mode|integer|ユーザーに対してデバッグモードが有効か無効か。<br><br>指定可能な値の一覧については、[User group object](/manual/api/reference/usergroup/object#user-group) の `debug_mode` プロパティを参照してください。|
|deprovisioned|boolean|ユーザーが[プロビジョニング解除済みユーザーグループ](/manual/web_interface/frontend_sections/users/authentication#configuration)に属しているかどうか。|
|gui\_access|string|ユーザーのWebインターフェースへの認証方法。<br><br>指定可能な値の一覧については、[User group object](/manual/api/reference/usergroup/object#user-group) の `gui_access` プロパティを参照してください。|
|secret|string|32文字のランダムな文字列。ユーザーログイン時に生成されます。<br><br>APIトークンを使用してユーザーセッションを確認する場合、`secret` プロパティは返されません。|
|sessionid|string|認証トークン。以降のAPIリクエストで使用する必要があります。<br><br>APIトークンを使用してユーザーセッションを確認する場合、`sessionid` プロパティは返されません。|
|type|integer|ユーザータイプ。<br><br>指定可能な値の一覧については、[Role object](/manual/api/reference/role/object#role) の `type` プロパティを参照してください。|
|userip|string|ユーザーのIPアドレス。|

[comment]: # ({/b0d25373-a8544e3e})

[comment]: # ({b41637d2-e79e2236})
### 例

[comment]: # ({/b41637d2-e79e2236})

[comment]: # ({ed94544a-d574e685})
##### 認証トークンを使用し認証を確認

ユーザー認証トークンを使用してユーザーセッションを確認し、延長します。また、ユーザーに関する追加情報を返します。

[リクエスト](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "user.checkAuthentication",
    "params": {
        "sessionid": "673b8ba11562a35da902c66cf5c23fa2"
    },
    "id": 1
}
```

Response:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "userid": "1",
        "username": "Admin",
        "name": "Zabbix",
        "surname": "Administrator",
        "url": "",
        "autologin": "1",
        "autologout": "0",
        "lang": "ru_RU",
        "refresh": "0",
        "theme": "default",
        "attempt_failed": "0",
        "attempt_ip": "127.0.0.1",
        "attempt_clock": "1355919038",
        "rows_per_page": "50",
        "timezone": "Europe/Riga",
        "roleid": "3",
        "userdirectoryid": "0",
        "ts_provisioned": "0",
        "type": 3,
        "userip": "127.0.0.1",
        "debug_mode": 0,
        "gui_access": "0",
        "deprovisioned": false,
        "auth_type": 0,
        "sessionid": "673b8ba11562a35da902c66cf5c23fa2",
        "secret": "0e329b933e46984e49a5c1051ecd0751"
    },
    "id": 1
}
```

[comment]: # ({/ed94544a-d574e685})

[comment]: # ({45eaa4f3-698590d0})
##### APIトークンを使用した認証の確認

ユーザーAPIトークンを使用してユーザーセッションを確認し、ユーザーに関する追加情報を返します。

[リクエスト](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "user.checkAuthentication",
    "params": {
        "token": "00aff470e07c12d707e50d98cfe39edef9e6ec349c14728dbdfbc8ddc5ea3eae"
    },
    "id": 1
}
```

レスポンス:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "userid": "1",
        "username": "Admin",
        "name": "Zabbix",
        "surname": "Administrator",
        "url": "",
        "autologin": "1",
        "autologout": "0",
        "lang": "ru_RU",
        "refresh": "0",
        "theme": "default",
        "attempt_failed": "0",
        "attempt_ip": "127.0.0.1",
        "attempt_clock": "1355919338",
        "rows_per_page": "50",
        "timezone": "Europe/Riga",
        "roleid": "3",
        "userdirectoryid": "0",
        "ts_provisioned": "0",
        "debug_mode": 0,
        "deprovisioned": false,
        "gui_access": "1",
        "mfaid": 0,
        "auth_type": 0,
        "type": 3,
        "userip": "127.0.0.1"
    },
    "id": 1
}
```

[comment]: # ({/45eaa4f3-698590d0})

[comment]: # ({e7148ebe-97f5ed87})
### ソース

CUser::checkAuthentication() in *ui/include/classes/api/services/CUser.php*。

[comment]: # ({/e7148ebe-97f5ed87})
