2016-09-14 80 views
0

IS我試圖篩選用戶或用以下鏈接獲得用戶的細節:不能過濾用戶WSO2與SCIM

curl -v -k -X GET --user admin:admin --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Users?filter=userName%20Eq%20」admin" 

curl -v -k --user hasinitg:hasinitg https://localhost:9443/wso2/scim/Users/me 

的鏈接文檔中介紹:

https://docs.wso2.com/display/IS510/SCIM+APIs 

但我無法獲得任何信息。 系統告訴我說:

{"Errors":[{"code":"400","description":"Given filter operation is not supported."}]} 

我試圖在Java下面的代碼,但結果是一樣的:

//String url = "https://localhost:9443/wso2/scim/Users?filterEqadmin"; 
    String url = "https://localhost:9443/wso2/scim/Users/me"; 
    BasicCookieStore cookieStore = new BasicCookieStore(); 

    UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("admin", "admin"); 

    SSLContextBuilder builder = new SSLContextBuilder(); 
    builder.loadTrustMaterial(null, new TrustSelfSignedStrategy()); 
    SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(builder.build()); 
    CloseableHttpClient httpclient = HttpClientBuilder.create().setSSLSocketFactory(sslsf) 
      .setDefaultCookieStore(cookieStore).build(); 

    HttpGet get = new HttpGet(url); 
    get.addHeader("Accept", "application/json"); 
    get.addHeader("charset", "UTF-8"); 
    get.addHeader("Content-Type", "application/json"); 


    Header header = new BasicScheme().authenticate(credentials, get); 
    get.addHeader(header); 

    HttpResponse response = httpclient.execute(get); 
    System.out.println(response.getStatusLine()); 
    System.out.println("Response Code : " + response); 

    BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); 

    StringBuffer result = new StringBuffer(); 
    String line = ""; 
    while ((line = rd.readLine()) != null) { 
     result.append(line); 
    } 
    System.out.println(result); 

錯誤:

Response Code : HttpResponseProxy{HTTP/1.1 400 Bad Request [Cache-Control: private, Expires: Thu, 01 Jan 1970 08:00:00 ICT, Date: Wed, 14 Sep 2016 10:48:46 GMT, Content-Type: application/json, Content-Length: 84, Connection: close, Server: WSO2 Carbon Server] ResponseEntityProxy{[Content-Type: application/json,Content-Length: 84,Chunked: false]}} 

{ 「錯誤」: [{「code」:「400」,「description」:「不支持給定的過濾器操作。」}]}

我現在不是什麼需要在WSO2 IS服務器中進行配置? 請問在這種情況下你能幫我嗎? 謝謝。

回答

1

我創建了一個用戶名thusitha然後我執行下面的查詢

curl -v -k -X GET --user admin:admin --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Users\?filter\=userName+Eq+%22thusitha%22 

我得到的結果正確

{"schemas":["urn:scim:schemas:core:1.0"],"totalResults":1,"Resources":[{"id":"486ebfb2-0b39-45a8-b963-02ae27dbd1dc","userName":"thusitha","meta":{"lastModified":"2016-09-15T11:26:09","created":"2016-09-15T11:26:09"}}]}% 

你可以創建一個新用戶,並通過改變嘗試上述查詢名字?

+0

Y可以得到由捲曲鏈路用戶信息:。 捲曲-v -k --user hasinitg:hasinitg https:// localhost:9443/wso2/scim/Users/me – user2659694

+1

是可能的 https://docs.wso2.com/display/IS510/SCIM+APIs – Ishara

+0

這在5.1.0中被破壞https: //wso2.org/jira/browse/IDENTITY-4329 –

0

/me端點在IS 5.1.0中被破壞,它是已知的issue。 這已在最新版本5.2.0中修復。

其他過濾操作無法正常工作,因爲你正在使用「字符編碼沒有嘗試編碼併發送,它應該工作