Skip to content

Commit 3214b18

Browse files
author
bobharper208
committed
Add user parameter requirement to isConditionalPasskeysEnabled method
This change modifies the method signature to require a UserModel parameter for proper user context validation during conditional passkey checks.
1 parent bba869b commit 3214b18

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

services/src/main/java/org/keycloak/authentication/authenticators/browser/UsernamePasswordForm.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public void authenticate(AuthenticationFlowContext context) {
112112
}
113113
}
114114
// setup webauthn data when passkeys enabled
115-
if (isConditionalPasskeysEnabled()) {
115+
if (isConditionalPasskeysEnabled(context.getUser())) {
116116
webauthnAuth.fillContextForm(context);
117117
}
118118
Response challengeResponse = challenge(context, formData);
@@ -134,7 +134,7 @@ protected Response challenge(AuthenticationFlowContext context, MultivaluedMap<S
134134

135135
@Override
136136
protected Response challenge(AuthenticationFlowContext context, String error, String field) {
137-
if (isConditionalPasskeysEnabled()) {
137+
if (isConditionalPasskeysEnabled(context.getUser())) {
138138
// setup webauthn data when possible
139139
webauthnAuth.fillContextForm(context);
140140
}
@@ -157,8 +157,8 @@ public void close() {
157157

158158
}
159159

160-
protected boolean isConditionalPasskeysEnabled() {
161-
return webauthnAuth != null && webauthnAuth.isPasskeysEnabled();
160+
protected boolean isConditionalPasskeysEnabled(UserModel user) {
161+
return webauthnAuth != null && webauthnAuth.isPasskeysEnabled() && user != null;
162162
}
163163

164164
}

0 commit comments

Comments
 (0)