Repository navigation
feat: add sourceId. #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /* | ||
| * This file is part of HyperZoneLogin, licensed under the GNU Affero General Public License v3.0 or later. | ||
| * | ||
| * Copyright (C) ksqeib (庆灵) <ksqeib@qq.com> | ||
| * Copyright (C) contributors | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Affero General Public License | ||
| * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| * | ||
| */ | ||
|
|
||
| package icu.h2l.api.util | ||
|
|
||
| import java.util.concurrent.ConcurrentHashMap | ||
|
|
||
| class PropertiesHolder : IPropertiesHolder { | ||
| override val properties: MutableMap<String, String> = ConcurrentHashMap() | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,8 @@ | |
| package icu.h2l.login.auth.online.credential | ||
|
|
||
| import icu.h2l.api.profile.HyperZoneCredential | ||
| import icu.h2l.api.util.IPropertiesHolder | ||
| import icu.h2l.api.util.PropertiesHolder | ||
| import icu.h2l.login.auth.online.db.EntryDatabaseHelper | ||
| import java.util.* | ||
|
|
||
|
|
@@ -32,12 +34,13 @@ class YggdrasilHyperZoneCredential( | |
| private val authenticatedUUID: UUID, | ||
| private val suggestedProfileCreateUuid: UUID?, | ||
| private val knownUserUUID: UUID? = null, | ||
| ) : HyperZoneCredential { | ||
| ) : 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Medium · Equivalent entries get different identifiers When the configured Yggdrasil entry ID contains uppercase letters or differs in casing from another reference, Normalize Also at Prompt for AI agentsIn `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`. |
||
|
|
||
| init { | ||
| setProperty(YGGDRASIL_ENTRY_ID_PROPERTY, entryId.lowercase(Locale.getDefault())) | ||
| setProperty(YGGDRASIL_ENTRY_ID_PROPERTY, entryId) | ||
| } | ||
|
|
||
| override fun getRegistrationName(): String = authenticatedName | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Medium · Rename drops credential properties
When custom properties are set on a pending Offline or Floodgate credential before it is renamed,
withNewNamecreates a replacement credential with a freshPropertiesHolderand does not copy the original properties, so the rename flow replaces the credential and downstream consumers see its metadata missing.Have both credential
withNewNameimplementations 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