Skip to content

Package: MfaOptionImpl

MfaOptionImpl

nameinstructionbranchcomplexitylinemethod
MfaOptionImpl()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
MfaOptionImpl(KapuaId)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
MfaOptionImpl(KapuaId, KapuaId, String)
M: 11 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
MfaOptionImpl(MfaOption)
M: 20 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
getMfaSecretKey()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getQRCodeImage()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getScratchCodes()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getTrustExpirationDate()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getTrustKey()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getUserId()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
setMfaSecretKey(String)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setQRCodeImage(String)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setScratchCodes(List)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setTrustExpirationDate(Date)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setTrustKey(String)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setUserId(KapuaId)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2020, 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.service.authentication.credential.mfa.shiro;
14:
15: import org.eclipse.kapua.commons.jpa.SecretAttributeConverter;
16: import org.eclipse.kapua.commons.model.AbstractKapuaUpdatableEntity;
17: import org.eclipse.kapua.commons.model.id.KapuaEid;
18: import org.eclipse.kapua.model.id.KapuaId;
19: import org.eclipse.kapua.service.authentication.credential.mfa.MfaOption;
20: import org.eclipse.kapua.service.authentication.credential.mfa.ScratchCode;
21:
22: import javax.persistence.AttributeOverride;
23: import javax.persistence.AttributeOverrides;
24: import javax.persistence.Basic;
25: import javax.persistence.Column;
26: import javax.persistence.Convert;
27: import javax.persistence.Embedded;
28: import javax.persistence.Entity;
29: import javax.persistence.Table;
30: import javax.persistence.Temporal;
31: import javax.persistence.TemporalType;
32: import javax.persistence.Transient;
33: import javax.xml.bind.annotation.XmlAccessType;
34: import javax.xml.bind.annotation.XmlAccessorType;
35: import javax.xml.bind.annotation.XmlRootElement;
36: import java.util.Date;
37: import java.util.List;
38:
39: /**
40: * {@link MfaOption} implementation.
41: *
42: * @since 1.3.0
43: */
44: @XmlRootElement
45: @XmlAccessorType(XmlAccessType.PROPERTY)
46: @Entity(name = "MfaOption")
47: @Table(name = "atht_mfa_option")
48: public class MfaOptionImpl extends AbstractKapuaUpdatableEntity implements MfaOption {
49:
50: private static final long serialVersionUID = -1872939877726584407L;
51:
52: @Embedded
53: @AttributeOverrides({
54: @AttributeOverride(name = "eid", column = @Column(name = "user_id", updatable = false, nullable = false))
55: })
56: private KapuaEid userId;
57:
58: @Basic
59: @Column(name = "mfa_secret_key", nullable = false)
60: @Convert(converter = SecretAttributeConverter.class)
61: private String mfaSecretKey;
62:
63: @Basic
64: @Column(name = "trust_key")
65: private String trustKey;
66:
67: @Temporal(TemporalType.TIMESTAMP)
68: @Column(name = "trust_expiration_date")
69: protected Date trustExpirationDate;
70:
71: @Transient
72: private String qrCodeImage;
73:
74: @Transient
75: private List<ScratchCode> scratchCodes;
76:
77: /**
78: * Constructor.
79: *
80: * @since 1.3.0
81: */
82: public MfaOptionImpl() {
83: super();
84: }
85:
86: /**
87: * Constructor.
88: *
89: * @param scopeId The {@link MfaOption#getScopeId()}
90: * @since 1.3.0
91: */
92: public MfaOptionImpl(KapuaId scopeId) {
93: super(scopeId);
94: }
95:
96: /**
97: * Constructor.
98: *
99: * @param scopeId The scope {@link KapuaId} to set into the {@link MfaOption}.
100: * @param userId user identifier
101: * @param mfaSecretKey The secret key to set into the {@link MfaOption}.
102: * @since 1.3.0
103: * @deprecated Since 2.0.0. Please make use of {@link #MfaOptionImpl()} and its setters.
104: */
105: @Deprecated
106: public MfaOptionImpl(KapuaId scopeId, KapuaId userId, String mfaSecretKey) {
107: super(scopeId);
108:
109: this.userId = KapuaEid.parseKapuaId(userId);
110: this.mfaSecretKey = mfaSecretKey;
111: }
112:
113: /**
114: * Clone constructor.
115: *
116: * @param mfaOption The {@link MfaOption} to clone.
117: * @since 1.3.0
118: */
119: public MfaOptionImpl(MfaOption mfaOption) {
120: super(mfaOption);
121: setUserId(mfaOption.getUserId());
122: setMfaSecretKey(mfaOption.getMfaSecretKey());
123: setTrustKey(mfaOption.getTrustKey());
124: setTrustExpirationDate(mfaOption.getTrustExpirationDate());
125: }
126:
127: @Override
128: public KapuaId getUserId() {
129: return userId;
130: }
131:
132: @Override
133: public void setUserId(KapuaId userId) {
134: this.userId = KapuaEid.parseKapuaId(userId);
135: }
136:
137: @Override
138: public String getMfaSecretKey() {
139: return mfaSecretKey;
140: }
141:
142: @Override
143: public void setMfaSecretKey(String mfaSecretKey) {
144: this.mfaSecretKey = mfaSecretKey;
145: }
146:
147: @Override
148: public String getTrustKey() {
149: return this.trustKey;
150: }
151:
152: @Override
153: public void setTrustKey(String trustKey) {
154: this.trustKey = trustKey;
155: }
156:
157: @Override
158: public Date getTrustExpirationDate() {
159: return trustExpirationDate;
160: }
161:
162: @Override
163: public void setTrustExpirationDate(Date trustExpirationDate) {
164: this.trustExpirationDate = trustExpirationDate;
165: }
166:
167: @Override
168: public String getQRCodeImage() {
169: return qrCodeImage;
170: }
171:
172: @Override
173: public void setQRCodeImage(String qrCodeImage) {
174: this.qrCodeImage = qrCodeImage;
175: }
176:
177: @Override
178: public List<ScratchCode> getScratchCodes() {
179: return scratchCodes;
180: }
181:
182: @Override
183: public void setScratchCodes(List<ScratchCode> scratchCodes) {
184: this.scratchCodes = scratchCodes;
185: }
186:
187: }