package com.walker.tcp.littleD;
|
|
import com.walker.infrastructure.utils.StringUtils;
|
import com.walker.tcp.Authenticate;
|
import com.walker.tcp.AuthenticateException;
|
import com.walker.tcp.Request;
|
|
/**
|
* 小D默认的认证方式,建立连接后,首先请求登录接口
|
* @author Administrator
|
*
|
*/
|
@Deprecated
|
public class DefaultAuthentication implements Authenticate {
|
|
@Override
|
public String authenticate(Request<?> request) throws AuthenticateException {
|
if(request instanceof LoginRequest){
|
String clientId = request.getName();
|
if(StringUtils.isEmpty(clientId)){
|
throw new AuthenticateException("请求信息中不存在设备ID号,无法认证");
|
}
|
return clientId;
|
|
} else {
|
throw new AuthenticateException("connection通道认证失败,请求不是登录");
|
}
|
}
|
|
}
|