2016-10-03 36 views
1

我想在Orion上下文代理全局實例上發佈一些數據,並且我已經請求了一個在Quick start guide處提及的令牌。當我繼續編碼(Java客戶端)第二天,我得到了:Orion上下文代理全局實例令牌

Exception in thread "main" com.sun.jersey.api.client.ClientHandlerException: java.net.SocketException: Unexpected end of file from server 
at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:155) 
at com.sun.jersey.api.client.Client.handle(Client.java:652) 
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682) 
at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74) 
at com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:509) 
at publishers.fiware.OrionClient.getEntities(OrionClient.java:23) 
at FiwareTest.main(FiwareTest.java:11) 
Caused by: java.net.SocketException: Unexpected end of file from server 
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:792) 
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647) 
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:789) 
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647) 
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1536) 
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441) 
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) 
at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:253) 
at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:153) 
... 6 more 

所以我要求一個新的令牌,再次工作。

以這種方式生成的令牌有過期時間嗎?多少?

我有辦法得到一個非到期的令牌嗎?

回答

1

與OpenStack的梯形校正的默認配置根據,代幣1小時後到期:

http://developer.openstack.org/api-ref/identity/v3/index.html?expanded=#token-authentication-with-unscoped-authorization

POST /v3/auth/tokens HTTP/1.1 
Host: test.ttcloud.net:5001 
Content-Type: application/json 
X-Auth-Token: {{user-token}} 
{ 
"auth": { 
    "identity": { 
     "methods": [ 
      "token" 
     ], 
     "token": { 
      "id": "{{user-token}}" 
     } 
    } 
} 
} 
+0

我:

http://docs.openstack.org/juno/config-reference/content/section_keystone.conf.html

# Amount of time a token should remain valid (in seconds). # (integer value) #expiration=3600 

您可以通過獲取另一個續訂只有在廣告後才能成功更新將用戶名和密碼輸入到有效載荷中: –

相關問題