Repository navigation
Conversation
Signed-off-by: 秋雨落 <i@rain.cx>
Reviewer's GuideAPIAdd
Change the properties-holder contract to expose a mutable map and return nullable property values, avoiding a newly created map on each getter call.
ImplementationProvide a concurrent-map-backed properties holder for credentials that delegate the properties API.
Implement the new source identifier for Floodgate and Offline credentials using their channel IDs, and provide the properties-holder implementation required by the revised API.
Identify Yggdrasil credentials by channel and entry ID, and retain the entry ID property without lowercasing it using the default locale.
TestsUpdate the test credential fakes to implement the new source ID contract and delegate property handling to the shared holder.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="subplugin/auth-floodgate/src/main/kotlin/icu/h2l/login/auth/floodgate/credential/FloodgateHyperZoneCredential.kt" line_range="37" />
<code_context>
private val suggestedProfileCreateUuid: UUID?,
private val knownUserUUID: UUID? = null,
-) : HyperZoneCredential {
+) : HyperZoneCredential, IPropertiesHolder by PropertiesHolder() {
override val channelId: String = CHANNEL_ID
override val credentialId: String = trustedUuid.toString()
</code_context>
<issue_to_address>
**Rename drops credential properties**
When custom properties are set on a pending Offline or Floodgate credential before it is renamed, `withNewName` creates a replacement credential with a fresh `PropertiesHolder` and does not copy the original properties, so the rename flow replaces the credential and downstream consumers see its metadata missing.
Have both credential `withNewName` implementations preserve the original properties when creating the renamed credential.
Also at `subplugin/auth-offline/src/main/kotlin/icu/h2l/login/auth/offline/service/OfflineHyperZoneCredential.kt:39`.
</issue_to_address>
### Comment 2
<location path="subplugin/auth-yggd/src/main/kotlin/icu/h2l/login/auth/online/credential/YggdrasilHyperZoneCredential.kt" line_range="40" />
<code_context>
+) : HyperZoneCredential, IPropertiesHolder by PropertiesHolder() {
override val channelId: String = CHANNEL_ID
override val credentialId: String = "$entryId:$authenticatedUUID"
+ override val sourceId: String = "$channelId:${entryId}"
init {
</code_context>
<issue_to_address>
**Equivalent entries get different identifiers**
When the configured Yggdrasil entry ID contains uppercase letters or differs in casing from another reference, `sourceId` and the `yggdrasil-entry-id` property preserve the configured casing, while `EntryTableManager` normalizes IDs to lowercase; consumers matching canonical IDs treat the same upstream entry as a different source.
Normalize `entryId` to lowercase using the same canonicalization as `EntryTableManager` before constructing `sourceId` and setting `YGGDRASIL_ENTRY_ID_PROPERTY`.
Also at `subplugin/auth-yggd/src/main/kotlin/icu/h2l/login/auth/online/credential/YggdrasilHyperZoneCredential.kt:43`.
</issue_to_address>Sourcery assessment
Approval pending. 2 findings to address first.
Blocking findings: subplugin/auth-floodgate/src/main/kotlin/icu/h2l/login/auth/floodgate/credential/FloodgateHyperZoneCredential.kt:37, subplugin/auth-yggd/src/main/kotlin/icu/h2l/login/auth/online/credential/YggdrasilHyperZoneCredential.kt:40
| private val suggestedProfileCreateUuid: UUID?, | ||
| private val knownUserUUID: UUID? = null, | ||
| ) : HyperZoneCredential { | ||
| ) : HyperZoneCredential, IPropertiesHolder by PropertiesHolder() { |
There was a problem hiding this comment.
🟡 Medium · Rename drops credential properties
When custom properties are set on a pending Offline or Floodgate credential before it is renamed, withNewName creates a replacement credential with a fresh PropertiesHolder and does not copy the original properties, so the rename flow replaces the credential and downstream consumers see its metadata missing.
Have both credential withNewName implementations preserve the original properties when creating the renamed credential.
Also at subplugin/auth-offline/src/main/kotlin/icu/h2l/login/auth/offline/service/OfflineHyperZoneCredential.kt:39.
Prompt for AI agents
In `subplugin/auth-floodgate/src/main/kotlin/icu/h2l/login/auth/floodgate/credential/FloodgateHyperZoneCredential.kt` at line 37:
**Rename drops credential properties**
When custom properties are set on a pending Offline or Floodgate credential before it is renamed, `withNewName` creates a replacement credential with a fresh `PropertiesHolder` and does not copy the original properties, so the rename flow replaces the credential and downstream consumers see its metadata missing.
Have both credential `withNewName` implementations preserve the original properties when creating the renamed credential.
Also at `subplugin/auth-offline/src/main/kotlin/icu/h2l/login/auth/offline/service/OfflineHyperZoneCredential.kt:39`.| ) : HyperZoneCredential, IPropertiesHolder by PropertiesHolder() { | ||
| override val channelId: String = CHANNEL_ID | ||
| override val credentialId: String = "$entryId:$authenticatedUUID" | ||
| override val sourceId: String = "$channelId:${entryId}" |
There was a problem hiding this comment.
🟡 Medium · Equivalent entries get different identifiers
When the configured Yggdrasil entry ID contains uppercase letters or differs in casing from another reference, sourceId and the yggdrasil-entry-id property preserve the configured casing, while EntryTableManager normalizes IDs to lowercase; consumers matching canonical IDs treat the same upstream entry as a different source.
Normalize entryId to lowercase using the same canonicalization as EntryTableManager before constructing sourceId and setting YGGDRASIL_ENTRY_ID_PROPERTY.
Also at subplugin/auth-yggd/src/main/kotlin/icu/h2l/login/auth/online/credential/YggdrasilHyperZoneCredential.kt:43.
Prompt for AI agents
In `subplugin/auth-yggd/src/main/kotlin/icu/h2l/login/auth/online/credential/YggdrasilHyperZoneCredential.kt` at line 40:
**Equivalent entries get different identifiers**
When the configured Yggdrasil entry ID contains uppercase letters or differs in casing from another reference, `sourceId` and the `yggdrasil-entry-id` property preserve the configured casing, while `EntryTableManager` normalizes IDs to lowercase; consumers matching canonical IDs treat the same upstream entry as a different source.
Normalize `entryId` to lowercase using the same canonicalization as `EntryTableManager` before constructing `sourceId` and setting `YGGDRASIL_ENTRY_ID_PROPERTY`.
Also at `subplugin/auth-yggd/src/main/kotlin/icu/h2l/login/auth/online/credential/YggdrasilHyperZoneCredential.kt:43`.|
我认为并不合适,如果属性清单已经置入entryId,那么实际上只需要检查入场凭据的类型即可,那么给凭据添加一个固定的getType就好了,不需要这种组合 |
变更说明
(本PR应当在#50 合并以后审阅)
SourceId用于标识唯一上游认证来源。
对于Offline和Floodgate,它就是对应的channelId(即
offline和floodgate);对于Yggdrasil,它是
yggdrasil:<entryId>。本PR的修改曾是#46的草案,并被引入properties的实现代替。
我现在认为sourceId还是应该加回来:
yggdrasil,而不包含entryId;但是在实际应用中,确定一个credential究竟是来自official(官方正版验证)还是属于littleskin(随便一个yggdrasil兼容认证服务器)可能更实用。YggdrasilHyperZoneCredential暴露yggdrasil-entry-id属性(feat: add credential properties. #46),在白名单模块内部进行字符串拼接、匹配。关联范围
openvcauth-yggdauth-offlinedata-mergeprofile-skinapi变更类型
测试与验证
请说明你做了哪些验证,例如:
兼容性与风险
这是一个API的breaking change,影响所有实现了
HyperZoneCredential接口的插件。其他补充
如有截图、日志、配置示例或后续 TODO,请在此补充。