Skip to content

Commit 8604794

Browse files
committed
WebAuthn: removed username cookie
1 parent 3814d51 commit 8604794

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

security-webauthn-quickstart/src/main/java/org/acme/security/webauthn/LoginResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public Response register(@RestForm String userName,
6767
}
6868
try {
6969
// store the user
70-
WebAuthnCredentialRecord credentialRecord = this.webAuthnSecurity.register(webAuthnResponse, ctx).await().indefinitely();
70+
WebAuthnCredentialRecord credentialRecord = this.webAuthnSecurity.register(userName, webAuthnResponse, ctx).await().indefinitely();
7171
User newUser = new User();
7272
newUser.userName = credentialRecord.getUserName();
7373
WebAuthnCredential credential = new WebAuthnCredential(credentialRecord, newUser);

security-webauthn-quickstart/src/test/java/org/acme/security/webauthn/test/WebAuthnResourceTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private void testWebAuthn(String userName, User user, Endpoint endpoint) {
5151
String challenge = WebAuthnEndpointHelper.obtainRegistrationChallenge(userName, cookieFilter);
5252
JsonObject registrationJson = token.makeRegistrationJson(challenge);
5353
if(endpoint == Endpoint.DEFAULT)
54-
WebAuthnEndpointHelper.invokeRegistration(registrationJson, cookieFilter);
54+
WebAuthnEndpointHelper.invokeRegistration(userName, registrationJson, cookieFilter);
5555
else {
5656
invokeCustomEndpoint("/register", cookieFilter, request -> {
5757
WebAuthnEndpointHelper.addWebAuthnRegistrationFormParameters(request, registrationJson);
@@ -100,7 +100,6 @@ private void invokeCustomEndpoint(String uri, Filter cookieFilter, Consumer<Requ
100100
.statusCode(200)
101101
.log().ifValidationFails()
102102
.cookie(WebAuthnEndpointHelper.getChallengeCookie(), Matchers.is(""))
103-
.cookie(WebAuthnEndpointHelper.getChallengeUsernameCookie(), Matchers.is(""))
104103
.cookie(WebAuthnEndpointHelper.getMainCookie(), Matchers.notNullValue());
105104
}
106105

security-webauthn-reactive-quickstart/src/main/java/org/acme/security/webauthn/LoginResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public Uni<Response> register(@RestForm String userName,
7474
// Duplicate user
7575
return Uni.createFrom().item(Response.status(Status.BAD_REQUEST).build());
7676
}
77-
Uni<WebAuthnCredentialRecord> credentialRecord = this.webAuthnSecurity.register(webAuthnResponse, ctx);
77+
Uni<WebAuthnCredentialRecord> credentialRecord = this.webAuthnSecurity.register(userName, webAuthnResponse, ctx);
7878

7979
return credentialRecord
8080
// store the user

security-webauthn-reactive-quickstart/src/test/java/org/acme/security/webauthn/test/WebAuthnResourceTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private void testWebAuthn(String userName, User user, Endpoint endpoint) {
5151
String challenge = WebAuthnEndpointHelper.obtainRegistrationChallenge(userName, cookieFilter);
5252
JsonObject registrationJson = token.makeRegistrationJson(challenge);
5353
if(endpoint == Endpoint.DEFAULT)
54-
WebAuthnEndpointHelper.invokeRegistration(registrationJson, cookieFilter);
54+
WebAuthnEndpointHelper.invokeRegistration(userName, registrationJson, cookieFilter);
5555
else {
5656
invokeCustomEndpoint("/register", cookieFilter, request -> {
5757
WebAuthnEndpointHelper.addWebAuthnRegistrationFormParameters(request, registrationJson);
@@ -100,7 +100,6 @@ private void invokeCustomEndpoint(String uri, Filter cookieFilter, Consumer<Requ
100100
.statusCode(200)
101101
.log().ifValidationFails()
102102
.cookie(WebAuthnEndpointHelper.getChallengeCookie(), Matchers.is(""))
103-
.cookie(WebAuthnEndpointHelper.getChallengeUsernameCookie(), Matchers.is(""))
104103
.cookie(WebAuthnEndpointHelper.getMainCookie(), Matchers.notNullValue());
105104
}
106105

0 commit comments

Comments
 (0)