2014-08-28 76 views

回答

3

HTTP基本認證可以被髮送作爲一個報頭。

String authHeader = "Basic " + new String(Base64.encodeBase64(String.format("%s:%s", username, password).getBytes())); 

Index index = new Index.Builder(json) 
      .index(indexName) 
      .type(type) 
      .id(id) 
      .setHeader("Authorization", authHeader) 
      .build(); 

JestResult result = client.execute(index); 
+0

是否有可能加入SSO餅乾嗎? – nishant 2015-02-05 18:56:58

相關問題