Search in sources :

Example 1 with MobileSecretKeyConfig

use of com.itrus.portal.db.MobileSecretKeyConfig 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);
}
Also used : MobileSecretKeyConfig(com.itrus.portal.db.MobileSecretKeyConfig) WebSocketHttpHeaders(org.springframework.web.socket.WebSocketHttpHeaders) KeySegmentationWebSocketHandler(com.itrus.portal.mobile.controller.websocket.handler.KeySegmentationWebSocketHandler) MobileSecretKeyConfigExample(com.itrus.portal.db.MobileSecretKeyConfigExample) StandardWebSocketClient(org.springframework.web.socket.client.standard.StandardWebSocketClient) WebSocketClient(org.springframework.web.socket.client.WebSocketClient) StandardWebSocketClient(org.springframework.web.socket.client.standard.StandardWebSocketClient) URI(java.net.URI)

Example 2 with MobileSecretKeyConfig

use of com.itrus.portal.db.MobileSecretKeyConfig in project portal by ixinportal.

the class MobileAccesskeyLiensConfigController method show.

// 显示详情
@RequestMapping(produces = "text/html")
public String show(Model uiModel) {
    MobileSecretKeyConfigExample configExample = new MobileSecretKeyConfigExample();
    MobileSecretKeyConfigExample.Criteria cfe = configExample.createCriteria();
    List<MobileSecretKeyConfig> configs = mobileAccesskeyLiensService.selectAll(configExample);
    if (configs.size() > 0) {
        MobileSecretKeyConfig config = configs.get(0);
        uiModel.addAttribute("config", config);
    } else {
        MobileSecretKeyConfig config = null;
        uiModel.addAttribute("config", config);
    }
    return "mobileaccesskeyliensconfig/show";
}
Also used : MobileSecretKeyConfig(com.itrus.portal.db.MobileSecretKeyConfig) MobileSecretKeyConfigExample(com.itrus.portal.db.MobileSecretKeyConfigExample) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with MobileSecretKeyConfig

use of com.itrus.portal.db.MobileSecretKeyConfig in project portal by ixinportal.

the class MobileAccesskeyLiensConfigController method creat.

// 返回新建页面
@RequestMapping(params = "form", produces = "text/html")
public String creat(@RequestParam(value = "id", required = false) Long id, Model uiModel) {
    if (id == null) {
        return "mobileaccesskeyliensconfig/create";
    }
    MobileSecretKeyConfig config = mobileAccesskeyLiensService.selectById(id);
    uiModel.addAttribute("config", config);
    return "mobileaccesskeyliensconfig/create";
}
Also used : MobileSecretKeyConfig(com.itrus.portal.db.MobileSecretKeyConfig) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

MobileSecretKeyConfig (com.itrus.portal.db.MobileSecretKeyConfig)3 MobileSecretKeyConfigExample (com.itrus.portal.db.MobileSecretKeyConfigExample)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 KeySegmentationWebSocketHandler (com.itrus.portal.mobile.controller.websocket.handler.KeySegmentationWebSocketHandler)1 URI (java.net.URI)1 WebSocketHttpHeaders (org.springframework.web.socket.WebSocketHttpHeaders)1 WebSocketClient (org.springframework.web.socket.client.WebSocketClient)1 StandardWebSocketClient (org.springframework.web.socket.client.standard.StandardWebSocketClient)1