Add webauthn for organization authenticator when org is selected

Closes #44735

(cherry picked from commit 7be37f1e0dbab2aa8437eaeb3f2edeae9c963a15)

Signed-off-by: rmartinc <rmartinc@redhat.com>
This commit is contained in:
Ricardo Martin 2026-01-05 12:18:34 +01:00 committed by GitHub
parent fec5110e40
commit 797bd2221c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 0 deletions

View File

@ -364,6 +364,10 @@ public class OrganizationAuthenticator extends IdentityProviderAuthenticator {
form.addError(new FormMessage("Your email domain matches the " + organization.getName() + " organization but you don't have an account yet."));
}
// user is null, setup webauthn data if enabled
if (webauthnAuth.isPasskeysEnabled()) {
webauthnAuth.fillContextForm(context);
}
context.challenge(form.createLoginUsername());
}

View File

@ -107,6 +107,23 @@ public class PasskeysOrganizationAuthenticationTest extends AbstractWebAuthnVirt
appPage.assertCurrent();
events.expectLogin()
.user(user.getId())
.detail(Details.USERNAME, user.getUsername())
.detail(Details.CREDENTIAL_TYPE, WebAuthnCredentialModel.TYPE_PASSWORDLESS)
.detail(WebAuthnConstants.USER_VERIFICATION_CHECKED, "true")
.assertEvent();
logout();
events.clear();
// login forcing the organization
oauth.scope("organization:email");
oauth.openLoginForm();
WaitUtils.waitForPageToLoad();
appPage.assertCurrent();
events.expectLogin()
.user(user.getId())
.detail(Details.USERNAME, user.getUsername())