Fetch the repository succeeded.
This action will force synchronization from 雨翔河/ScanLogin, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
手机扫一扫登录
服务器生成uuid和uuid为内容的二维码,同时生成一个全局的hashMap,key为uuid,value为登录信息,现在为空。
浏览器得到服务器传过来的uuid和二维码的同时发起轮询操作,问服务器是否有手机扫描了这个二维码。
手机端扫描二维码来得到uuid,通过uuid来识别扫描的是哪一个浏览器的二维码。
手机端拿到uuid,放服务器发送一个请求同时携带登录信息,约定好action,服务器拿到登录信息后根据uuid放到相应的地方。
轮询发现了uuid这个key对应的value不为空了说明登录成功。
action为请求。
util为生成二维码的工具类。
bean为假设的用户属性。
依赖fastjson包和zxing包,fastjson用来转json格式数据,zxing包用来生成二维码。
工作比较忙,没时间维护,sorry,简单的提交的,等我有时间了整好点,不过基本的原理都描述清楚了。
Sign in for post a comment
Comments ( 0 )