Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

POST /admin/identities response fields unset

未关闭
#347 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
java, kubernetes
领域
api, backend

调研方向

首先使用密码凭据复现 POST /admin/identities,然后将其响应与 GET /admin/identities/{id} 进行比较。检查 admin identity 创建响应和序列化路径;完成的标准是 identifiers、created_at 和 updated_at 包含其实际值,并且 ory-client Java 模型能够无错误地解析该响应。

由索引模型根据 Issue 内容生成。

描述

bug
Preflight checklist
Describe the bug

Hello,

We are using oryd/kratos:v1.0.0. When we create an identity with credentials, the response contains wrong values for credentials.identifiers, credentials.created_at and credentials.updated_at :

POST to /admin/identities payload

{   
    "credentials": {
        "password": {
            "config": {
                "password": "HelloWorld"
            }
        }
    },
    "traits": {
        "email": "[email protected]"
    }
}

POST to /admin/identities partial response

    "id": "0009e8ff-2665-49be-9c8a-351a42d949b8",
    "credentials": {
        "password": {
            "type": "password",
            "identifiers": null,
            "version": 0,
            "created_at": "0001-01-01T00:00:00Z",
            "updated_at": "0001-01-01T00:00:00Z"
        }
    }

When we retrieve the same identity right after, the payload is correct with all the fields set
GET to /admin/identities/0009e8ff-2665-49be-9c8a-351a42d949b8 partial response

    "id": "0009e8ff-2665-49be-9c8a-351a42d949b8",
    "credentials": {
        "password": {
            "type": "password",
            "identifiers": [],
            "version": 0,
            "created_at": "2023-09-11T17:47:59.111957Z",
            "updated_at": "2023-09-11T17:47:59.111957Z"
        }
    }

I would expect to get credentials.created_at, credentials.updated_at and credentials.identifiers filled with their actual values on the POST.

Also because of that we face failure using JAR ory-client:1.1.45 when IdentityCredentials.java tries to validate the JSON payload:

java.lang.IllegalArgumentException: Expected the field `identifiers` to be an array in the JSON string but got `null`
	at sh.ory.model.IdentityCredentials.validateJsonObject(IdentityCredentials.java:357)
	at sh.ory.model.IdentityCredentials$CustomTypeAdapterFactory$1.read(IdentityCredentials.java:399)
	at sh.ory.model.IdentityCredentials$CustomTypeAdapterFactory$1.read(IdentityCredentials.java:372)

Thanks

Reproducing the bug
  1. Start Kratos
  2. Create Identity with credentials using POST /admin/identities
Relevant log output

No response

Relevant configuration

No response

Version

oryd/kratos:v1.0.0

On which operating system are you observing this issue?

Linux

In which environment are you deploying?

Kubernetes

Additional Context

As a workaroound, in case that can help others, I have replaced the createIdentity by a call too batchPatchIdentities. As the response does not contain credentials it can be parsed probably by ory-client:1.1.45

主要语言
Shell
星标
96
派生
8
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ory/network 的其他 Issue

查看 ory/network 的全部 Issue

相似的 Issue

更多 Shell/Bash Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。