无法使用 SCIM 在 wso2 IS 中过滤用户
Can't filter user in wso2 IS with SCIM
我尝试使用以下 link 过滤用户或获取用户详细信息:
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
link在文档中介绍:
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]}}
{"Errors":[{"code":"400","description":"Given filter operation is not supported."}]}
我现在不知道 WSO2 IS 服务器需要配置什么?
在这种情况下,你能帮我吗?
谢谢。
我创建了一个用户名 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"}}]}%
您可以创建一个新用户并通过更改名称来尝试上述查询吗?
/me 端点在 IS 5.1.0 中被破坏,这是一个已知的 issue。
这已在最新版本 5.2.0 中修复。
其他过滤操作无效,因为您使用的是未编码的 " 字符。尝试对其进行编码并发送,它应该有效。
我尝试使用以下 link 过滤用户或获取用户详细信息:
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
link在文档中介绍:
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]}}
{"Errors":[{"code":"400","description":"Given filter operation is not supported."}]}
我现在不知道 WSO2 IS 服务器需要配置什么? 在这种情况下,你能帮我吗? 谢谢。
我创建了一个用户名 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"}}]}%
您可以创建一个新用户并通过更改名称来尝试上述查询吗?
/me 端点在 IS 5.1.0 中被破坏,这是一个已知的 issue。 这已在最新版本 5.2.0 中修复。
其他过滤操作无效,因为您使用的是未编码的 " 字符。尝试对其进行编码并发送,它应该有效。