我尝试使用以下链接过滤用户或获取用户详细信息:
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]}}
{"错误":[{"代码":" 400","说明":"鉴于过滤操作是不支持。"}]}
我现在不需要在WSO2 IS服务器中配置什么? 在这种情况下,请你帮我吗? 感谢。
答案 0 :(得分:1)
我创建了一个用户名,因此我执行了以下查询
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"}}]}%
您可以创建新用户并通过更改名称来尝试上述查询吗?
答案 1 :(得分:0)
/ me端点在IS 5.1.0中被破坏,它是已知的issue。 这已在最新版本5.2.0中修复。
其他过滤操作无效,因为您使用的是“没有编码的字符。请尝试编码并发送,它应该可以正常工作。