这是原厂英文文档的翻译页面. 欢迎帮助我们 完善文档.

Sidebar

Zabbix Summit 2022
Register for Zabbix Summit 2022

检查认证

描述

object user.checkAuthentication

此方法检查或延长用户会话.

默认情况下调用 user.checkAuthentication 方法会延长用户会话.

参数

此方法接受如下参数.

参数 类型 描述
extend boolean 默认值: "true". 将其值设置为"false"将只会检查会话,不会延长会话有效期. 从 Zabbix 4.0 开始支持.
sessionid string 用户会话ID.

返回值

(object) 返回一个包含用户信息的对象.

示例

请求:

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

响应:

{
           "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",
               "type": 3,
               "sessionid": "673b8ba11562a35da902c66cf5c23fa2"
               "debug_mode": 0,
               "userip": "127.0.0.1",
               "gui_access": 0
           },
           "id": 1
       }

"userData" 参数设置为true,返回的响应和调用 User.login 方法返回相似(区别在于通过会话ID检索用户数据,而不是按照用户名/密码检索).

来源

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