[comment]: # translation:outdated

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

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

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

`object user.checkAuthentication`

Questo metodo verifica e prolunga la sessione utente.

::: noteimportant
La chiamata del metodo `user.checkAuthentication` utilizzando il parametro `sessionid` prolunga la sessione utente per impostazione predefinita.
:::

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

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

Il metodo accetta i seguenti parametri.

|Parametro|[Type](/manual/api/reference_commentary#data-types)|Descrizione|
|--|--|------|
|extend|boolean|Indica se prolungare la sessione utente.<br><br>Valore predefinito: "true".<br>Impostando il valore su "false" è possibile verificare la sessione utente senza prolungarla.<br><br>[Comportamento del parametro](/manual/api/reference_commentary#parameter-behavior):<br>- *supportato* se `sessionid` è impostato|
|sessionid|string|[Token di autenticazione](/manual/api#authentication) dell'utente.<br><br>[Comportamento del parametro](/manual/api/reference_commentary#parameter-behavior):<br>- *obbligatorio* se `token` non è impostato|
|token|string|[Token API](/manual/api#authentication) dell'utente.<br><br>[Comportamento del parametro](/manual/api/reference_commentary#parameter-behavior):<br>- *obbligatorio* se `sessionid` non è impostato|

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

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

`(object)` Restituisce un oggetto contenente informazioni sull'utente.

Oltre alle [proprietà utente standard](object#user), vengono restituite le seguenti informazioni.

|Proprietà|[Type](/manual/api/reference_commentary#data-types)|Descrizione|
|--|--|------|
|auth\_type|integer|Autenticazione predefinita per l'utente.<br><br>Fare riferimento alla proprietà `authentication_type` dell'[oggetto Authentication](/manual/api/reference/authentication/object#authentication-object) per un elenco dei valori possibili.|
|debug\_mode|integer|Indica se la modalità di debug è abilitata o disabilitata per l'utente.<br><br>Fare riferimento alla proprietà `debug_mode` dell'[oggetto User group](/manual/api/reference/usergroup/object#user-group) per un elenco dei valori possibili.|
|deprovisioned|boolean|Indica se l'utente appartiene a un [gruppo di utenti deprovisioned](/manual/web_interface/frontend_sections/users/authentication#configuration).|
|gui\_access|string|Metodo di autenticazione dell'utente al frontend.<br><br>Fare riferimento alla proprietà `gui_access` dell'[oggetto User group](/manual/api/reference/usergroup/object#user-group) per un elenco dei valori possibili.|
|secret|string|Stringa casuale di 32 caratteri. Viene generata al login dell'utente.<br><br>La proprietà `secret` non viene restituita se la sessione utente viene verificata utilizzando un token API.|
|sessionid|string|Token di autenticazione, che deve essere utilizzato nelle successive richieste API.<br><br>La proprietà `sessionid` non viene restituita se la sessione utente viene verificata utilizzando un token API.|
|type|integer|Tipo di utente.<br><br>Fare riferimento alla proprietà `type` dell'[oggetto Role](/manual/api/reference/role/object#role) per un elenco dei valori possibili.|
|userip|string|Indirizzo IP dell'utente.|

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

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

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

[comment]: # ({ed94544a-d574e685})
##### Verificare l'autenticazione utilizzando il token di autenticazione

Verifica e prolunga una sessione utente utilizzando il token di autenticazione dell'utente e restituisce informazioni aggiuntive sull'utente.

[Request](/manual/api#performing-requests):

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

Risposta:

```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})
##### Verificare l'autenticazione utilizzando il token API

Verificare una sessione utente utilizzando il token API dell'utente e restituire informazioni aggiuntive sull'utente.

[Richiesta](/manual/api#performing-requests):

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

Risposta:

```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})
### Fonte

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

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