unissoft-bj / ihostsvc

system services & data services on ihost
0 stars 0 forks source link

ihost id rest #21

Open unissoft-bj opened 9 years ago

unissoft-bj commented 9 years ago

ihost id

前端向ihost请求ihost id作为cookie指纹 提交参数: 无 返回参数:ihost id

关于ihost id

用mac作为ihost id是否合适?

用eth0的mac,还是wlan0的mac? 最新的板子用ubuntu系统,如果不做设置的话,eth0的mac每次都变一个值

另一种方法:

ihost向iserver注册 提交eth0的mac、wlan0的mac,iserver为ihost分配一个uuid 在iserver上维护和管理ihost的位置、使用者信息 更换ihost时,如果位置、使用者不变,则uuid不变(cookie继续生效) 如果连不到iserver,ihost自己生成一个uuid 此uuid保存在ihost本地,每次前端请求时,发送此uudi到前端

ycyn521 commented 9 years ago

ihost-id作为存贮在cookie中的变量,每次请求的时候都会在“headers”中,如图 qq 20150330231315

所以,s所有存储在cookie中的数据,是不需要提交到rest中的,因为rest可以直接读出来,并且关于指纹或者在服务端需要校验的一些数据,如mac、mac-pwd、phone、phone-pwd等数据可以在服务端直接写入到cookie中,这样做一来可以避免cookie中数据的重复提交、二来cookie的数据存取格式由一方来设定,便于后期维护。 参考资料:http://blog.163.com/nice_2012/blog/static/192666148201322481146996/

ycyn521 commented 9 years ago

/ihost return:ihost-id

michaelyin commented 9 years ago

example of returned json:

{"uuidHex":"4028a7814c882a7e014c882b81250000","name":null,"city":null,"brand":null,"create_t":1428213694752,"modify_t":null}

michaelyin commented 9 years ago

put /ihost

Header: Content-Type: application/json;charset=UTF-8 X-XSRF-TOKEN: 432db371-484d-4c66-94ce-a034c06264f1

payload: {"uuidHex":"4028a7814c882a7e014c882b81250000","name":"dc","city":"vienna","brand":"BMW","create_t":1428213694752,"modify_t":null}