ParaWorld_Auth
It is for client and application to authenticate a user and return or verify a session key.
| Title |
It is for client and application to authenticate a user and return or verify a session key. |
| Author(s) |
LiXizhi |
| Date |
2008/1/21 |
| File |
script/kids/3DMapSystemApp/API/paraworld.auth.lua |
Description
Sample Code
NPL.load("(gl)script/kids/3DMapSystemApp/API/ParaworldAPI.lua");
Member Functions
paraworld.auth.AuthUser
create class
commonlib.setfield("paraworld.auth", {});
[[ Authenticate the user. Never use admin account to login, since the message is
not well encrypted, maybe I should encode the SOAP message body or SOAP header.
User Login
msg = {
"userName" = string, (*)
"password" = string, (*)
"newSession" = boolean 表示是否需要生成一个新的Session key,如果此值为true,表示用户重新登录并获得一个新的Session Key,如果为false或没有值,当该用户的旧Session key有效时,返回旧的Session Key,当旧的Session Key无效时,生成一个新的Session key,默认值为false
}
msg =
{
isSuccess(boolean) 登录是否成功
sessionKey(string) 登录成功后返回当前登录用户的Session Key
userID(string) 当前登录用户的用户ID
[ errorCode ] (int) 错误码。 //错误码。0:无异常 500:未知错误 499:提供的数据不完整 498:非法的访问 407:用户名或密码错误 412:账号未激活 413:账号被锁定
[ info ] (String) 当发生异常或特殊情形下返回的信息
}
]]
syntax
function paraworld.auth.AuthUser()
paraworld.auth.Logout
[[
User logout
msg = {
"sessionKey" = string (*)
}
msg = {
isSuccess(boolean) 登出是否成功
[ errorCode ] int 错误码。 //错误码。0:无异常 500:未知错误 499:提供的数据不完整 498:非法的访问
[ info ] string 结果说明信息,若发生异常或特殊情形下则会有些节点
}
]]
paraworld.CreateRPCWrapper("paraworld.auth.Logout", "http://auth.paraengine.com/Logout.asmx");
syntax
function paraworld.auth.Logout()
paraworld.auth.VerifyUser
[[
在AppDomain验证指定的用户(Session Key)是否是在线状态
msg = {
"sessionKey" = string (*),用户凭证
}
msg =
{
result(boolean) 指定用户是否是在线状态
sessionKey(string) 即主键
userID(string) 用户ID
expireDate(string) 凭证过期时间
[ errorCode ] int 错误码。 //错误码。0:无异常 500:未知错误 499:提供的数据不完整 498:非法的访问
[ info ] (string) 当发生异常时会有此节点
}
]]
paraworld.CreateRPCWrapper("paraworld.auth.VerifyUser", "http://auth.paraengine.com/VerifyUser.asmx");
syntax
function paraworld.auth.VerifyUser()
paraworld.auth.CheckVersion
[[
Check whether a given client version is supported by ParaEngine server. It also returns the latest
client and server version that the website support.
msg={
"op" = ["check"]|[""],
"ClientVersion" = A string returned by the
ParaEngine client using
GetVersion? ()
"ServerVersion" = string.
}
if op == "check" msg = {
ClientVersion? =string, --The latest client version that the server support
ServerVersion? =string, --The latest server version that the server support
UpdateURL? =string, -- The url for manual update
ClientMustUpdate? =bool, -- Whether the client must update in order to use the server
}
else nil
]]
syntax
function paraworld.auth.CheckVersion()
Topic revision: r1 - 2008-02-29 - 15:26:12 -
LiXizhi