use of com.itrus.portal.mobile.controller.websocket.handler.KeySegmentationWebSocketHandler in project portal by ixinportal.
the class KeySegmentationTask method buildTask.
public static void buildTask(final WebSocketSession session, final WebSocketMessage<?> message) throws UnsupportedEncodingException, NoSuchAlgorithmException, URISyntaxException {
// header 获取云盾秘钥连接 // TODO: 2017/11/29
final WebSocketHttpHeaders headers = new WebSocketHttpHeaders();
MobileSecretKeyConfigExample configExample = new MobileSecretKeyConfigExample();
MobileSecretKeyConfig keyConfig = accesskeyLiensConfigService.selectByConfig(configExample);
// keyConfig.getPasswordNumber()
headers.add("appId", keyConfig.getPasswordNumber());
headers.add("Content-Signature", Base64.encode(HMACSHA1.getHmacSHA1(/*keyConfig.getPasswordNumber(),keyConfig.getPassword()*/
"1", "123"), false));
final URI uri = new URI(/*keyConfig.getConnectAddress()*/
"ws://192.168.102.237:8080/km/webSocketServer");
Runnable task = new Runnable() {
@Override
public void run() {
WebSocketClient webSocketClient = new StandardWebSocketClient();
webSocketClient.doHandshake(new KeySegmentationWebSocketHandler(session, message), headers, uri);
}
};
threadPool.execute(task);
}
Aggregations