• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CruGlobal / idm-user-management / #615049189

13 Dec 2023 10:21PM UTC coverage: 37.95% (-0.03%) from 37.977%
#615049189

Pull #176

travis-ci

Pull Request #176: Set Okta orca attribute

1 of 4 new or added lines in 2 files covered. (25.0%)

1 existing line in 1 file now uncovered.

707 of 1863 relevant lines covered (37.95%)

0.38 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

41.02
/api/src/main/java/org/ccci/idm/user/User.java
1
package org.ccci.idm.user;
2

3
import static org.ccci.idm.user.Constants.STRENGTH_FULL;
4
import static org.ccci.idm.user.Constants.STRENGTH_NONE;
5

6
import com.google.common.base.CharMatcher;
7
import com.google.common.base.MoreObjects;
8
import com.google.common.base.Objects;
9
import com.google.common.base.Predicates;
10
import com.google.common.base.Strings;
11
import com.google.common.collect.Collections2;
12
import com.google.common.collect.Maps;
13
import com.google.common.collect.Sets;
14
import org.ccci.idm.user.util.HashUtility;
15
import org.joda.time.ReadableInstant;
16
import org.springframework.util.StringUtils;
17

18
import javax.annotation.Nonnull;
19
import javax.annotation.Nullable;
20
import java.io.Serializable;
21
import java.util.Collection;
22
import java.util.Collections;
23
import java.util.HashSet;
24
import java.util.Map;
25
import java.util.Set;
26

