WSO2 身份服务器:通过用户名 api 搜索用户不起作用

发布于 2025-01-11 02:07:03 字数 436 浏览 0 评论 0原文

是否有任何 API 可以仅使用用户名来获取用户的详细信息?

我已经关注了这个 https ://is.docs.wso2.com/en/latest/develop/scim2-rest-apis/#/Users%20Endpoint/getUsersByPost

但它不起作用

见附件邮递员请求的屏幕截图

Is there any API available to fetch the details of a user using their username only?

I've followed this https://is.docs.wso2.com/en/latest/develop/scim2-rest-apis/#/Users%20Endpoint/getUsersByPost

But it doesn't work

see attached screenshot of postman requests

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情归归情 2025-01-18 02:07:03
  1. 您尝试的网址错误。
  • SCIM v1 用户端点:https://localhost:9443/wso2/scim/Users
  • SCIM v2 用户端点:https://localhost:9443/scim2/Users
  1. 在有效负载,您已经提到了 scim v1 架构。也许您想尝试 scim v1 中的 API,但我们建议使用 V2。

以下是 SCIM V2 中满足您要求的示例请求。

如果您想使用 POST 请求到 /Users/.search 端点:

curl --location --request POST 'https://localhost:9443/scim2/Users/.search' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--header 'Content-Type: application/json' \
--data-raw '{
    "schemas": [
        "urn:ietf:params:scim:api:messages:2.0:SearchRequest"
    ],
    "attributes": [
        "userName",
        "name"
    ],
    "filter": "userName eq userA",
    "domain": "PRIMARY",
    "startIndex": "1",
    "count": "10"
}'

如果您想使用 GET 请求到 /Users< /代码> 端点:

curl --location --request GET 'https://localhost:9443/scim2/Users?startIndex=1&attributes=userName,Name&count=10&filter=username%20eq%20userA&' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--data-raw ''
  1. The URL you were trying was wrong.
  • SCIM v1 users endpoint: https://localhost:9443/wso2/scim/Users
  • SCIM v2 users endpoint: https://localhost:9443/scim2/Users
  1. On the payload, you have mentioned scim v1 schema. Maybe you wanted to try the API in scim v1, but we recommend using V2.

Following are sample requests for your requirement in SCIM V2.

If you want to use POST request to /Users/.search endpoint:

curl --location --request POST 'https://localhost:9443/scim2/Users/.search' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--header 'Content-Type: application/json' \
--data-raw '{
    "schemas": [
        "urn:ietf:params:scim:api:messages:2.0:SearchRequest"
    ],
    "attributes": [
        "userName",
        "name"
    ],
    "filter": "userName eq userA",
    "domain": "PRIMARY",
    "startIndex": "1",
    "count": "10"
}'

If you want to use GET request to /Users endpoint:

curl --location --request GET 'https://localhost:9443/scim2/Users?startIndex=1&attributes=userName,Name&count=10&filter=username%20eq%20userA&' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--data-raw ''
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文