Skip to content
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

:fix: Credential Marshalling #4053

Merged
merged 2 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down Expand Up @@ -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) {
Expand All @@ -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.
*/
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,24 @@
*******************************************************************************/
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;
import javax.persistence.Column;
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 {
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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")
/**
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
Loading