package com.walker.tcp.websocket;
|
|
import com.walker.infrastructure.utils.StringUtils;
|
import com.walker.tcp.Authenticate;
|
import com.walker.tcp.AuthenticateException;
|
import com.walker.tcp.Request;
|
|
/**
|
* WebSocket中默认认证实现。</p>
|
* 因为在网页中,并不存在需要认证的情况,一般系统已经登录,因此直接从请求数据中获取固定uid标识。
|
* @author Administrator
|
*
|
*/
|
@Deprecated
|
public class DefaultAuthentication implements Authenticate {
|
|
@Override
|
public String authenticate(Request<?> request) throws AuthenticateException {
|
String clientId = request.getName();
|
if(StringUtils.isEmpty(clientId)){
|
throw new AuthenticateException("请求信息中不存在设备ID号,无法认证");
|
}
|
return clientId;
|
}
|
|
}
|