From ace72e9ff8c58dc9551bc9f5b47f0b92f824892a Mon Sep 17 00:00:00 2001 From: dseurotech Date: Fri, 7 Jun 2024 12:18:58 +0200 Subject: [PATCH 1/2] :fix: xml annotations on CredentialImpl were overriding the ones on Credential, preventing XmlJavaTypeAdapters from being called Signed-off-by: dseurotech --- .../credential/shiro/CredentialImpl.java | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/service/security/shiro/src/main/java/org/eclipse/kapua/service/authentication/credential/shiro/CredentialImpl.java b/service/security/shiro/src/main/java/org/eclipse/kapua/service/authentication/credential/shiro/CredentialImpl.java index adb0735a53e..77243d35548 100644 --- a/service/security/shiro/src/main/java/org/eclipse/kapua/service/authentication/credential/shiro/CredentialImpl.java +++ b/service/security/shiro/src/main/java/org/eclipse/kapua/service/authentication/credential/shiro/CredentialImpl.java @@ -12,13 +12,7 @@ *******************************************************************************/ package org.eclipse.kapua.service.authentication.credential.shiro; -import org.eclipse.kapua.KapuaException; -import org.eclipse.kapua.commons.model.AbstractKapuaUpdatableEntity; -import org.eclipse.kapua.commons.model.id.KapuaEid; -import org.eclipse.kapua.model.id.KapuaId; -import org.eclipse.kapua.service.authentication.credential.Credential; -import org.eclipse.kapua.service.authentication.credential.CredentialStatus; -import org.eclipse.kapua.service.authentication.credential.CredentialType; +import java.util.Date; import javax.persistence.AttributeOverride; import javax.persistence.AttributeOverrides; @@ -31,13 +25,15 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import java.util.Date; -@XmlRootElement -@XmlAccessorType(XmlAccessType.PROPERTY) +import org.eclipse.kapua.KapuaException; +import org.eclipse.kapua.commons.model.AbstractKapuaUpdatableEntity; +import org.eclipse.kapua.commons.model.id.KapuaEid; +import org.eclipse.kapua.model.id.KapuaId; +import org.eclipse.kapua.service.authentication.credential.Credential; +import org.eclipse.kapua.service.authentication.credential.CredentialStatus; +import org.eclipse.kapua.service.authentication.credential.CredentialType; + @Entity(name = "Credential") @Table(name = "atht_credential") /** @@ -99,7 +95,8 @@ public CredentialImpl() { /** * Constructor. * - * @param scopeId The scope {@link KapuaId} to set into the {@link Credential}. + * @param scopeId + * The scope {@link KapuaId} to set into the {@link Credential}. * @since 1.0.0 */ public CredentialImpl(KapuaId scopeId) { @@ -109,10 +106,14 @@ public CredentialImpl(KapuaId scopeId) { /** * Constructor. * - * @param scopeId The scope {@link KapuaId} to set into the {@link Credential}. - * @param userId The {@link org.eclipse.kapua.service.user.User} {@link KapuaId} to set into the {@link Credential}. - * @param credentialType The {@link CredentialType} to set into the {@link Credential}. - * @param credentialKey The credential key to set into the {@link Credential}. + * @param scopeId + * The scope {@link KapuaId} to set into the {@link Credential}. + * @param userId + * The {@link org.eclipse.kapua.service.user.User} {@link KapuaId} to set into the {@link Credential}. + * @param credentialType + * The {@link CredentialType} to set into the {@link Credential}. + * @param credentialKey + * The credential key to set into the {@link Credential}. * @since 1.0.0 */ public CredentialImpl(KapuaId scopeId, KapuaId userId, CredentialType credentialType, String credentialKey, CredentialStatus credentialStatus, Date expirationDate) { From 2fbb818ff1373635c466af9dd9817f478ca370ce Mon Sep 17 00:00:00 2001 From: dseurotech Date: Fri, 7 Jun 2024 12:56:28 +0200 Subject: [PATCH 2/2] :fix: same issue for MfaOption and ScratchCode Signed-off-by: dseurotech --- .../credential/mfa/shiro/MfaOptionImpl.java | 37 ++++++++++--------- .../credential/mfa/shiro/ScratchCodeImpl.java | 27 +++++++------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/service/security/shiro/src/main/java/org/eclipse/kapua/service/authentication/credential/mfa/shiro/MfaOptionImpl.java b/service/security/shiro/src/main/java/org/eclipse/kapua/service/authentication/credential/mfa/shiro/MfaOptionImpl.java index bddd7e9de97..5d63f6d8488 100644 --- a/service/security/shiro/src/main/java/org/eclipse/kapua/service/authentication/credential/mfa/shiro/MfaOptionImpl.java +++ b/service/security/shiro/src/main/java/org/eclipse/kapua/service/authentication/credential/mfa/shiro/MfaOptionImpl.java @@ -12,12 +12,8 @@ *******************************************************************************/ package org.eclipse.kapua.service.authentication.credential.mfa.shiro; -import org.eclipse.kapua.commons.jpa.SecretAttributeConverter; -import org.eclipse.kapua.commons.model.AbstractKapuaUpdatableEntity; -import org.eclipse.kapua.commons.model.id.KapuaEid; -import org.eclipse.kapua.model.id.KapuaId; -import org.eclipse.kapua.service.authentication.credential.mfa.MfaOption; -import org.eclipse.kapua.service.authentication.credential.mfa.ScratchCode; +import java.util.Date; +import java.util.List; import javax.persistence.AttributeOverride; import javax.persistence.AttributeOverrides; @@ -30,19 +26,19 @@ import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import java.util.Date; -import java.util.List; + +import org.eclipse.kapua.commons.jpa.SecretAttributeConverter; +import org.eclipse.kapua.commons.model.AbstractKapuaUpdatableEntity; +import org.eclipse.kapua.commons.model.id.KapuaEid; +import org.eclipse.kapua.model.id.KapuaId; +import org.eclipse.kapua.service.authentication.credential.mfa.MfaOption; +import org.eclipse.kapua.service.authentication.credential.mfa.ScratchCode; /** * {@link MfaOption} implementation. * * @since 1.3.0 */ -@XmlRootElement -@XmlAccessorType(XmlAccessType.PROPERTY) @Entity(name = "MfaOption") @Table(name = "atht_mfa_option") public class MfaOptionImpl extends AbstractKapuaUpdatableEntity implements MfaOption { @@ -86,7 +82,8 @@ public MfaOptionImpl() { /** * Constructor. * - * @param scopeId The {@link MfaOption#getScopeId()} + * @param scopeId + * The {@link MfaOption#getScopeId()} * @since 1.3.0 */ public MfaOptionImpl(KapuaId scopeId) { @@ -96,9 +93,12 @@ public MfaOptionImpl(KapuaId scopeId) { /** * Constructor. * - * @param scopeId The scope {@link KapuaId} to set into the {@link MfaOption}. - * @param userId user identifier - * @param mfaSecretKey The secret key to set into the {@link MfaOption}. + * @param scopeId + * The scope {@link KapuaId} to set into the {@link MfaOption}. + * @param userId + * user identifier + * @param mfaSecretKey + * The secret key to set into the {@link MfaOption}. * @since 1.3.0 * @deprecated Since 2.0.0. Please make use of {@link #MfaOptionImpl()} and its setters. */ @@ -113,7 +113,8 @@ public MfaOptionImpl(KapuaId scopeId, KapuaId userId, String mfaSecretKey) { /** * Clone constructor. * - * @param mfaOption The {@link MfaOption} to clone. + * @param mfaOption + * The {@link MfaOption} to clone. * @since 1.3.0 */ public MfaOptionImpl(MfaOption mfaOption) { diff --git a/service/security/shiro/src/main/java/org/eclipse/kapua/service/authentication/credential/mfa/shiro/ScratchCodeImpl.java b/service/security/shiro/src/main/java/org/eclipse/kapua/service/authentication/credential/mfa/shiro/ScratchCodeImpl.java index 6a4a563a26b..0df7dcdfe96 100644 --- a/service/security/shiro/src/main/java/org/eclipse/kapua/service/authentication/credential/mfa/shiro/ScratchCodeImpl.java +++ b/service/security/shiro/src/main/java/org/eclipse/kapua/service/authentication/credential/mfa/shiro/ScratchCodeImpl.java @@ -12,11 +12,6 @@ *******************************************************************************/ package org.eclipse.kapua.service.authentication.credential.mfa.shiro; -import org.eclipse.kapua.commons.model.AbstractKapuaEntity; -import org.eclipse.kapua.commons.model.id.KapuaEid; -import org.eclipse.kapua.model.id.KapuaId; -import org.eclipse.kapua.service.authentication.credential.mfa.ScratchCode; - import javax.persistence.AttributeOverride; import javax.persistence.AttributeOverrides; import javax.persistence.Basic; @@ -24,17 +19,17 @@ import javax.persistence.Embedded; import javax.persistence.Entity; import javax.persistence.Table; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; + +import org.eclipse.kapua.commons.model.AbstractKapuaEntity; +import org.eclipse.kapua.commons.model.id.KapuaEid; +import org.eclipse.kapua.model.id.KapuaId; +import org.eclipse.kapua.service.authentication.credential.mfa.ScratchCode; /** * {@link ScratchCode} implementation. * * @since 1.3.0 */ -@XmlRootElement -@XmlAccessorType(XmlAccessType.PROPERTY) @Entity(name = "ScratchCode") @Table(name = "atht_scratch_code") public class ScratchCodeImpl extends AbstractKapuaEntity implements ScratchCode { @@ -63,7 +58,8 @@ public ScratchCodeImpl() { /** * Constructor. * - * @param scopeId The {@link ScratchCode#getScopeId()}. + * @param scopeId + * The {@link ScratchCode#getScopeId()}. * @since 1.3.0 */ public ScratchCodeImpl(KapuaId scopeId) { @@ -73,8 +69,10 @@ public ScratchCodeImpl(KapuaId scopeId) { /** * Constructor. * - * @param scopeId The scope {@link KapuaId} to set into the {@link ScratchCode}. - * @param code The code to set into the {@link ScratchCode}. + * @param scopeId + * The scope {@link KapuaId} to set into the {@link ScratchCode}. + * @param code + * The code to set into the {@link ScratchCode}. * @since 1.3.0 */ public ScratchCodeImpl(KapuaId scopeId, KapuaId mfaOptionId, String code) { @@ -87,7 +85,8 @@ public ScratchCodeImpl(KapuaId scopeId, KapuaId mfaOptionId, String code) { /** * Clone constructor. * - * @param scratchCode The {@link ScratchCode} to clone. + * @param scratchCode + * The {@link ScratchCode} to clone. * @since 1.3.0 */ public ScratchCodeImpl(ScratchCode scratchCode) {