auth_client
简介
做为客户端接入authserver服务器
组件接口
auth_client.gs
函数原型 | 函数作用 |
---|---|
object create_client(map para) | 创建一个authserver客户端连接对象 |
void start(map para) | 初始化authserver客户端连接对象 |
bool send(string op, map args = ) | 发送指令到authserver服务器,不等待指令处理结果 |
array send_request(string op, map args = , int timeout = DEFAULT_REQUEST_TIMEOUT) | 发送指令到authserver服务器,并且等待指令处理结果 |
mixed auth_token(string type, map args) | 向authserver服务器请求验证token |
void shutdown_auth_server() | 向authserver服务器发送关机指令 |
样例
import pkg.auth_client;
public void sample()
{
map start_para = {
"ip" : "127.0.0.1",
"port" : 5200,
};
object auth_ob = new_object(auth_client, this.get_domain());
defer auth_ob.close();
auth_ob.start(start_para);
map para = {
"account" : "abc",
"password" : "def",
};
let bool success, mixed result = auth_ob.send_request("client_auth_account", para);
if (! success || result["error"])
return;
printf("result=%O\n", result);
}