27
public class User implements Cloneable, Serializable {
28
    private static final long serialVersionUID = -1174980195690210236L;
29

30
    public enum Attr {
1✔
31
        EMAIL, PASSWORD, NAME, LOGINTIME, FLAGS, SELFSERVICEKEYS, DOMAINSVISITED, FACEBOOK, GLOBALREGISTRY, LOCATION,
1✔
32
        EMPLOYEE_NUMBER, CRU_DESIGNATION, CONTACT, CRU_PREFERRED_NAME, CRU_PROXY_ADDRESSES, HUMAN_RESOURCE, SECURITYQA,
1✔
33
        MFA_SECRET, MFA_INTRUDER_DETECTION, ORCA
1✔
34
    }
35

36
    @Nullable
37
    private String email;
38
    private String password;
39

40
    @Deprecated
41
    private String guid;
42
    private String theKeyGuid;
43
    private String relayGuid;
44

45
    private String firstName;
46
    private String preferredName;
47
    private String lastName;
48

49
    private ReadableInstant loginTime;
50
    private ReadableInstant pwdChangedTime;
51

52
    // account flags
53
    private boolean emailVerified = false;
1✔
54
    private boolean allowPasswordChange = true;
1✔
55
    private boolean forcePasswordChange = false;
1✔
56
    private boolean deactivated = false;
1✔
57
    private boolean loginDisabled = false;
1✔
58
    private boolean locked = false;
1✔
59

60
    // Multi-value attributes
61
    private final Set<String> domainsVisited = new HashSet<>();
1✔
62
    private final Set<Group> groups = new HashSet<>();
1✔
63

64
    // self-service verification keys
65
    private String signupKey = null;
1✔
66
    private String changeEmailKey = null;
1✔
67
    private String resetPasswordKey = null;
1✔
68
    private String proposedEmail = null;
1✔
69

70
    // mfa properties
71
    private boolean mfaBypassed = false;
1✔
72
    @Nullable
73
    private String mfaEncryptedSecret;
74
    private boolean mfaIntruderLocked = false;
1✔
75
    @Nullable
76
    private Integer mfaIntruderAttempts;
77
    @Nullable
78
    private ReadableInstant mfaIntruderResetTime;
79

80
    // federated identities
81
    private String facebookId = null;
1✔
82
    private double facebookIdStrength = STRENGTH_NONE;
1✔
83

84
    // Global Registry ID
85
    @Nullable
86
    private String grMasterPersonId;
87
    @Nullable
88
    private String grStageMasterPersonId;
89
    @Nullable
90
    private String grPersonId;
91
    @Nullable
92
    private String grStagePersonId;
93
    @Nullable
94
    private String grSyncChecksum;
95
    @Nullable
96
    private String grStageSyncChecksum;
97

98
    // miscellaneous implementation meta-data
99
    @Nonnull
1✔
100
    private Map<String, Serializable> implMeta = Maps.newHashMap();
1✔
101

102
    // Cru person attributes
103
    private String employeeId;
104
    private String departmentNumber;
105
    private String cruDesignation;
106
    private String cruEmployeeStatus;
107
    private String cruGender;
108
    private String cruHrStatusCode;
109
    private String cruJobCode;
110
    private String cruManagerID;
111
    private String cruMinistryCode;
112
    private String cruPayGroup;
113
    private String cruSubMinistryCode;
114
    @Nonnull
1✔
115
    private Collection<String> cruProxyAddresses = Sets.newHashSet();
1✔
116
    private boolean orca;
117

118
    // other attributes (used by relay)
119
    private String city;
120
    private String state;
121
    private String postal;
122
    private String country;
123

124
    private String telephoneNumber;
125

126
    private String securityQuestion;
127
    private String securityAnswer;
128

129
    public User() {
1✔
130
    }
1✔
131

132
    protected User(final User source) {
1✔
133
        this.email = source.email;
1✔
134
        this.password = source.password;
1✔
135
        this.guid = source.guid;
1✔
136
        this.theKeyGuid = source.theKeyGuid;
1✔
137
        this.relayGuid = source.relayGuid;
1✔
138
        this.firstName = source.firstName;
1✔
139
        preferredName = source.preferredName;
1✔
140
        this.lastName = source.lastName;
1✔
141
        this.emailVerified = source.emailVerified;
1✔
142
        this.allowPasswordChange = source.allowPasswordChange;
1✔
143
        this.forcePasswordChange = source.forcePasswordChange;
1✔
144
        this.deactivated = source.deactivated;
1✔
145
        this.loginDisabled = source.loginDisabled;
1✔
146
        this.locked = source.locked;
1✔
147

148
        // mfa attributes
149
        mfaEncryptedSecret = source.mfaEncryptedSecret;
1✔
150
        mfaIntruderLocked = source.mfaIntruderLocked;
1✔
151
        mfaIntruderAttempts = source.mfaIntruderAttempts;
1✔
152
        mfaIntruderResetTime = source.mfaIntruderResetTime;
1✔
153

154
        this.domainsVisited.addAll(source.domainsVisited);
1✔
155
        this.groups.addAll(source.groups);
1✔
156

157
        this.signupKey = source.signupKey;
1✔
158
        this.changeEmailKey = source.changeEmailKey;
1✔
159
        this.resetPasswordKey = source.resetPasswordKey;
1✔
160
        this.proposedEmail = source.proposedEmail;
1✔
161

162
        this.facebookId = source.facebookId;
1✔
163
        this.facebookIdStrength = source.facebookIdStrength;
1✔
164

165
        grMasterPersonId = source.grMasterPersonId;
1✔
166
        grStageMasterPersonId = source.grStageMasterPersonId;
1✔
167
        grPersonId = source.grPersonId;
1✔
168
        grStagePersonId = source.grStagePersonId;
1✔
169
        grSyncChecksum = source.grSyncChecksum;
1✔
170
        grStageSyncChecksum = source.grStageSyncChecksum;
1✔
171

172
        this.employeeId = source.employeeId;
1✔
173
        this.departmentNumber = source.departmentNumber;
1✔
174
        this.cruDesignation = source.cruDesignation;
1✔
175
        this.cruEmployeeStatus = source.cruEmployeeStatus;
1✔
176
        this.cruGender = source.cruGender;
1✔
177
        this.cruHrStatusCode = source.cruHrStatusCode;
1✔
178
        this.cruJobCode = source.cruJobCode;
1✔
179
        this.cruManagerID = source.cruManagerID;
1✔
180
        this.cruMinistryCode = source.cruMinistryCode;
1✔
181
        this.cruPayGroup = source.cruPayGroup;
1✔
182
        this.cruSubMinistryCode = source.cruSubMinistryCode;
1✔
183
        this.cruProxyAddresses.addAll(source.cruProxyAddresses);
1✔
184
        this.country = source.country;
1✔
185

186
        this.city = source.city;
1✔
187
        this.state = source.state;
1✔
188
        this.postal = source.postal;
1✔
189
        this.telephoneNumber = source.telephoneNumber;
1✔
190

191
        this.implMeta.putAll(source.implMeta);
1✔
192

193
        this.pwdChangedTime = source.pwdChangedTime;
1✔
194

195
        this.securityQuestion = source.securityQuestion;
1✔
196
        this.securityAnswer = source.securityAnswer;
1✔
197
    }
1✔
198

199
    @Nullable
200
    public String getEmail() {
201
        return this.email;
1✔
202
    }
203

204
    public void setEmail(@Nullable final String email) {
205
        // preserve the emailVerified flag if the email isn't actually changing
206
        // (case changes are not considered changing emails)
207
        final boolean noChange = this.email == null ? email == null : this.email.equalsIgnoreCase(email);
1✔
208
        //noinspection SimplifiableConditionalExpression
209
        this.setEmail(email, noChange ? this.emailVerified : false);
1✔
210
    }
1✔
211

212
    public void setEmail(@Nullable final String email, final boolean verified) {
213
        this.email = email;
1✔
214
        this.emailVerified = verified;
1✔
215
    }
1✔
216

217
    /**
218
     * This method is for use by UserDao &amp; UserManager implementations only and is not meant for public use.
219
     */
220
    public String getPassword() {
221
        return this.password;
1✔
222
    }
223

224
    public void setPassword(final String password) {
225
        this.setPassword(password, false);
1✔
226
    }
1✔
227

228
    public void setPassword(final String password, final boolean forceChange) {
229
        this.password = password;
1✔
230
        this.forcePasswordChange = forceChange;
1✔
231
    }
1✔
232

233
    @Deprecated
234
    public String getGuid() {
235
        return this.guid;
1✔
236
    }
237

238
    @Deprecated
239
    public void setGuid(final String guid) {
240
        this.guid = guid;
1✔
241
    }
1✔
242

243
    public String getTheKeyGuid() {
244
        return this.theKeyGuid != null ? this.theKeyGuid : this.guid;
1✔
245
    }
246

247
    public String getRawTheKeyGuid() {
248
        return this.theKeyGuid;
1✔
249
    }
250

251
    public void setTheKeyGuid(final String guid) {
252
        this.theKeyGuid = guid;
1✔
253
    }
1✔
254

255
    public String getRelayGuid() {
256
        return this.relayGuid != null ? this.relayGuid : this.guid;
1✔
257
    }
258

259
    public String getRawRelayGuid() {
260
        return this.relayGuid;
1✔
261
    }
262

263
    public void setRelayGuid(final String guid) {
264
        this.relayGuid = guid;
1✔
265
    }
1✔
266

267
    public String getFirstName() {
268
        return this.firstName;
1✔
269
    }
270

271
    public void setFirstName(final String firstName) {
272
        this.firstName = firstName;
1✔
273
    }
1✔
274

275
    @Nullable
276
    public String getRawPreferredName() {
277
        return preferredName;
1✔
278
    }
279

280
    @Nullable
281
    public String getPreferredName() {
282
        return !Strings.isNullOrEmpty(preferredName) ? preferredName : firstName;
1✔
283
    }
284

285
    public void setPreferredName(@Nullable final String name) {
286
        preferredName = Objects.equal(firstName, name) ? null : name;
1✔
287
    }
1✔
288

289
    public String getLastName() {
290
        return this.lastName;
1✔
291
    }
292

293
    public void setLastName(final String lastName) {
294
        this.lastName = lastName;
1✔
295
    }
1✔
296

297
    public ReadableInstant getLoginTime()
298
    {
299
        return loginTime;
×
300
    }
301

302
    public void setLoginTime(final ReadableInstant loginTime)
303
    {
304
        this.loginTime = loginTime;
×
305
    }
×
306

307
    @Nullable
308
    public ReadableInstant getPasswordChangedTime() {
309
        return pwdChangedTime;
×
310
    }
311

312
    public void setPasswordChangedTime(@Nullable final ReadableInstant time) {
313
        this.pwdChangedTime = time;
×
314
    }
×
315

316
    @Deprecated
317
    public boolean isEmailVerified() {
1✔
318
        return this.emailVerified;
319
    }
320

321
    @Deprecated
1✔
322
    public void setEmailVerified(final boolean verified) {
1✔
323
        this.emailVerified = verified;
324
    }
325

1✔
326
    public boolean isAllowPasswordChange() {
327
        return allowPasswordChange;
328
    }
329

1✔
330
    public void setAllowPasswordChange(final boolean allow) {
1✔
331
        this.allowPasswordChange = allow;
332
    }
333

1✔
334
    public boolean isForcePasswordChange() {
335
        return forcePasswordChange;
336
    }
337

1✔
338
    public void setForcePasswordChange(final boolean force) {
1✔
339
        this.forcePasswordChange = force;
340
    }
341

1✔
342
    public boolean isDeactivated() {
343
        return this.deactivated;
344
    }
345

1✔
346
    public void setDeactivated(final boolean deactivated) {
1✔
347
        this.deactivated = deactivated;
348
    }
349

1✔
350
    public boolean isLoginDisabled() {
351
        return this.loginDisabled;
352
    }
353

1✔
354
    public void setLoginDisabled(final boolean disabled) {
1✔
355
        this.loginDisabled = disabled;
356
    }
357

1✔
358
    public boolean isLocked() {
359
        return this.locked;
360
    }
361

1✔
362
    public void setLocked(final boolean locked) {
1✔
363
        this.locked = locked;
364
    }
365

×
366
    public String getEmployeeId() {
367
        return employeeId;
368
    }
369

×
370
    public void setEmployeeId(String employeeId) {
×
371
        this.employeeId = employeeId;
372
    }
373

×
374
    public String getDepartmentNumber() {
375
        return departmentNumber;
376
    }
377

×
378
    public void setDepartmentNumber(String departmentNumber) {
×
379
        this.departmentNumber = departmentNumber;
380
    }
381

×
382
    public String getCruDesignation() {
383
        return cruDesignation;
384
    }
385

×
386
    public void setCruDesignation(String cruDesignation) {
×
387
        this.cruDesignation = cruDesignation;
388
    }
389

×
390
    public String getCruEmployeeStatus() {
391
        return cruEmployeeStatus;
392
    }
393

×
394
    public void setCruEmployeeStatus(String cruEmployeeStatus) {
×
395
        this.cruEmployeeStatus = cruEmployeeStatus;
396
    }
397

×
398
    public String getCruGender() {
399
        return cruGender;
400
    }
401

×
402
    public void setCruGender(String cruGender) {
×
403
        this.cruGender = cruGender;
404
    }
405

×
406
    public String getCruHrStatusCode() {
407
        return cruHrStatusCode;
408
    }
409

×
410
    public void setCruHrStatusCode(String cruHrStatusCode) {
×
411
        this.cruHrStatusCode = cruHrStatusCode;
412
    }
413

×
414
    public String getCruJobCode() {
415
        return cruJobCode;
416
    }
417

×
418
    public void setCruJobCode(String cruJobCode) {
×
419
        this.cruJobCode = cruJobCode;
420
    }
421

×
422
    public String getCruManagerID() {
423
        return cruManagerID;
424
    }
425

×
426
    public void setCruManagerID(String cruManagerID) {
×
427
        this.cruManagerID = cruManagerID;
428
    }
429

×
430
    public String getCruMinistryCode() {
431
        return cruMinistryCode;
432
    }
433

×
434
    public void setCruMinistryCode(String cruMinistryCode) {
×
435
        this.cruMinistryCode = cruMinistryCode;
436
    }
437

×
438
    public String getCruPayGroup() {
439
        return cruPayGroup;
440
    }
441

×
442
    public void setCruPayGroup(String cruPayGroup) {
×
443
        this.cruPayGroup = cruPayGroup;
444
    }
445

×
446
    public String getCruSubMinistryCode() {
447
        return cruSubMinistryCode;
448
    }
449

×
450
    public void setCruSubMinistryCode(String cruSubMinistryCode) {
×
451
        this.cruSubMinistryCode = cruSubMinistryCode;
452
    }
453

454
    @Nonnull
×
455
    public Collection<String> getCruProxyAddresses() {
456
        return cruProxyAddresses;
457
    }
458

×
459
    public void setCruProxyAddresses(@Nonnull final Collection<String> addresses) {
×
460
        cruProxyAddresses = addresses;
461
    }
462

463
    @Deprecated
×
464
    public Set<String> getCruPasswordHistory() {
465
        return Collections.emptySet();
466
    }
467

468
    @Deprecated
×
469
    public void setCruPasswordHistory(@Nullable final Collection<String> history) {
470
    }
NEW
471

×
472
    public boolean isOrca() {
473
        return orca;
474
    }
NEW
475

×
NEW
476
    public void setOrca(boolean orca) {
×
477
        this.orca = orca;
478
    }
479

×
480
    public String getCity() {
481
        return city;
482
    }
483

×
484
    public void setCity(String city) {
×
485
        this.city = city;
486
    }
487

×
488
    public String getState() {
489
        return state;
490
    }
491

×
492
    public void setState(String state) {
×
493
        this.state = state;
494
    }
495

×
496
    public String getPostal() {
497
        return postal;
498
    }
499

×
500
    public void setPostal(String postal) {
×
501
        this.postal = postal;
502
    }
503

×
504
    public String getCountry() {
505
        return country;
506
    }
507

×
508
    public void setCountry(String country) {
×
509
        this.country = country;
510
    }
511

×
512
    public String getTelephoneNumber() {
513
        return telephoneNumber;
514
    }
515

×
516
    public void setTelephoneNumber(String telephoneNumber) {
×
517
        this.telephoneNumber = telephoneNumber;
518
    }
519

×
520
    public String getSecurityQuestion() {
521
        return securityQuestion;
522
    }
523

×
524
    public void setSecurityQuestion(final String securityQuestion) {
×
525
        this.securityQuestion = securityQuestion;
526
    }
527

528
    /**
529
     * Not meant for public use.
530
     */
×
531
    public String getSecurityAnswer() {
532
        return securityAnswer;
533
    }
534

535
    /**
536
     * Return whether or not this user has a Security Answer set
537
     *
538
     * @return boolean indicating if the user has a security answer set
539
     */
1✔
540
    public boolean hasSecurityAnswer() {
541
        return !Strings.isNullOrEmpty(securityAnswer);
542
    }
543

544
    /**
545
     * Check the plain text security answer against this security answer, which is already hashed
546
     *
547
     * @param securityAnswer plain text security answer
548
     *
549
     * @return true if provided security answer matches this object's
550
     */
1✔
551
    public boolean checkSecurityAnswer(final String securityAnswer) {
1✔
552
        final String normalized = normalize(securityAnswer);
1✔
553
        return !Strings.isNullOrEmpty(this.securityAnswer) && !Strings.isNullOrEmpty(normalized) &&
1✔
554
                (HashUtility.checkHash(normalized, this.securityAnswer) ||
555
                        HashUtility.checkHash(securityAnswer, this.securityAnswer));
556
    }
557

558
    /**
559
     * Store the hashed value of the plain text security answer
560
     *
561
     * @param securityAnswer plain text security answer
562
     */
1✔
563
    public void setSecurityAnswer(final String securityAnswer) {
1✔
564
        this.setSecurityAnswer(securityAnswer, true);
565
    }
566

567
    /**
568
     * Not meant for public use.
569
     */
1✔
570
    public void setSecurityAnswer(final String securityAnswer, boolean hash) {
1✔
571
        if (hash) {
1✔
572
            final String normalized = normalize(securityAnswer);
1✔
573
            this.securityAnswer = Strings.isNullOrEmpty(normalized) ? null : HashUtility.getHash(normalized);
×
574
        } else {
575
            this.securityAnswer = securityAnswer;
1✔
576
        }
577
    }
578

1✔
579
    private String normalize(final String string) {
1✔
580
        return Strings.isNullOrEmpty(string) ? string :
581
                CharMatcher.whitespace().trimAndCollapseFrom(string, ' ').toLowerCase();
582
    }
583

584
    /**
585
     * @return the domainsVisited
586
     */
1✔
587
    public Set<String> getDomainsVisited() {
588
        return Collections.unmodifiableSet(this.domainsVisited);
589
    }
590

591
    /**
592
     * @param domains a collection of domains visited
593
     */
×
594
    public void setDomainsVisited(final Collection<String> domains) {
×
595
        this.domainsVisited.clear();
×
596
        if (domains != null) {
597
            this.domainsVisited.addAll(Collections2.filter(domains, Predicates.notNull()));
×
598
        }
599
    }
600

1✔
601
    public void addDomainsVisited(final String domain) {
1✔
602
        if (StringUtils.hasText(domain)) {
603
            this.domainsVisited.add(domain);
1✔
604
        }
605
    }
606

607
    /**
608
     * @param groups the groups to set
609
     */
×
610
    public void setGroups(final Collection<Group> groups) {
×
611
        this.groups.clear();
×
612
        if (groups != null) {
613
            this.groups.addAll(groups);
×
614
        }
615
    }
616

617
    /**
618
     * @return the groupMembership
619
     */
1✔
620
    public Set<Group> getGroups() {
621
        return Collections.unmodifiableSet(this.groups);
622
    }
623

×
624
    public String getSignupKey() {
625
        return this.signupKey;
626
    }
627

×
628
    public void setSignupKey(final String key) {
×
629
        this.signupKey = key;
630
    }
631

×
632
    public String getChangeEmailKey() {
633
        return this.changeEmailKey;
634
    }
635

×
636
    public void setChangeEmailKey(final String key) {
×
637
        this.changeEmailKey = key;
638
    }
639

×
640
    public String getResetPasswordKey() {
641
        return this.resetPasswordKey;
642
    }
643

×
644
    public void setResetPasswordKey(final String key) {
×
645
        this.resetPasswordKey = key;
646
    }
647

×
648
    public String getProposedEmail() {
649
        return this.proposedEmail;
650
    }
651

×
652
    public void setProposedEmail(final String email) {
×
653
        this.proposedEmail = email;
654
    }
655

656
    // region MFA related methods
657

×
658
    public boolean isMfaEnabled() {
659
        return mfaEncryptedSecret != null;
660
    }
661

×
662
    public boolean isMfaBypassed() {
663
        return mfaBypassed;
664
    }
665

×
666
    public void setMfaBypassed(final boolean bypassed) {
×
667
        mfaBypassed = bypassed;
668
    }
669

670
    @Nullable
×
671
    public String getMfaEncryptedSecret() {
672
        return mfaEncryptedSecret;
673
    }
674

×
675
    public void setMfaEncryptedSecret(@Nullable final String encryptedSecret) {
×
676
        mfaEncryptedSecret = encryptedSecret;
677
    }
678

1✔
679
    public boolean isMfaIntruderLocked() {
680
        return mfaIntruderLocked;
681
    }
682

683
    /**
684
     * @return true if mfaIntruderLocked changed, false if it stayed the same.
685
     */
1✔
686
    public boolean setMfaIntruderLocked(final boolean state) {
1✔
687
        if (mfaIntruderLocked != state) {
1✔
688
            mfaIntruderLocked = state;
689
            return true;
1✔
690
        }
691
        return false;
692
    }
693

694
    @Nullable
1✔
695
    public Integer getMfaIntruderAttempts() {
696
        return mfaIntruderAttempts;
697
    }
698

699
    /**
700
     * @return true if mfaIntruderAttempts changed, false if it stayed the same.
701
     */
1✔
702
    public boolean setMfaIntruderAttempts(@Nullable final Integer attempts) {
1✔
703
        if (!Objects.equal(mfaIntruderAttempts, attempts)) {
1✔
704
            mfaIntruderAttempts = attempts;
705
            return true;
1✔
706
        }
707
        return false;
708
    }
709

710
    @Nullable
1✔
711
    public ReadableInstant getMfaIntruderResetTime() {
712
        return mfaIntruderResetTime;
713
    }
714

715
    /**
716
     * @return true if mfaIntruderResetTime changed, false if it stayed the same.
717
     */
1✔
718
    public boolean setMfaIntruderResetTime(@Nullable final ReadableInstant time) {
1✔
719
        if (time == null ? mfaIntruderResetTime != null :
1✔
720
                (mfaIntruderResetTime == null || !time.isEqual(mfaIntruderResetTime))) {
1✔
721
            mfaIntruderResetTime = time;
722
            return true;
1✔
723
        }
724
        return false;
725
    }
726

727
    // endregion MFA related methods
728

×
729
    public void setFacebookId(final String id, final Number strength) {
×
730
        this.facebookId = id;
×
731
        this.facebookIdStrength = (strength != null ? strength.doubleValue() : STRENGTH_NONE);
×
732
        if (this.facebookIdStrength < STRENGTH_NONE) {
×
733
            this.facebookIdStrength = STRENGTH_NONE;
×
734
        } else if (this.facebookIdStrength > STRENGTH_FULL) {
735
            this.facebookIdStrength = STRENGTH_FULL;
×
736
        }
737
    }
738

×
739
    public String getFacebookId() {
740
        return this.facebookId;
741
    }
742

×
743
    public Double getFacebookIdStrengthFor(final String id) {
×
744
        if (id != null && id.equals(this.facebookId)) {
745
            return this.facebookIdStrength;
×
746
        }
747
        return STRENGTH_NONE;
748
    }
749

×
750
    public void removeFacebookId(final String id) {
×
751
        if (id != null && id.equals(this.facebookId)) {
×
752
            this.facebookId = null;
753
            this.facebookIdStrength = STRENGTH_NONE;
×
754
        }
755
    }
756

757
    // region Global Registry related methods
758

759
    @Nullable
×
760
    public String getGrMasterPersonId() {
761
        return grMasterPersonId;
762
    }
763

×
764
    public void setGrMasterPersonId(@Nullable final String id) {
×
765
        grMasterPersonId = id;
766
    }
767

768
    @Nullable
×
769
    public String getGrStageMasterPersonId() {
770
        return grStageMasterPersonId;
771
    }
772

×
773
    public void setGrStageMasterPersonId(@Nullable final String id) {
×
774
        grStageMasterPersonId = id;
775
    }
776

777
    @Nullable
×
778
    public String getGrPersonId() {
779
        return grPersonId;
780
    }
781

×
782
    public void setGrPersonId(@Nullable final String id) {
×
783
        grPersonId = id;
784
    }
785

786
    @Nullable
×
787
    public String getGrStagePersonId() {
788
        return grStagePersonId;
789
    }
790

×
791
    public void setGrStagePersonId(@Nullable final String id) {
×
792
        grStagePersonId = id;
793
    }
794

795
    @Nullable
×
796
    public String getGrSyncChecksum() {
797
        return grSyncChecksum;
798
    }
799

×
800
    public void setGrSyncChecksum(@Nullable final String checksum) {
×
801
        grSyncChecksum = checksum;
802
    }
803

804
    @Nullable
×
805
    public String getGrStageSyncChecksum() {
806
        return grStageSyncChecksum;
807
    }
808

×
809
    public void setGrStageSyncChecksum(@Nullable final String checksum) {
×
810
        grStageSyncChecksum = checksum;
811
    }
812

813
    // endregion Global Registry related methods
814

815
    /**
816
     * This method is for use by UserDao &amp; UserManager implementations only and is not meant for public use.
817
     */
818
    @Nullable
×
819
    public <T> T getImplMeta(@Nonnull final String key, @Nonnull final Class<T> clazz) {
×
820
        final Serializable obj = this.implMeta.get(key);
×
821
        if(clazz.isInstance(obj)) {
822
            return clazz.cast(obj);
×
823
        }
824
        return null;
825
    }
826

827
    /**
828
     * This method is for use by UserDao &amp; UserManager implementations only and is not meant for public use.
829
     */
×
830
    public Serializable removeImplMeta(@Nonnull final String key) {
831
        return this.implMeta.remove(key);
832
    }
833

834
    /**
835
     * This method is for use by UserDao &amp; UserManager implementations only and is not meant for public use.
836
     */
×
837
    public Serializable setImplMeta(@Nonnull final String key, @Nullable final Serializable obj) {
838
        return this.implMeta.put(key, obj);
839
    }
840

841
    @Override
842
    @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneDoesntDeclareCloneNotSupportedException"})
1✔
843
    public User clone() {
844
        return new User(this);
845
    }
846

847
    @Override
×
848
    public String toString() {
×
849
        return MoreObjects.toStringHelper(this).omitNullValues()
×
850
                .add("email", email)
×
851
                .add("guid", guid)
×
852
                .add("theKeyGuid", this.getTheKeyGuid())
×
853
                .add("relayGuid", this.getRelayGuid())
×
854
                .add("firstName", firstName)
×
855
                .add("preferredName", preferredName)
×
856
                .add("lastName", lastName)
×
857
                .add("emailVerified", emailVerified)
×
858
                .add("allowPasswordChange", allowPasswordChange)
×
859
                .add("forcePasswordChange", forcePasswordChange)
×
860
                .add("deactivated", deactivated)
×
861
                .add("loginDisabled", loginDisabled)
×
862
                .add("locked", locked)
×
863
                .add("domainsVisited", domainsVisited)
×
864
                .add("groups", groups)
×
865
                .add("signupKey", signupKey)
×
866
                .add("changeEmailKey", changeEmailKey)
×
867
                .add("resetPasswordKey", resetPasswordKey)
×
868
                .add("proposedEmail", proposedEmail)
×
869
                .add("mfaIntruderLocked", mfaIntruderLocked)
×
870
                .add("mfaIntruderAttempts", mfaIntruderAttempts)
×
871
                .add("mfaIntruderResetTime", mfaIntruderResetTime)
×
872
                .add("facebookId", facebookId)
×
873
                .add("facebookIdStrength", facebookIdStrength)
×
874
                .add("employeeId", employeeId)
×
875
                .add("departmentNumber", departmentNumber)
×
876
                .add("cruDesignation", cruDesignation)
×
877
                .add("cruEmployeeStatus", cruEmployeeStatus)
×
878
                .add("cruGender", cruGender)
×
879
                .add("cruHrStatusCode", cruHrStatusCode)
×
880
                .add("cruJobCode", cruJobCode)
×
881
                .add("cruManagerID", cruManagerID)
×
882
                .add("cruMinistryCode", cruMinistryCode)
×
883
                .add("cruPayGroup", cruPayGroup)
×
884
                .add("cruSubMinistryCode", cruSubMinistryCode)
×
885
                .add("cruProxyAddresses", cruProxyAddresses)
×
886
                .add("city", city)
×
887
                .add("state", state)
×
888
                .add("postal", postal)
×
889
                .add("country", country)
×
890
                .add("telephoneNumber", telephoneNumber)
×
891
                .add("pwdChangedTime", pwdChangedTime)
×
892
                .add("cruSecurityQuestion", securityQuestion)
×
893
                .add("cruSecurityAnswer", securityAnswer)
894
                .toString();
895
    }
896

897
    @Override
×
898
    public int hashCode() {
899
        return Objects.hashCode(
900
                email,
901
                password,
×
902
                guid,
×
903
                getTheKeyGuid(),
904
                getRelayGuid(),
905
                firstName,
×
906
                lastName,
×
907
                emailVerified,
×
908
                allowPasswordChange,
×
909
                forcePasswordChange,
×
910
                deactivated,
×
911
                loginDisabled,
912
                locked,
913
                domainsVisited,
914
                groups,
915
                signupKey,
916
                changeEmailKey,
917
                resetPasswordKey,
918
                proposedEmail,
×
919
                mfaEncryptedSecret,
920
                mfaIntruderLocked,
921
                mfaIntruderAttempts,
922
                mfaIntruderResetTime,
×
923
                facebookId,
924
                facebookIdStrength,
925
                grMasterPersonId,
926
                grStageMasterPersonId,
927
                grPersonId,
928
                grStagePersonId,
929
                grSyncChecksum,
930
                grStageSyncChecksum,
931
                employeeId,
932
                departmentNumber,
933
                cruDesignation,
934
                cruEmployeeStatus,
935
                cruGender,
936
                cruHrStatusCode,
937
                cruJobCode,
938
                cruManagerID,
939
                cruMinistryCode,
940
                cruPayGroup,
941
                preferredName,
942
                cruSubMinistryCode,
943
                cruProxyAddresses,
944
                city,
945
                state,
946
                postal,
947
                country,
948
                telephoneNumber,
949
                securityQuestion,
950
                securityAnswer
951
        );
952
    }
953

954
    @Override
×
955
    public boolean equals(final Object obj) {
×
956
        if (this == obj) {return true;}
×
957
        if (obj == null || getClass() != obj.getClass()) {return false;}
×
958
        final User other = (User) obj;
×
959
        return Objects.equal(this.email, other.email) &&
×
960
                Objects.equal(this.password, other.password) &&
×
961
                Objects.equal(this.guid, other.guid) &&
×
962
                Objects.equal(this.getTheKeyGuid(), other.getTheKeyGuid()) &&
×
963
                Objects.equal(this.getRelayGuid(), other.getRelayGuid()) &&
×
964
                Objects.equal(this.firstName, other.firstName) &&
×
965
                Objects.equal(preferredName, other.preferredName) &&
×
966
                Objects.equal(this.lastName, other.lastName) &&
×
967
                Objects.equal(this.emailVerified, other.emailVerified) &&
×
968
                Objects.equal(this.allowPasswordChange, other.allowPasswordChange) &&
×
969
                Objects.equal(this.forcePasswordChange, other.forcePasswordChange) &&
×
970
                Objects.equal(this.deactivated, other.deactivated) &&
×
971
                Objects.equal(this.loginDisabled, other.loginDisabled) &&
×
972
                Objects.equal(this.locked, other.locked) &&
×
973
                Objects.equal(this.domainsVisited, other.domainsVisited) &&
×
974
                Objects.equal(this.groups, other.groups) &&
×
975
                Objects.equal(this.signupKey, other.signupKey) &&
×
976
                Objects.equal(this.changeEmailKey, other.changeEmailKey) &&
×
977
                Objects.equal(this.resetPasswordKey, other.resetPasswordKey) &&
×
978
                Objects.equal(this.proposedEmail, other.proposedEmail) &&
979
                Objects.equal(mfaEncryptedSecret, other.mfaEncryptedSecret) &&
×
980
                mfaIntruderLocked == other.mfaIntruderLocked &&
×
981
                Objects.equal(mfaIntruderAttempts, other.mfaIntruderAttempts) &&
×
982
                Objects.equal(mfaIntruderResetTime, other.mfaIntruderResetTime) &&
×
983
                Objects.equal(this.facebookId, other.facebookId) &&
×
984
                Objects.equal(this.facebookIdStrength, other.facebookIdStrength) &&
×
985
                Objects.equal(grMasterPersonId, other.grMasterPersonId) &&
×
986
                Objects.equal(grStageMasterPersonId, other.grStageMasterPersonId) &&
×
987
                Objects.equal(grPersonId, other.grPersonId) &&
×
988
                Objects.equal(grStagePersonId, other.grStagePersonId) &&
×
989
                Objects.equal(grSyncChecksum, other.grSyncChecksum) &&
×
990
                Objects.equal(grStageSyncChecksum, other.grStageSyncChecksum) &&
×
991
                Objects.equal(this.employeeId, other.employeeId) &&
×
992
                Objects.equal(this.departmentNumber, other.departmentNumber) &&
×
993
                Objects.equal(this.cruDesignation, other.cruDesignation) &&
×
994
                Objects.equal(this.cruEmployeeStatus, other.cruEmployeeStatus) &&
×
995
                Objects.equal(this.cruGender, other.cruGender) &&
×
996
                Objects.equal(this.cruHrStatusCode, other.cruHrStatusCode) &&
×
997
                Objects.equal(this.cruJobCode, other.cruJobCode) &&
×
998
                Objects.equal(this.cruManagerID, other.cruManagerID) &&
×
999
                Objects.equal(this.cruMinistryCode, other.cruMinistryCode) &&
×
1000
                Objects.equal(this.cruPayGroup, other.cruPayGroup) &&
×
1001
                Objects.equal(this.cruSubMinistryCode, other.cruSubMinistryCode) &&
×
1002
                this.cruProxyAddresses.size() == other.cruProxyAddresses.size() && this.cruProxyAddresses.containsAll(other.cruProxyAddresses) &&
×
1003
                Objects.equal(this.city, other.city) &&
×
1004
                Objects.equal(this.state, other.state) &&
×
1005
                Objects.equal(this.postal, other.postal) &&
×
1006
                Objects.equal(this.country, other.country) &&
×
1007
                Objects.equal(this.telephoneNumber, other.telephoneNumber) &&
×
1008
                Objects.equal(this.securityQuestion, other.securityQuestion) &&
1009
                Objects.equal(this.securityAnswer, other.securityAnswer);
1010
    }
1011
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc