20
20
21
21
import java .util .Collections ;
22
22
import java .util .HashSet ;
23
+ import java .util .List ;
23
24
import java .util .Set ;
24
25
25
26
public class LoginMethod {
@@ -42,6 +43,8 @@ public class LoginMethod {
42
43
43
44
public final Set <String > tenantIds ;
44
45
46
+ public final WebAuthN webauthN ;
47
+
45
48
public transient final String passwordHash ;
46
49
47
50
private boolean didCallSetExternalUserId = false ;
@@ -55,6 +58,7 @@ public LoginMethod(String recipeUserId, long timeJoined, boolean verified, Strin
55
58
this .email = email ;
56
59
this .phoneNumber = null ;
57
60
this .thirdParty = null ;
61
+ this .webauthN = null ;
58
62
this .tenantIds = new HashSet <>();
59
63
Collections .addAll (this .tenantIds , tenantIds );
60
64
this .passwordHash = passwordHash ;
@@ -71,6 +75,7 @@ public LoginMethod(String recipeUserId, long timeJoined, boolean verified, Passw
71
75
this .tenantIds = new HashSet <>();
72
76
Collections .addAll (this .tenantIds , tenantIds );
73
77
this .thirdParty = null ;
78
+ this .webauthN = null ;
74
79
this .passwordHash = null ;
75
80
}
76
81
@@ -84,6 +89,22 @@ public LoginMethod(String recipeUserId, long timeJoined, boolean verified, Strin
84
89
this .tenantIds = new HashSet <>();
85
90
Collections .addAll (this .tenantIds , tenantIds );
86
91
this .thirdParty = thirdPartyInfo ;
92
+ this .webauthN = null ;
93
+ this .phoneNumber = null ;
94
+ this .passwordHash = null ;
95
+ }
96
+
97
+ public LoginMethod (String recipeUserId , long timeJoined , boolean verified , String email , WebAuthN webauthN ,
98
+ String [] tenantIds ) {
99
+ this .verified = verified ;
100
+ this .timeJoined = timeJoined ;
101
+ this .recipeUserId = recipeUserId ;
102
+ this .recipeId = RECIPE_ID .WEBAUTHN ;
103
+ this .email = email ;
104
+ this .tenantIds = new HashSet <>();
105
+ Collections .addAll (this .tenantIds , tenantIds );
106
+ this .webauthN = webauthN ;
107
+ this .thirdParty = null ;
87
108
this .phoneNumber = null ;
88
109
this .passwordHash = null ;
89
110
}
@@ -147,6 +168,32 @@ public int hashCode() {
147
168
}
148
169
}
149
170
171
+ public static class WebAuthN {
172
+ public List <String > credentialIds ;
173
+
174
+ public WebAuthN (List <String > credentialIds ) {
175
+ this .credentialIds = credentialIds ;
176
+ }
177
+
178
+ public void addCredentialId (String credentialId ) {
179
+ this .credentialIds .add (credentialId );
180
+ }
181
+
182
+ @ Override
183
+ public boolean equals (Object other ) {
184
+ if (!(other instanceof WebAuthN )) {
185
+ return false ;
186
+ }
187
+ WebAuthN webauthN = (WebAuthN ) other ;
188
+ return this .credentialIds .equals (webauthN .credentialIds );
189
+ }
190
+
191
+ @ Override
192
+ public int hashCode () {
193
+ return credentialIds .hashCode ();
194
+ }
195
+ }
196
+
150
197
@ Override
151
198
public boolean equals (Object other ) {
152
199
if (!(other instanceof LoginMethod )) {
@@ -159,6 +206,7 @@ public boolean equals(Object other) {
159
206
&& java .util .Objects .equals (this .phoneNumber , otherLoginMethod .phoneNumber )
160
207
&& java .util .Objects .equals (this .passwordHash , otherLoginMethod .passwordHash )
161
208
&& java .util .Objects .equals (this .thirdParty , otherLoginMethod .thirdParty )
209
+ && java .util .Objects .equals (this .webauthN , otherLoginMethod .webauthN )
162
210
&& this .tenantIds .equals (otherLoginMethod .tenantIds );
163
211
}
164
212
@@ -176,6 +224,7 @@ public int hashCode() {
176
224
result = 31 * result + tenantIds .hashCode ();
177
225
result = 31 * result + (passwordHash != null ? passwordHash .hashCode () : 0 );
178
226
result = 31 * result + (thirdParty != null ? thirdParty .hashCode () : 0 );
227
+ result = 31 * result + (webauthN != null ? webauthN .hashCode () : 0 );
179
228
return result ;
180
229
}
181
230
}
0 commit comments