shikeying
2024-01-11 3b67e947e36133e2a40eb2737b15ea375e157ea0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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通道认证失败,请求不是登录");
        }
    }
 
}